Skip to content

[i18n] Pluralization not working #14396

@ghidoz

Description

@ghidoz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions