Skip to content

Feature Request [i18n]: Support providing TRANSLATIONS at NgModule level #11431

@paumayr

Description

@paumayr

Current behavior
Currently translations can only be provided at bootstrap using TRANSLATIONS. This makes it difficult for feature / component modules to ship translations xlf files along with the npm module: All xlf files from all feature modules (for a specific locale) will have to be merged before bootstrap into a single value for TRANSLATIONS.

Expected behavior
Ideally we could provide a TRANSLATIONS value for every NgModule. This would have to be per locale, possibly as an Url pattern, something like
@NgModule({ // ... omitted translationUrl: './messages.{locale}.xlf', // ... omitted }) export class MyFeatureComponent { }
but I'm not familiar enough with the compiler to understand all implications of this.

Reproduction of the problem
Package an component with localization and corresponding messages.xlf into an npm module.

What is the motivation / use case for changing the behavior?
Larger codebases like to reuse common, localized components in multiple applications to provide base components with a common style, etc. Having to merge the localization data from all modules in a pre-build step is possible, but figuring out which components are actually used and resolving the corresponding paths is tricky.

Please tell us about your environment:
Win10, corporate (with proxy..)

  • Angular version: ^2.0.0-rc.6
  • Browser: [all]
  • Language: [all]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: i18nIssues related to localization and internationalizationfeatureLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under consideration

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions