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

--localize: pipes localization missing for default language if it's not English #16389

Closed
cyrilletuzi opened this issue Dec 8, 2019 · 4 comments · Fixed by #16394
Closed

Comments

@cyrilletuzi
Copy link
Contributor

cyrilletuzi commented Dec 8, 2019

🐞 Bug report

Command

  • build

Is this a regression?

No, as it's a new feature in v9.

Description

When using the new --localize option, if the default language (sourceLocale) is not English, localization for pipes is missing in the default language, resulting the app to fail.

🔬 Minimal Reproduction

  • create an app with v9 cli
  • use a pipe involving i18n like date
  • use a language other than English as default in your source code (let's say French)
  • translate the app for other languages (let's say English and Deutsh)
  • add the config in angular.json:
"projects": {
  "demo": {
    "i18n": {
      "sourceLocale": "fr",
      "locales": {
        "en": "src/locale/messages.en.xlf",
        "de": "src/locale/messages.de.xlf",
      }
    }
  }
}
  • ng build --prod --localize

Result: en and de will work fine, but fr won't have localization for pipes.

If English is the default like below, every locale will work fine:

"projects": {
  "demo": {
    "i18n": {
      "sourceLocale": "en",
      "locales": {
        "fr": "src/locale/messages.fr.xlf",
        "de": "src/locale/messages.de.xlf",
      }
    }
  }
}

🔥 Exception or Error

In browser console:


Error: InvalidPipeArgument: 'Missing locale data for the locale "fr".' for pipe 't'

Resulting in everything after the pipe in the template to fail to render.

🌍 Your Environment


Angular CLI: 9.0.0-rc.5
Node: 12.13.1
OS: darwin x64

Angular: 9.0.0-rc.5
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, localize, material
... platform-browser, platform-browser-dynamic, router
... service-worker
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.0-rc.5
@angular-devkit/build-angular      0.900.0-rc.5
@angular-devkit/build-ng-packagr   0.900.0-rc.5
@angular-devkit/build-optimizer    0.900.0-rc.5
@angular-devkit/build-webpack      0.900.0-rc.5
@angular-devkit/core               9.0.0-rc.5
@angular-devkit/schematics         9.0.0-rc.5
@ngtools/webpack                   9.0.0-rc.5
@schematics/angular                9.0.0-rc.5
@schematics/update                 0.900.0-rc.5
ng-packagr                         9.0.0-rc.3
rxjs                               6.5.3
typescript                         3.6.4
webpack                            4.41.2
@elvisbegovic
Copy link
Contributor

elvisbegovic commented Dec 8, 2019

Already known issue in <=rc4, it works for english because it is default locale. Apparently CLI doesn’t handle source locale different than « en-US ». As workaround you can register it manually (see aio doc)
Cc @alan-agius4

@cyrilletuzi
Copy link
Contributor Author

cyrilletuzi commented Dec 8, 2019

@elvisbegovic I don't have the time to debug this, but if the CLI can handle it when the order is different, I think it can handle it in any order. From what I see, it's just a wrong condition or a missed case, the code to add the pipes localization already exists. But maybe I'm unaware of an unexpected limitation.

@clydin
Copy link
Member

clydin commented Dec 9, 2019

This is a defect and will be corrected before the final release.

@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 Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.