Skip to content

Commit b3085e9

Browse files
ocombemhevery
authored andcommitted
feat(compiler): add representation of placeholders to xliff & xmb
Closes #17345
1 parent 4cea2bd commit b3085e9

File tree

7 files changed

+138
-93
lines changed

7 files changed

+138
-93
lines changed

packages/compiler/src/i18n/serializers/xliff.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,28 @@ class _WriteVisitor implements i18n.Visitor {
139139
visitTagPlaceholder(ph: i18n.TagPlaceholder, context?: any): xml.Node[] {
140140
const ctype = getCtypeForTag(ph.tag);
141141

142-
const startTagPh = new xml.Tag(_PLACEHOLDER_TAG, {id: ph.startName, ctype});
143142
if (ph.isVoid) {
144143
// void tags have no children nor closing tags
145-
return [startTagPh];
144+
return [new xml.Tag(
145+
_PLACEHOLDER_TAG, {id: ph.startName, ctype, 'equiv-text': `<${ph.tag}/>`})];
146146
}
147147

148-
const closeTagPh = new xml.Tag(_PLACEHOLDER_TAG, {id: ph.closeName, ctype});
148+
const startTagPh =
149+
new xml.Tag(_PLACEHOLDER_TAG, {id: ph.startName, ctype, 'equiv-text': `<${ph.tag}>`});
150+
const closeTagPh =
151+
new xml.Tag(_PLACEHOLDER_TAG, {id: ph.closeName, ctype, 'equiv-text': `</${ph.tag}>`});
149152

150153
return [startTagPh, ...this.serialize(ph.children), closeTagPh];
151154
}
152155

153156
visitPlaceholder(ph: i18n.Placeholder, context?: any): xml.Node[] {
154-
return [new xml.Tag(_PLACEHOLDER_TAG, {id: ph.name})];
157+
return [new xml.Tag(_PLACEHOLDER_TAG, {id: ph.name, 'equiv-text': `{{${ph.value}}}`})];
155158
}
156159

157160
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): xml.Node[] {
158-
return [new xml.Tag(_PLACEHOLDER_TAG, {id: ph.name})];
161+
const equivText =
162+
`{${ph.value.expression}, ${ph.value.type}, ${Object.keys(ph.value.cases).map((value: string) => value + ' {...}').join(' ')}}`;
163+
return [new xml.Tag(_PLACEHOLDER_TAG, {id: ph.name, 'equiv-text': equivText})];
159164
}
160165

161166
serialize(nodes: i18n.Node[]): xml.Node[] {

packages/compiler/src/i18n/serializers/xmb.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,16 @@ class _Visitor implements i18n.Visitor {
129129
}
130130

131131
visitPlaceholder(ph: i18n.Placeholder, context?: any): xml.Node[] {
132-
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name})];
132+
const exTag = new xml.Tag(_EXEMPLE_TAG, {}, [new xml.Text(`{{${ph.value}}}`)]);
133+
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name}, [exTag])];
133134
}
134135

135136
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): xml.Node[] {
136-
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name})];
137+
const exTag = new xml.Tag(_EXEMPLE_TAG, {}, [
138+
new xml.Text(
139+
`{${ph.value.expression}, ${ph.value.type}, ${Object.keys(ph.value.cases).map((value: string) => value + ' {...}').join(' ')}}`)
140+
]);
141+
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name}, [exTag])];
137142
}
138143

139144
serialize(nodes: i18n.Node[]): xml.Node[] {

packages/compiler/test/i18n/integration_common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export const HTML = `
113113
114114
<div id="i18n-3"><p i18n><i>with placeholders</i></p></div>
115115
<div id="i18n-3b"><p i18n><i class="preserved-on-placeholders">with placeholders</i></p></div>
116+
<div id="i18n-3c"><div i18n><div>with <div>nested</div> placeholders</div></div></div>
116117
117118
<div>
118119
<p id="i18n-4" i18n-title title="on not translatable node"></p>

packages/compiler/test/i18n/integration_xliff_spec.ts

Lines changed: 65 additions & 50 deletions
Large diffs are not rendered by default.

packages/compiler/test/i18n/integration_xmb_xtb_spec.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const XTB = `
6161
<translation id="3707494640264351337">imbriqué</translation>
6262
<translation id="5539162898278769904">imbriqué</translation>
6363
<translation id="3780349238193953556"><ph name="START_ITALIC_TEXT"/>avec des espaces réservés<ph name="CLOSE_ITALIC_TEXT"/></translation>
64+
<translation id="5415448997399451992"><ph name="START_TAG_DIV"><ex>&lt;div&gt;</ex></ph>avec <ph name="START_TAG_DIV"><ex>&lt;div&gt;</ex></ph>des espaces réservés<ph name="CLOSE_TAG_DIV"><ex>&lt;/div&gt;</ex></ph> imbriqués<ph name="CLOSE_TAG_DIV"><ex>&lt;/div&gt;</ex></ph></translation>
6465
<translation id="5525133077318024839">sur des balises non traductibles</translation>
6566
<translation id="8670732454866344690">sur des balises traductibles</translation>
6667
<translation id="4593805537723189714">{VAR_PLURAL, plural, =0 {zero} =1 {un} =2 {deux} other {<ph name="START_BOLD_TEXT"/>beaucoup<ph name="CLOSE_BOLD_TEXT"/>}}</translation>
@@ -90,29 +91,30 @@ const XMB = `<msg id="615790887472569365"><source>file.ts:3</source>i18n attribu
9091
<msg id="3707494640264351337"><source>file.ts:5</source>nested</msg>
9192
<msg id="5539162898278769904" meaning="different meaning"><source>file.ts:7</source>nested</msg>
9293
<msg id="3780349238193953556"><source>file.ts:9</source><source>file.ts:10</source><ph name="START_ITALIC_TEXT"><ex>&lt;i&gt;</ex></ph>with placeholders<ph name="CLOSE_ITALIC_TEXT"><ex>&lt;/i&gt;</ex></ph></msg>
93-
<msg id="5525133077318024839"><source>file.ts:13</source>on not translatable node</msg>
94-
<msg id="8670732454866344690"><source>file.ts:14</source>on translatable node</msg>
95-
<msg id="4593805537723189714"><source>file.ts:19</source><source>file.ts:36</source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>many<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph>} }</msg>
96-
<msg id="4360321700965841752"><source>file.ts:21,23</source>
97-
<ph name="ICU"><ex>ICU</ex></ph>
94+
<msg id="5415448997399451992"><source>file.ts:11</source><ph name="START_TAG_DIV"><ex>&lt;div&gt;</ex></ph>with <ph name="START_TAG_DIV"><ex>&lt;div&gt;</ex></ph>nested<ph name="CLOSE_TAG_DIV"><ex>&lt;/div&gt;</ex></ph> placeholders<ph name="CLOSE_TAG_DIV"><ex>&lt;/div&gt;</ex></ph></msg>
95+
<msg id="5525133077318024839"><source>file.ts:14</source>on not translatable node</msg>
96+
<msg id="8670732454866344690"><source>file.ts:15</source>on translatable node</msg>
97+
<msg id="4593805537723189714"><source>file.ts:20</source><source>file.ts:37</source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>many<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph>} }</msg>
98+
<msg id="4360321700965841752"><source>file.ts:22,24</source>
99+
<ph name="ICU"><ex>{sex, select, 0 {...} m {...} f {...}}</ex></ph>
98100
</msg>
99-
<msg id="5460933846928880074"><source>file.ts:22</source>{VAR_SELECT, select, 0 {other} m {male} f {female} }</msg>
100-
<msg id="1746565782635215"><source>file.ts:24,26</source>
101-
<ph name="ICU"><ex>ICU</ex></ph>
101+
<msg id="5460933846928880074"><source>file.ts:23</source>{VAR_SELECT, select, 0 {other} m {male} f {female} }</msg>
102+
<msg id="1746565782635215"><source>file.ts:25,27</source>
103+
<ph name="ICU"><ex>{sexB, select, m {...} f {...}}</ex></ph>
102104
</msg>
103-
<msg id="5868084092545682515"><source>file.ts:25</source>{VAR_SELECT, select, m {male} f {female} }</msg>
104-
<msg id="4851788426695310455"><source>file.ts:28</source><ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph></msg>
105-
<msg id="9013357158046221374"><source>file.ts:29</source>sex = <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph></msg>
106-
<msg id="8324617391167353662"><source>file.ts:30</source><ph name="CUSTOM_NAME"><ex>CUSTOM_NAME</ex></ph></msg>
107-
<msg id="7685649297917455806"><source>file.ts:35</source><source>file.ts:53</source>in a translatable section</msg>
108-
<msg id="2387287228265107305"><source>file.ts:33,37</source>
105+
<msg id="5868084092545682515"><source>file.ts:26</source>{VAR_SELECT, select, m {male} f {female} }</msg>
106+
<msg id="4851788426695310455"><source>file.ts:29</source><ph name="INTERPOLATION"><ex>{{ &quot;count = &quot; + count }}</ex></ph></msg>
107+
<msg id="9013357158046221374"><source>file.ts:30</source>sex = <ph name="INTERPOLATION"><ex>{{ sex }}</ex></ph></msg>
108+
<msg id="8324617391167353662"><source>file.ts:31</source><ph name="CUSTOM_NAME"><ex>{{ &quot;custom name&quot; //i18n(ph=&quot;CUSTOM_NAME&quot;) }}</ex></ph></msg>
109+
<msg id="7685649297917455806"><source>file.ts:36</source><source>file.ts:54</source>in a translatable section</msg>
110+
<msg id="2387287228265107305"><source>file.ts:34,38</source>
109111
<ph name="START_HEADING_LEVEL1"><ex>&lt;h1&gt;</ex></ph>Markers in html comments<ph name="CLOSE_HEADING_LEVEL1"><ex>&lt;/h1&gt;</ex></ph>
110112
<ph name="START_TAG_DIV"><ex>&lt;div&gt;</ex></ph><ph name="CLOSE_TAG_DIV"><ex>&lt;/div&gt;</ex></ph>
111-
<ph name="START_TAG_DIV_1"><ex>&lt;div&gt;</ex></ph><ph name="ICU"><ex>ICU</ex></ph><ph name="CLOSE_TAG_DIV"><ex>&lt;/div&gt;</ex></ph>
113+
<ph name="START_TAG_DIV_1"><ex>&lt;div&gt;</ex></ph><ph name="ICU"><ex>{count, plural, =0 {...} =1 {...} =2 {...} other {...}}</ex></ph><ph name="CLOSE_TAG_DIV"><ex>&lt;/div&gt;</ex></ph>
112114
</msg>
113-
<msg id="1491627405349178954"><source>file.ts:39</source>it <ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>should<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph> work</msg>
114-
<msg id="i18n16"><source>file.ts:41</source>with an explicit ID</msg>
115-
<msg id="i18n17"><source>file.ts:42</source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>many<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph>} }</msg>
116-
<msg id="4085484936881858615" desc="desc"><source>file.ts:45,51</source>{VAR_PLURAL, plural, =0 {Found no results} =1 {Found one result} other {Found <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph> results} }</msg>
117-
<msg id="4035252431381981115"><source>file.ts:53</source>foo<ph name="START_LINK"><ex>&lt;a&gt;</ex></ph>bar<ph name="CLOSE_LINK"><ex>&lt;/a&gt;</ex></ph></msg>
118-
<msg id="5339604010413301604"><source>file.ts:55</source><ph name="MAP_NAME"><ex>MAP_NAME</ex></ph></msg>`;
115+
<msg id="1491627405349178954"><source>file.ts:40</source>it <ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>should<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph> work</msg>
116+
<msg id="i18n16"><source>file.ts:42</source>with an explicit ID</msg>
117+
<msg id="i18n17"><source>file.ts:43</source>{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>many<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph>} }</msg>
118+
<msg id="4085484936881858615" desc="desc"><source>file.ts:46,52</source>{VAR_PLURAL, plural, =0 {Found no results} =1 {Found one result} other {Found <ph name="INTERPOLATION"><ex>{{response.getItemsList().length}}</ex></ph> results} }</msg>
119+
<msg id="4035252431381981115"><source>file.ts:54</source>foo<ph name="START_LINK"><ex>&lt;a&gt;</ex></ph>bar<ph name="CLOSE_LINK"><ex>&lt;/a&gt;</ex></ph></msg>
120+
<msg id="5339604010413301604"><source>file.ts:56</source><ph name="MAP_NAME"><ex>{{ &apos;test&apos; //i18n(ph=&quot;map name&quot;) }}</ex></ph></msg>`;

packages/compiler/test/i18n/serializers/xliff_spec.ts

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const HTML = `
2424
<p i18n="@@bar">foo</p>
2525
<p i18n="ph names"><br><img><div></div></p>
2626
<p i18n="@@baz">{ count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} }}</p>
27-
<p i18n>{ count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} }}</p>
27+
<p i18n>Test: { count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} } =other {a lot}}</p>
2828
<p i18n>multi
2929
lines</p>
3030
`;
@@ -41,14 +41,14 @@ const WRITE_XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
4141
</context-group>
4242
</trans-unit>
4343
<trans-unit id="ec1d033f2436133c14ab038286c4f5df4697484a" datatype="html">
44-
<source>translatable element <x id="START_BOLD_TEXT" ctype="x-b"/>with placeholders<x id="CLOSE_BOLD_TEXT" ctype="x-b"/> <x id="INTERPOLATION"/></source>
44+
<source>translatable element <x id="START_BOLD_TEXT" ctype="x-b" equiv-text="&lt;b&gt;"/>with placeholders<x id="CLOSE_BOLD_TEXT" ctype="x-b" equiv-text="&lt;/b&gt;"/> <x id="INTERPOLATION" equiv-text="{{ interpolation}}"/></source>
4545
<context-group purpose="location">
4646
<context context-type="sourcefile">file.ts</context>
4747
<context context-type="linenumber">3</context>
4848
</context-group>
4949
</trans-unit>
5050
<trans-unit id="e2ccf3d131b15f54aa1fcf1314b1ca77c14bfcc2" datatype="html">
51-
<source>{VAR_PLURAL, plural, =0 {<x id="START_PARAGRAPH" ctype="x-p"/>test<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} }</source>
51+
<source>{VAR_PLURAL, plural, =0 {<x id="START_PARAGRAPH" ctype="x-p" equiv-text="&lt;p&gt;"/>test<x id="CLOSE_PARAGRAPH" ctype="x-p" equiv-text="&lt;/p&gt;"/>} }</source>
5252
<context-group purpose="location">
5353
<context context-type="sourcefile">file.ts</context>
5454
<context context-type="linenumber">4</context>
@@ -84,22 +84,29 @@ const WRITE_XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
8484
</context-group>
8585
</trans-unit>
8686
<trans-unit id="d7fa2d59aaedcaa5309f13028c59af8c85b8c49d" datatype="html">
87-
<source><x id="LINE_BREAK" ctype="lb"/><x id="TAG_IMG" ctype="image"/><x id="START_TAG_DIV" ctype="x-div"/><x id="CLOSE_TAG_DIV" ctype="x-div"/></source>
87+
<source><x id="LINE_BREAK" ctype="lb" equiv-text="&lt;br/&gt;"/><x id="TAG_IMG" ctype="image" equiv-text="&lt;img/&gt;"/><x id="START_TAG_DIV" ctype="x-div" equiv-text="&lt;div&gt;"/><x id="CLOSE_TAG_DIV" ctype="x-div" equiv-text="&lt;/div&gt;"/></source>
8888
<context-group purpose="location">
8989
<context context-type="sourcefile">file.ts</context>
9090
<context context-type="linenumber">9</context>
9191
</context-group>
9292
<note priority="1" from="description">ph names</note>
9393
</trans-unit>
9494
<trans-unit id="baz" datatype="html">
95-
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>deeply nested<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } }</source>
95+
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p" equiv-text="&lt;p&gt;"/>deeply nested<x id="CLOSE_PARAGRAPH" ctype="x-p" equiv-text="&lt;/p&gt;"/>} } } }</source>
9696
<context-group purpose="location">
9797
<context context-type="sourcefile">file.ts</context>
9898
<context context-type="linenumber">10</context>
9999
</context-group>
100100
</trans-unit>
101-
<trans-unit id="0e16a673a5a7a135c9f7b957ec2c5c6f6ee6e2c4" datatype="html">
102-
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>deeply nested<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } }</source>
101+
<trans-unit id="52ffa620dcd76247a56d5331f34e73f340a43cdb" datatype="html">
102+
<source>Test: <x id="ICU" equiv-text="{ count, plural, =0 {...} =other {...}}"/></source>
103+
<context-group purpose="location">
104+
<context context-type="sourcefile">file.ts</context>
105+
<context context-type="linenumber">11</context>
106+
</context-group>
107+
</trans-unit>
108+
<trans-unit id="1503afd0ccc20ff01d5e2266a9157b7b342ba494" datatype="html">
109+
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p" equiv-text="&lt;p&gt;"/>deeply nested<x id="CLOSE_PARAGRAPH" ctype="x-p" equiv-text="&lt;/p&gt;"/>} } } =other {a lot} }</source>
103110
<context-group purpose="location">
104111
<context context-type="sourcefile">file.ts</context>
105112
<context context-type="linenumber">11</context>
@@ -192,9 +199,17 @@ const LOAD_XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
192199
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>deeply nested<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } }</source>
193200
<target>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>profondément imbriqué<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } }</target>
194201
</trans-unit>
195-
<trans-unit id="0e16a673a5a7a135c9f7b957ec2c5c6f6ee6e2c4" datatype="html">
196-
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>deeply nested<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } }</source>
197-
<target>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>profondément imbriqué<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } }</target>
202+
<trans-unit id="52ffa620dcd76247a56d5331f34e73f340a43cdb" datatype="html">
203+
<source>Test: <x id="ICU" equiv-text="{ count, plural, =0 {...} =other {...}}"/></source>
204+
<target>Test: <x id="ICU" equiv-text="{ count, plural, =0 {...} =other {...}}"/></target>
205+
<context-group purpose="location">
206+
<context context-type="sourcefile">file.ts</context>
207+
<context context-type="linenumber">11</context>
208+
</context-group>
209+
</trans-unit>
210+
<trans-unit id="1503afd0ccc20ff01d5e2266a9157b7b342ba494" datatype="html">
211+
<source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>deeply nested<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } =other {a lot} }</source>
212+
<target>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<x id="START_PARAGRAPH" ctype="x-p"/>profondément imbriqué<x id="CLOSE_PARAGRAPH" ctype="x-p"/>} } } =other {beaucoup} }</target>
198213
</trans-unit>
199214
<trans-unit id="fcfa109b0e152d4c217dbc02530be0bcb8123ad1" datatype="html">
200215
<source>multi
@@ -253,9 +268,10 @@ export function main(): void {
253268
'empty target': '',
254269
'baz':
255270
'{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[<ph name="START_PARAGRAPH"/>, profondément imbriqué, <ph name="CLOSE_PARAGRAPH"/>]}}, ]}}',
256-
'0e16a673a5a7a135c9f7b957ec2c5c6f6ee6e2c4':
271+
'52ffa620dcd76247a56d5331f34e73f340a43cdb': 'Test: <ph name="ICU"/>',
272+
'1503afd0ccc20ff01d5e2266a9157b7b342ba494':
257273
'{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[<ph' +
258-
' name="START_PARAGRAPH"/>, profondément imbriqué, <ph name="CLOSE_PARAGRAPH"/>]}}, ]}}',
274+
' name="START_PARAGRAPH"/>, profondément imbriqué, <ph name="CLOSE_PARAGRAPH"/>]}}, ]}, =other {[beaucoup]}}',
259275
'fcfa109b0e152d4c217dbc02530be0bcb8123ad1': `multi
260276
lignes`
261277
});

packages/compiler/test/i18n/serializers/xmb_spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function main(): void {
2121
<p i18n="m|d@@i">foo</p>
2222
<p i18n="@@bar">foo</p>
2323
<p i18n="@@baz">{ count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} }}</p>
24-
<p i18n>{ count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} }}</p>
24+
<p i18n>Test: { count, plural, =0 { { sex, select, other {<p>deeply nested</p>}} } =other {a lot}}</p>
2525
<p i18n>multi
2626
lines</p>`;
2727

@@ -48,13 +48,14 @@ lines</p>`;
4848
<!ELEMENT ex (#PCDATA)>
4949
]>
5050
<messagebundle>
51-
<msg id="7056919470098446707"><source>file.ts:3</source>translatable element <ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>with placeholders<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph> <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph></msg>
51+
<msg id="7056919470098446707"><source>file.ts:3</source>translatable element <ph name="START_BOLD_TEXT"><ex>&lt;b&gt;</ex></ph>with placeholders<ph name="CLOSE_BOLD_TEXT"><ex>&lt;/b&gt;</ex></ph> <ph name="INTERPOLATION"><ex>{{ interpolation}}</ex></ph></msg>
5252
<msg id="2981514368455622387"><source>file.ts:4</source>{VAR_PLURAL, plural, =0 {<ph name="START_PARAGRAPH"><ex>&lt;p&gt;</ex></ph>test<ph name="CLOSE_PARAGRAPH"><ex>&lt;/p&gt;</ex></ph>} }</msg>
5353
<msg id="7999024498831672133" desc="d" meaning="m"><source>file.ts:5</source>foo</msg>
5454
<msg id="i" desc="d" meaning="m"><source>file.ts:6</source>foo</msg>
5555
<msg id="bar"><source>file.ts:7</source>foo</msg>
5656
<msg id="baz"><source>file.ts:8</source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<ph name="START_PARAGRAPH"><ex>&lt;p&gt;</ex></ph>deeply nested<ph name="CLOSE_PARAGRAPH"><ex>&lt;/p&gt;</ex></ph>} } } }</msg>
57-
<msg id="2015957479576096115"><source>file.ts:9</source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<ph name="START_PARAGRAPH"><ex>&lt;p&gt;</ex></ph>deeply nested<ph name="CLOSE_PARAGRAPH"><ex>&lt;/p&gt;</ex></ph>} } } }</msg>
57+
<msg id="6997386649824869937"><source>file.ts:9</source>Test: <ph name="ICU"><ex>{ count, plural, =0 {...} =other {...}}</ex></ph></msg>
58+
<msg id="5229984852258993423"><source>file.ts:9</source>{VAR_PLURAL, plural, =0 {{VAR_SELECT, select, other {<ph name="START_PARAGRAPH"><ex>&lt;p&gt;</ex></ph>deeply nested<ph name="CLOSE_PARAGRAPH"><ex>&lt;/p&gt;</ex></ph>} } } =other {a lot} }</msg>
5859
<msg id="2340165783990709777"><source>file.ts:10,11</source>multi
5960
lines</msg>
6061
</messagebundle>

0 commit comments

Comments
 (0)