i18n select-ICU generates two units in xlf
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
ng xi18n
creates two units for select-icu expression. Given html template:
<span i18n="@@testLabel">
{variable, select, aLabel {Label for A}}
</span>
ng xi18n --i18n-format=xlf
creates:
<trans-unit id="testLabel" datatype="html">
<source>
<x id="ICU" equiv-text="{variable, select, aLabel {...}}"/>
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/shared/statistics/statistics.component.html</context>
<context context-type="linenumber">23</context>
</context-group>
</trans-unit>
<trans-unit id="b4645e675b21d80d80ff7669e6c6ac8a84bab9cd" datatype="html">
<source>{VAR_SELECT, select, aLabel {Label for A} }</source>
<context-group purpose="location">
<context context-type="sourcefile">app/shared/statistics/statistics.component.html</context>
<context context-type="linenumber">24</context>
</context-group>
</trans-unit>
also
ng xi18n --i18n-format=xlf2
creates:
<unit id="testLabel">
<notes>
<note category="location">app/shared/statistics/statistics.component.html:23,25</note>
</notes>
<segment>
<source>
<ph id="0" equiv="ICU" disp="{variable, select, aLabel {...}}"/>
</source>
</segment>
</unit>
<unit id="5433920347450028630">
<notes>
<note category="location">app/shared/statistics/statistics.component.html:24</note>
</notes>
<segment>
<source>{VAR_SELECT, select, aLabel {Label for A} }</source>
</segment>
</unit>
First unit has correct id but sourse doesnt contain test to translate and (i think) is useless. Second unit has correct text, but id is generated.
Expected behavior
ng xi18n
would create only one unit with correct id and source containing text to translate. like:
<unit id="testLabel">
<notes>
<note category="location">app/shared/statistics/statistics.component.html:24</note>
</notes>
<segment>
<source>{VAR_SELECT, select, aLabel {Label for A} }</source>
</segment>
</unit>
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
First unit doesn’t contain text to translate, therefore it leads to confusion for translator.
Environment
ng -v
Angular CLI: 6.1.5
Node: 10.5.0
OS: win32 x64
Angular: 6.1.6
Angular version: 6.1.6
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Work with translation files - Angular
The extract-i18n command creates a source language file named messages.xlf in the root directory of your project. For more information about the XML ......
Read more >localization - Angular (8/9) i18n expecting to see a translation ...
Several months ago I had a select ICU expression in my application that looked something like this: .xlf (translation) file: <trans-unit ...
Read more >Localizing your app - Angular Hispano
The xi18n command creates a source language file named messages.xlf in your project's root directory using the XML Localization Interchange File Format (XLIFF, ......
Read more >Internationalization (i18n) - Angular
By default, the command creates a file named messages.xlf in your src/ folder. If you don't use the CLI, you have two options:...
Read more >Angular 7 Internationalization (i18n) – PAKDB - Jesidea
For localization, you can use the Angular CLI to generate most of the ... The extraction tool broke that into two translation units...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s because the compiler will extract the ICU expression separately. With ivy we will have a new approach where the ICU expression stays in the main extracted message
FYI, closing this ticket as a duplicate of #39551.