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

Custom i18n locales names #17163

Closed
2 of 15 tasks
vltansky opened this issue Mar 6, 2020 · 3 comments · Fixed by #17220
Closed
2 of 15 tasks

Custom i18n locales names #17163

vltansky opened this issue Mar 6, 2020 · 3 comments · Fixed by #17220

Comments

@vltansky
Copy link
Contributor

vltansky commented Mar 6, 2020

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Description

Hi, I'm sorry in advance. Wasn't sure where should I open issue in Angular repo or here + not sure if it is a bug or feature request :)
Anyway here is the thing:
In our project, we use i18n in a bit different way. We have 13 variations of our app. They share the same core and logic, but the logo, design, and content is different. So we not translating with i18n, but using it to deliver different options of content (for example in one website the welcome message will be 'Welcome customer' and in another, it will be 'Welcome dear partner').
Now we are updating to angular 9 and we are very excited that we won't need to build 13 times, but only once. We started to make a POC, and turns out that in angular.json the key i18n.locales have a regex pattern of ^[a-zA-Z]{2,3}(-[a-zA-Z]{4})?(-([a-zA-Z]{2}|[0-9]{3}))?(-[a-zA-Z]{5,20})?$ according to ./node_modules/@angular/cli/lib/config/schema.json. Our translation for today is smth like en-corporate, en-private, en-pb. So while en-private would work two another wouldnt. I understand that it is not a scenario that you built it for. But is there a solution that we could use without renaming? Is it possible to disable regex validation somehow?

Describe the solution you'd like

To be able to use custom locale names or to disable pattern validation

@clydin
Copy link
Member

clydin commented Mar 10, 2020

Language tags are a standardized format with each subtag expressing specific meaning. The Angular and the Angular CLI support a commonly used set of the subtags. Each subtag can have an effect on the behavior of the application and invalid tags may cause runtime errors or invalid localization data to be used (leading to potential incorrect currency, number separators, etc.). This is especially true with browser APIs that can leverage the tags.

To enabled the above use case, support could be added for private use subtags which are part of the standardized format. This will allow for the creation of valid tags containing the custom information. However, this will require a change to each tag to become conformant. Private use subtags must be at the end of the tag. They begin with x- and are followed by groups of one to eight characters (e.g., en-x-private).

@vltansky
Copy link
Contributor Author

@clydin Thanks, sounds good enough for me :)

@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 Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants