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

[i18n] Pluralization not working #14396

Closed
ghidoz opened this issue Feb 10, 2017 · 3 comments

Comments

@ghidoz
Copy link

commented Feb 10, 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
I'm using the i18n pluralization:

<span i18n>{itemService.selectedItems.length, plural, =1 {item selected} other {items selected}}</span>

I launch ng-xi18n -p src/tsconfig.json --i18nFormat=xmb

and in the messages.xmb I get:

<msg id="2806404842968335853">{VAR_PLURAL, plural, =1 {item selected} other {items selected} }</msg>

I translate it in my xtb file as:

<translation id="2806404842968335853">{VAR_PLURAL, plural, =1 {producto selectionado} other {productos selectionados} }</translation>

Then I compile with the angular cli command:

ng serve --env=beta --aot --locale es --i18n-file src/locale/es.xtb --i18n-format xtb

And I get this error:

ERROR in Missing translation for message 3009369920790703905 ("v>
    <div id="total-selected" [hidden]="itemService.selectedItems.length === 0">
      <span i18n>[ERROR ->]{itemService.selectedItems.length, plural, =1 {item selected} other {items selected}}</span>
      <b"): CatalogComponent@13:17

I don't understand why it's looking for 3009369920790703905 message id, while it is generated with 2806404842968335853 id.

Expected behavior

I expect to compile correctly and show the pluralization.

Please tell us about your environment:

OSX El Capitan

Angular version:

angular-cli: 1.0.0-beta.24
node: 4.5.0
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/platform-server: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1

@ocombe

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2017

I've just tried your example, I get the same id after extraction. I've used your translation and loaded my app with ng serve --aot --locale es --i18n-format xtb --i18n-file src/i18n/messages.es.xtb and it worked fine.
The only difference is that I'm using angular 4... Could you try with v4 and tell me if you still have the problem?

@vicb

This comment has been minimized.

Copy link
Contributor

commented Mar 21, 2017

@vicb vicb closed this Mar 21, 2017
@angular-automatic-lock-bot

This comment has been minimized.

Copy link

commented Sep 11, 2019

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 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.