Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to use i18n pluralization #13780

Closed
jnizet opened this issue Jan 4, 2017 · 5 comments
Closed

Impossible to use i18n pluralization #13780

jnizet opened this issue Jan 4, 2017 · 5 comments

Comments

@jnizet
Copy link
Contributor

jnizet commented Jan 4, 2017

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
Building a bundle with plural messages translations fail

Expected behavior
The bundle would be built successfully

Minimal reproduction of the problem with instructions
I tried using the pluralization support using the following template snippet:

    <ng-container i18n="New pack available alert">
      We rolled out {{ newerPacks.length }} {newerPacks.length, plural, =1 {new pack} other {newer packs}} since the version you're using. [abbreviated]
    </ng-container>

Extracting the i18n messages works (almost) fine: two trans-unit elements are generated: one for the whole message, and one for the pluralization part, but without any source value:

    <trans-unit id="44a0e07b720aebe2fdf15b27e3f9200f3b324dcd" datatype="html">
      <source>
        We rolled out <x id="INTERPOLATION"/> <x id="ICU"/> since the version you&apos;re using. [abbreviated]
      </source>
      <target/>
      <note priority="1" from="description">New pack available alert</note>
    </trans-unit>
    <trans-unit id="b1e46f91ba6caaabef682f347be69deb8ab26d02" datatype="html">
      <source/>
      <target/>
    </trans-unit>

However, if I translate these two trans-units and then build the application, it complains that a message is not translated, but with an unrelated, and unexisting ID:

ERROR in Missing translation for message 1c59e50923d54ca365fdcbd95258b4310dc9ad0f ("pan class="glyphicon glyphicon-info-sign"></span>
    <ng-container i18n="New pack available alert">[ERROR ->]
      We rolled out {{ newerPacks.length }} {newerPacks.length, plural, =1 {new pack} other {newer p"): HomeComponent@6:50

Note that replacing the generated ID (44a0e07b720aebe2fdf15b27e3f9200f3b324dcd) by the one suggested in the error message (1c59e50923d54ca365fdcbd95258b4310dc9ad0f) makes the compiler complain about a missing translation for the generated ID. I have to translate the message twice, using the two IDs, to make it work as expected.

Please tell us about your environment:
MacOS X Sierra, following versions:

angular-cli: 1.0.0-beta.24
node: 6.9.2
os: darwin x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1
  • Angular version: 2.4.1

  • Browser: NA

  • Language: TypeScript 2.0.10

  • Node (for AoT issues): node --version = 6.9.2

@vicb
Copy link
Contributor

vicb commented Jan 4, 2017

Known issue: ICU messages are not yet supported in xliff

@vicb vicb closed this as completed Jan 4, 2017
@jnizet
Copy link
Contributor Author

jnizet commented Jan 4, 2017

OK. Thanks for the clarification. This is not very clear in the documentation, which indeed mentions a lack of support, but nevertheless shows examples and gives explanations about translating them, using xliff.

@jnizet
Copy link
Contributor Author

jnizet commented Jan 4, 2017

BTW, couldn't we leave this issue opened if it's indeed an issue, because a search on open issues on i18n / ICU doesn't bring anything, which tends to suggest that the issue isn't known, or is fixed already. Instead, there are issues like #12636, which also tend to suggest that ICU is working, except for HTML support.

@vicb
Copy link
Contributor

vicb commented Jan 5, 2017

This is not very clear in the documentation,

Please open a bug on angular/angular.io

there are issues like ...

We already have issues tracking this 12636 is one of them, there are other. GH search sucks for issue and there's nothing I can for for that, sorry.

FYI the main thing here is to figure out how the ICU messages should be serialized in xliff. If anybody has some pointers the impl is trivial. (might be as easy as create a .po and convert it to xliff with Virtaal or any other tools)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants