Skip to content

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

Closed as not planned

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]

Activity

  1. changed the title [-]Feature Request [i18n]: Support providing TRANSLATIONS on an NgModule level[/-] [+]Feature Request [i18n]: Support providing TRANSLATIONS at NgModule level[/+] on Sep 8, 2016
  2. paumayr commented on Sep 8, 2016

    @paumayr
    Author

    Related, but not as important would be the ability to run ng-xi18n per NgModule. For us this is not really a problem as we have sample / test applications for developing components which we can use to extract i18n.

    While thinking about it, it should be possible to restrict ng-xi18n output to a specific module. Consider this:

    Feature A (i18n)
    Feature B (i18n) using Feature A

    calling ng-xi18n to generate messages for Feature B would also include i18n data from Feature A, which we want to keep out of messages.xlf of Feature B.

  3. added
    featureLabel used to distinguish feature request from other issues
    area: i18nIssues related to localization and internationalization
    on Sep 8, 2016
  4. ocombe commented on Apr 19, 2017

    @ocombe
    Contributor

    This is something that we are looking into adding when we fix #11405 (using translations in code). It might not be exactly like you requested though

  5. added this to the Backlog milestone on Jan 23, 2018
  6. added
    feature: under considerationFeature request for which voting has completed and the request is now under consideration
    on Jun 4, 2021
  7. ChBernat commented on Feb 26, 2023

    @ChBernat

    @ocombe This was fixed quite some time ago.

    Is this feature going any further?

  8. ocombe commented on Feb 27, 2023

    @ocombe
    Contributor

    No I don't think so, I'm not working for Google anymore though, so I'm not sure

  9. ChBernat commented on Mar 12, 2023

    @ChBernat

    Damn, that's a shame.

    @petebacondarwin Any news?

  10. alxhub commented on Apr 3, 2024

    @alxhub
    Member

    I'm going to go ahead and close this issue, as with the introduction of standalone, NgModules don't make much sense anymore as a reasonable subdivision of an Angular application for the purposes of i18n.

  11. angular-automatic-lock-bot commented on May 4, 2024

    @angular-automatic-lock-bot

    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.

  12. locked and limited conversation to collaborators on May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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