-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Feature Request [i18n]: Support providing TRANSLATIONS at NgModule level #11431
Description
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]