Skip to content

Usage of @angular/localize in Angular Libraries #34920

@klemenoslaj

Description

@klemenoslaj

🐞 bug report

Affected Package

The issue is caused by package @angular/localize

Is this a regression?

No, @angular/localize is new in Angular 9.

Description

I have already added my comment in a corresponding issue of documentation. If this is indeed just a documentation issue and I misunderstood the situation, please feel free to close the issue.

Documentation comment: #34822 (comment)


Currently, it's quite unclear to me, how we are supposed to use the localization features in the libraries. Commonly we are importing @angular/localize/init into the polyfills.ts, but with libraries, I have very quickly identified some confusing situations:

  • should each library be importing @angular/localize/init as well since otherwise it fails building?
  • should each library import it to test.ts file as well - tests fail to execute if the import is not there?
  • if some library imports @angular/localize/init all its dependents will successfully build. Therefore, if this library removes the import its dependants will start failing.

In my opinion the last one is the most confusing.

🔬 Minimal Reproduction

🔥 Exception or Error

🌍 Your Environment

Angular Version:


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

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

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.0-rc.9
@angular-devkit/build-angular      0.900.0-rc.9
@angular-devkit/build-ng-packagr   0.900.0-rc.9
@angular-devkit/build-optimizer    0.900.0-rc.9
@angular-devkit/build-webpack      0.900.0-rc.9
@angular-devkit/core               9.0.0-rc.9
@angular-devkit/schematics         9.0.0-rc.10
@angular/cdk                       9.0.0-rc.8
@angular/flex-layout               8.0.0-beta.27
@angular/material                  9.0.0-rc.8
@angular/pwa                       0.900.0-rc.10
@ngtools/webpack                   9.0.0-rc.9
@schematics/angular                9.0.0-rc.10
@schematics/update                 0.900.0-rc.9
ng-packagr                         9.0.0-rc.7
rxjs                               6.5.4
typescript                         3.6.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: i18nIssues related to localization and internationalization

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions