fix(compiler): add equiv & disp attributes to Xliff2 ICU placeholders (#18283)
Fixes #17344 PR Close #18283
This commit is contained in:
parent
b3085e96c2
commit
38ec05f533
|
@ -165,15 +165,20 @@ class _WriteVisitor implements i18n.Visitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
visitPlaceholder(ph: i18n.Placeholder, context?: any): xml.Node[] {
|
visitPlaceholder(ph: i18n.Placeholder, context?: any): xml.Node[] {
|
||||||
|
const idStr = (this._nextPlaceholderId++).toString();
|
||||||
return [new xml.Tag(_PLACEHOLDER_TAG, {
|
return [new xml.Tag(_PLACEHOLDER_TAG, {
|
||||||
id: (this._nextPlaceholderId++).toString(),
|
id: idStr,
|
||||||
equiv: ph.name,
|
equiv: ph.name,
|
||||||
disp: `{{${ph.value}}}`,
|
disp: `{{${ph.value}}}`,
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): xml.Node[] {
|
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): xml.Node[] {
|
||||||
return [new xml.Tag(_PLACEHOLDER_TAG, {id: (this._nextPlaceholderId++).toString()})];
|
const cases = Object.keys(ph.value.cases).map((value: string) => value + ' {...}').join(' ');
|
||||||
|
const idStr = (this._nextPlaceholderId++).toString();
|
||||||
|
return [new xml.Tag(
|
||||||
|
_PLACEHOLDER_TAG,
|
||||||
|
{id: idStr, equiv: ph.name, disp: `{${ph.value.expression}, ${ph.value.type}, ${cases}}`})];
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize(nodes: i18n.Node[]): xml.Node[] {
|
serialize(nodes: i18n.Node[]): xml.Node[] {
|
||||||
|
|
|
@ -0,0 +1,416 @@
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
|
* found in the LICENSE file at https://angular.io/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {NgLocalization} from '@angular/common';
|
||||||
|
import {ResourceLoader} from '@angular/compiler';
|
||||||
|
import {MessageBundle} from '@angular/compiler/src/i18n/message_bundle';
|
||||||
|
import {Xliff2} from '@angular/compiler/src/i18n/serializers/xliff2';
|
||||||
|
import {HtmlParser} from '@angular/compiler/src/ml_parser/html_parser';
|
||||||
|
import {DEFAULT_INTERPOLATION_CONFIG} from '@angular/compiler/src/ml_parser/interpolation_config';
|
||||||
|
import {DebugElement, TRANSLATIONS, TRANSLATIONS_FORMAT} from '@angular/core';
|
||||||
|
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
|
||||||
|
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||||
|
|
||||||
|
import {SpyResourceLoader} from '../spies';
|
||||||
|
|
||||||
|
import {FrLocalization, HTML, I18nComponent, validateHtml} from './integration_common';
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
describe('i18n XLIFF 2.0 integration spec', () => {
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureCompiler({
|
||||||
|
providers: [
|
||||||
|
{provide: ResourceLoader, useClass: SpyResourceLoader},
|
||||||
|
{provide: NgLocalization, useClass: FrLocalization},
|
||||||
|
{provide: TRANSLATIONS, useValue: XLIFF2_TOMERGE},
|
||||||
|
{provide: TRANSLATIONS_FORMAT, useValue: 'xlf2'},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
TestBed.configureTestingModule({declarations: [I18nComponent]});
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should extract from templates', () => {
|
||||||
|
const catalog = new MessageBundle(new HtmlParser, [], {});
|
||||||
|
const serializer = new Xliff2();
|
||||||
|
catalog.updateFromTemplate(HTML, 'file.ts', DEFAULT_INTERPOLATION_CONFIG);
|
||||||
|
|
||||||
|
expect(catalog.write(serializer)).toContain(XLIFF2_EXTRACTED);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should translate templates', () => {
|
||||||
|
const tb: ComponentFixture<I18nComponent> =
|
||||||
|
TestBed.overrideTemplate(I18nComponent, HTML).createComponent(I18nComponent);
|
||||||
|
const cmp: I18nComponent = tb.componentInstance;
|
||||||
|
const el: DebugElement = tb.debugElement;
|
||||||
|
|
||||||
|
validateHtml(tb, cmp, el);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const XLIFF2_TOMERGE = `
|
||||||
|
<unit id="615790887472569365">
|
||||||
|
<segment>
|
||||||
|
<source>i18n attribute on tags</source>
|
||||||
|
<target>attributs i18n sur les balises</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="3707494640264351337">
|
||||||
|
<segment>
|
||||||
|
<source>nested</source>
|
||||||
|
<target>imbriqué</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5539162898278769904">
|
||||||
|
<segment>
|
||||||
|
<source>nested</source>
|
||||||
|
<target>imbriqué</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="3780349238193953556">
|
||||||
|
<segment>
|
||||||
|
<source><pc id="0" equivStart="START_ITALIC_TEXT" equivEnd="CLOSE_ITALIC_TEXT" type="fmt" dispStart="<i>" dispEnd="</i>">with placeholders</pc></source>
|
||||||
|
<target><pc id="0" equivStart="START_ITALIC_TEXT" equivEnd="CLOSE_ITALIC_TEXT" type="fmt" dispStart="<i>" dispEnd="</i>">avec des espaces réservés</pc></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5415448997399451992">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:11</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source><pc id="0" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>">with <pc id="1" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>">nested</pc> placeholders</pc></source>
|
||||||
|
<target><pc id="0" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>">avec <pc id="1" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>">espaces réservés</pc> imbriqués</pc></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5525133077318024839">
|
||||||
|
<segment>
|
||||||
|
<source>on not translatable node</source>
|
||||||
|
<target>sur des balises non traductibles</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="8670732454866344690">
|
||||||
|
<segment>
|
||||||
|
<source>on translatable node</source>
|
||||||
|
<target>sur des balises traductibles</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4593805537723189714">
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">many</pc>} }</source>
|
||||||
|
<target>{VAR_PLURAL, plural, =0 {zero} =1 {un} =2 {deux} other {<pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">beaucoup</pc>} }</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4360321700965841752">
|
||||||
|
<segment>
|
||||||
|
<source>
|
||||||
|
<ph id="0" equiv="ICU" disp="{sex, select, 0 {...} m {...} f {...}}"/>
|
||||||
|
</source>
|
||||||
|
<target><ph id="0" equiv="ICU" disp="{sex, select, 0 {...} m {...} f {...}}"/></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5460933846928880074">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:23</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_SELECT, select, 0 {other} m {male} f {female} }</source>
|
||||||
|
<target>{VAR_SELECT, select, 0 {autre} m {homme} f {femme} }</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="1746565782635215">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:25,27</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>
|
||||||
|
<ph id="0" equiv="ICU" disp="{sexB, select, m {...} f {...}}"/>
|
||||||
|
</source>
|
||||||
|
<target><ph id="0" equiv="ICU" disp="{sexB, select, m {...} f {...}}"/></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5868084092545682515">
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_SELECT, select, m {male} f {female} }</source>
|
||||||
|
<target>{VAR_SELECT, select, m {homme} f {femme} }</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4851788426695310455">
|
||||||
|
<segment>
|
||||||
|
<source><ph id="0" equiv="INTERPOLATION" disp="{{ "count = " + count }}"/></source>
|
||||||
|
<target><ph id="0" equiv="INTERPOLATION" disp="{{ "count = " + count }}"/></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="9013357158046221374">
|
||||||
|
<segment>
|
||||||
|
<source>sex = <ph id="0" equiv="INTERPOLATION" disp="{{ sex }}"/></source>
|
||||||
|
<target>sexe = <ph id="0" equiv="INTERPOLATION" disp="{{ sex }}"/></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="8324617391167353662">
|
||||||
|
<segment>
|
||||||
|
<source><ph id="0" equiv="CUSTOM_NAME" disp="{{ "custom name" //i18n(ph="CUSTOM_NAME") }}"/></source>
|
||||||
|
<target><ph id="0" equiv="CUSTOM_NAME" disp="{{ "custom name" //i18n(ph="CUSTOM_NAME") }}"/></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="7685649297917455806">
|
||||||
|
<segment>
|
||||||
|
<source>in a translatable section</source>
|
||||||
|
<target>dans une section traductible</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="2387287228265107305">
|
||||||
|
<segment>
|
||||||
|
<source>
|
||||||
|
<pc id="0" equivStart="START_HEADING_LEVEL1" equivEnd="CLOSE_HEADING_LEVEL1" type="other" dispStart="<h1>" dispEnd="</h1>">Markers in html comments</pc>
|
||||||
|
<pc id="1" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>"></pc>
|
||||||
|
<pc id="2" equivStart="START_TAG_DIV_1" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>"><ph id="3" equiv="ICU" disp="{count, plural, =0 {...} =1 {...} =2 {...} other {...}}"/></pc>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<pc id="0" equivStart="START_HEADING_LEVEL1" equivEnd="CLOSE_HEADING_LEVEL1" type="other" dispStart="<h1>" dispEnd="</h1>">Balises dans les commentaires html</pc>
|
||||||
|
<pc id="1" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>"></pc>
|
||||||
|
<pc id="2" equivStart="START_TAG_DIV_1" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>"><ph id="3" equiv="ICU" disp="{count, plural, =0 {...} =1 {...} =2 {...} other {...}}"/></pc>
|
||||||
|
</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="1491627405349178954">
|
||||||
|
<segment>
|
||||||
|
<source>it <pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">should</pc> work</source>
|
||||||
|
<target>ca <pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">devrait</pc> marcher</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="i18n16">
|
||||||
|
<segment>
|
||||||
|
<source>with an explicit ID</source>
|
||||||
|
<target>avec un ID explicite</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="i18n17">
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">many</pc>} }</source>
|
||||||
|
<target>{VAR_PLURAL, plural, =0 {zero} =1 {un} =2 {deux} other {<pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">beaucoup</pc>} }</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4085484936881858615">
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {Found no results} =1 {Found one result} other {Found <ph id="0" equiv="INTERPOLATION" disp="{{response.getItemsList().length}}"/> results} }</source>
|
||||||
|
<target>{VAR_PLURAL, plural, =0 {Pas de réponse} =1 {une réponse} other {Trouvé <ph id="0" equiv="INTERPOLATION" disp="{{response.getItemsList().length}}"/> réponses} }</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4035252431381981115">
|
||||||
|
<segment>
|
||||||
|
<source>foo<pc id="0" equivStart="START_LINK" equivEnd="CLOSE_LINK" type="link" dispStart="<a>" dispEnd="</a>">bar</pc></source>
|
||||||
|
<target>FOO<pc id="0" equivStart="START_LINK" equivEnd="CLOSE_LINK" type="link" dispStart="<a>" dispEnd="</a>">BAR</pc></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5339604010413301604">
|
||||||
|
<segment>
|
||||||
|
<source><ph id="0" equiv="MAP NAME" disp="{{ 'test' //i18n(ph="map name") }}"/></source>
|
||||||
|
<target><ph id="0" equiv="MAP NAME" disp="{{ 'test' //i18n(ph="map name") }}"/></target>
|
||||||
|
</segment>
|
||||||
|
</unit>`;
|
||||||
|
|
||||||
|
const XLIFF2_EXTRACTED = `
|
||||||
|
<unit id="615790887472569365">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:3</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>i18n attribute on tags</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="3707494640264351337">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:5</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>nested</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5539162898278769904">
|
||||||
|
<notes>
|
||||||
|
<note category="meaning">different meaning</note>
|
||||||
|
<note category="location">file.ts:7</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>nested</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="3780349238193953556">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:9</note>
|
||||||
|
<note category="location">file.ts:10</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source><pc id="0" equivStart="START_ITALIC_TEXT" equivEnd="CLOSE_ITALIC_TEXT" type="fmt" dispStart="<i>" dispEnd="</i>">with placeholders</pc></source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5415448997399451992">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:11</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source><pc id="0" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>">with <pc id="1" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>">nested</pc> placeholders</pc></source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5525133077318024839">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:14</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>on not translatable node</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="8670732454866344690">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:15</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>on translatable node</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4593805537723189714">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:20</note>
|
||||||
|
<note category="location">file.ts:37</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">many</pc>} }</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4360321700965841752">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:22,24</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>
|
||||||
|
<ph id="0" equiv="ICU" disp="{sex, select, 0 {...} m {...} f {...}}"/>
|
||||||
|
</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5460933846928880074">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:23</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_SELECT, select, 0 {other} m {male} f {female} }</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="1746565782635215">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:25,27</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>
|
||||||
|
<ph id="0" equiv="ICU" disp="{sexB, select, m {...} f {...}}"/>
|
||||||
|
</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5868084092545682515">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:26</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_SELECT, select, m {male} f {female} }</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4851788426695310455">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:29</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source><ph id="0" equiv="INTERPOLATION" disp="{{ "count = " + count }}"/></source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="9013357158046221374">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:30</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>sex = <ph id="0" equiv="INTERPOLATION" disp="{{ sex }}"/></source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="8324617391167353662">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:31</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source><ph id="0" equiv="CUSTOM_NAME" disp="{{ "custom name" //i18n(ph="CUSTOM_NAME") }}"/></source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="7685649297917455806">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:36</note>
|
||||||
|
<note category="location">file.ts:54</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>in a translatable section</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="2387287228265107305">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:34,38</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>
|
||||||
|
<pc id="0" equivStart="START_HEADING_LEVEL1" equivEnd="CLOSE_HEADING_LEVEL1" type="other" dispStart="<h1>" dispEnd="</h1>">Markers in html comments</pc>
|
||||||
|
<pc id="1" equivStart="START_TAG_DIV" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>"></pc>
|
||||||
|
<pc id="2" equivStart="START_TAG_DIV_1" equivEnd="CLOSE_TAG_DIV" type="other" dispStart="<div>" dispEnd="</div>"><ph id="3" equiv="ICU" disp="{count, plural, =0 {...} =1 {...} =2 {...} other {...}}"/></pc>
|
||||||
|
</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="1491627405349178954">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:40</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>it <pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">should</pc> work</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="i18n16">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:42</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>with an explicit ID</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="i18n17">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:43</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<pc id="0" equivStart="START_BOLD_TEXT" equivEnd="CLOSE_BOLD_TEXT" type="fmt" dispStart="<b>" dispEnd="</b>">many</pc>} }</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4085484936881858615">
|
||||||
|
<notes>
|
||||||
|
<note category="description">desc</note>
|
||||||
|
<note category="location">file.ts:46,52</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {Found no results} =1 {Found one result} other {Found <ph id="0" equiv="INTERPOLATION" disp="{{response.getItemsList().length}}"/> results} }</source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="4035252431381981115">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:54</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>foo<pc id="0" equivStart="START_LINK" equivEnd="CLOSE_LINK" type="link" dispStart="<a>" dispEnd="</a>">bar</pc></source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5339604010413301604">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:56</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source><ph id="0" equiv="MAP NAME" disp="{{ 'test' //i18n(ph="map name") }}"/></source>
|
||||||
|
</segment>
|
||||||
|
</unit>`;
|
|
@ -23,7 +23,7 @@ const HTML = `
|
||||||
<p i18n="ph names"><br><img src="1.jpg"><img src="2.jpg"></p>
|
<p i18n="ph names"><br><img src="1.jpg"><img src="2.jpg"></p>
|
||||||
<p i18n="empty element">hello <span></span></p>
|
<p i18n="empty element">hello <span></span></p>
|
||||||
<p i18n="@@baz">{ count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} }}</p>
|
<p i18n="@@baz">{ count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} }}</p>
|
||||||
<p i18n>{ count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} }}</p>
|
<p i18n>Test: { count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} } =other {a lot}}</p>
|
||||||
<p i18n>multi
|
<p i18n>multi
|
||||||
lines</p>
|
lines</p>
|
||||||
`;
|
`;
|
||||||
|
@ -100,12 +100,20 @@ const WRITE_XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">deeply nested</pc>} } } }</source>
|
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">deeply nested</pc>} } } }</source>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="2015957479576096115">
|
<unit id="6997386649824869937">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="location">file.ts:10</note>
|
<note category="location">file.ts:10</note>
|
||||||
</notes>
|
</notes>
|
||||||
<segment>
|
<segment>
|
||||||
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">deeply nested</pc>} } } }</source>
|
<source>Test: <ph id="0" equiv="ICU" disp="{ count, plural, =0 {...} =other {...}}"/></source>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5229984852258993423">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:10</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">deeply nested</pc>} } } =other {a lot} }</source>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="2340165783990709777">
|
<unit id="2340165783990709777">
|
||||||
|
@ -201,13 +209,22 @@ const LOAD_XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<target>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">profondément imbriqué</pc>} } } }</target>
|
<target>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">profondément imbriqué</pc>} } } }</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="2015957479576096115">
|
<unit id="6997386649824869937">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="location">file.ts:10</note>
|
<note category="location">file.ts:10</note>
|
||||||
</notes>
|
</notes>
|
||||||
<segment>
|
<segment>
|
||||||
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">deeply nested</pc>} } } }</source>
|
<source>Test: <ph id="0" equiv="ICU" disp="{ count, plural, =0 {...} =other {...}}"/></source>
|
||||||
<target>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">profondément imbriqué</pc>} } } }</target>
|
<target>Test: <ph id="0" equiv="ICU" disp="{ count, plural, =0 {...} =other {...}}"/></target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="5229984852258993423">
|
||||||
|
<notes>
|
||||||
|
<note category="location">file.ts:10</note>
|
||||||
|
</notes>
|
||||||
|
<segment>
|
||||||
|
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">deeply nested</pc>} } } =other {a lot} }</source>
|
||||||
|
<target>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<pc id="0" equivStart="START_PARAGRAPH" equivEnd="CLOSE_PARAGRAPH" type="other" dispStart="<p>" dispEnd="</p>">profondément imbriqué</pc>} } } =other {beaucoup} }</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="2340165783990709777">
|
<unit id="2340165783990709777">
|
||||||
|
@ -268,8 +285,9 @@ export function main(): void {
|
||||||
'6536355551500405293': '<ph name="START_TAG_SPAN"/><ph name="CLOSE_TAG_SPAN"/> olleh',
|
'6536355551500405293': '<ph name="START_TAG_SPAN"/><ph name="CLOSE_TAG_SPAN"/> olleh',
|
||||||
'baz':
|
'baz':
|
||||||
'{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[<ph name="START_PARAGRAPH"/>, profondément imbriqué, <ph name="CLOSE_PARAGRAPH"/>]}}, ]}}',
|
'{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[<ph name="START_PARAGRAPH"/>, profondément imbriqué, <ph name="CLOSE_PARAGRAPH"/>]}}, ]}}',
|
||||||
'2015957479576096115': '{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[<ph' +
|
'6997386649824869937': 'Test: <ph name="ICU"/>',
|
||||||
' name="START_PARAGRAPH"/>, profondément imbriqué, <ph name="CLOSE_PARAGRAPH"/>]}}, ]}}',
|
'5229984852258993423': '{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[<ph' +
|
||||||
|
' name="START_PARAGRAPH"/>, profondément imbriqué, <ph name="CLOSE_PARAGRAPH"/>]}}, ]}, =other {[beaucoup]}}',
|
||||||
'2340165783990709777': `multi
|
'2340165783990709777': `multi
|
||||||
lignes`
|
lignes`
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue