Angular i18n generates one trans-unit where two are needed.
See original GitHub issue🐞 bug report
Affected Package
Is this a regression?
Never worked.
Description
When using icu for pluralisation the context of the words get lost. Some translations for the same words differ based on context.
🔬 Minimal Reproduction
What you first need to know:
German / English Person / person Personen / persons
Use in your project:
<p i18n>{items.length, plural, one {Person} other {Personen}} gehen unwiderruflich verloren.</p>
And somewhere else:
<p i18n>Entferne {items.length, plural, one {Person} other {Personen}}</p>
Note that the first letter of the noun is uppercase in german. No matter if it’s the beginning of a sentence or not.
Generate translation files and translate them. You will get three nodes. Something linke this:
<source><x id="ICU" equiv-text="{items.length, plural, one {...} other {...}}"/> gehen unwiderruflich verloren.</source>
<target><x id="ICU" equiv-text="{items.length, plural, one {...} other {...}}"/> will be lost permanently.</target>
<source>Entferne <x id="ICU" equiv-text="{items.length, plural, one {...} other {...}}"/></source>
<target>Remove <x id="ICU" equiv-text="{items.length, plural, one {...} other {...}}"/></target>
<source>{VAR_PLURAL, plural, one {Person} other {Person} }</source>
<target>{VAR_PLURAL, plural, one { ❓❓❓ } other { ❓❓❓ } }</target>
Problem:
First sentence would need the translation
{VAR_PLURAL, plural, one {Person} other {Persons} }
Second sentence would need the translation
{VAR_PLURAL, plural, one {person} other {persons} }
I expected two trans-units. Something like this:
<source>{items.length, plural, one {Person} other {Personen}} gehen unwiderruflich verloren.</source>
<target>{items.length, plural, one {Person} other {Persons}} will be lost permanently.</target>
and
<source>Entferne {items.length, plural, one {Person} other {Personen}}</source>
<target>Remove {items.length, plural, one {Person} other {Persons}}</target>
🌍 Your Environment
Angular Version:
Angular CLI: 9.1.12
Node: 10.16.0
OS: darwin x64
Angular: 9.1.12
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.9
@angular-devkit/build-angular 0.901.9
@angular-devkit/build-optimizer 0.901.9
@angular-devkit/build-webpack 0.901.9
@angular-devkit/core 9.1.9
@angular-devkit/schematics 9.1.12
@angular/fire 5.2.3
@ngtools/webpack 9.1.9
@schematics/angular 9.1.12
@schematics/update 0.901.12
rxjs 6.6.3
typescript 3.8.3
webpack 4.43.0
Anything else relevant? @ocombe announced that the ivy release will fix this. But people decided to not ship this in order to to make Ivy more backwards compatible.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
This really prevents us to use ICU plural/select, as it separates ICU blocks into its own unique trans-unit across all translation strings.
This makes translation inaccurate for some reasons:
Saw at linked issue https://github.com/angular/angular/issues/25858 that a fix was announced for Ivy, but seems it was really never released.
What’s the state of this? @ocombe @AndrewKushnir @petebacondarwin
I have the same problem with the term “transactions” which has 2 translations in German for only one in English
+1