Core: Multiple fallback Languages

Created on 6 Feb 2018  路  2Comments  路  Source: ngx-translate/core

I'm submitting a ...

[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[x] support request => check the FAQ and search github for a similar issue before submitting
[x] feature request

Allow chain of fallback languages.

What is the motivation / use case for changing the behavior?
My use case is that different customers are using different languages and also different terminologies for some business terms. for example for the term "wheel"most customers call "wheel" but some call "circle".
In addition french users of customers would like to use the terms that they are familiar with in french so fallback chain would look like:
fr.customer --> fr --> en --> MissingTranslationHandler
or even
fr.customer --> en.cutomer --> fr --> en --> MissingTranslationHandler
which fr.customer should override fr and if key not found I would like to get the word in english and only than to be able resolve it in a miss handler.

Current behavior
Fallback is available to another language by using the useDefaultLang and MissingTranslationHandler
which can support only one fallback.

Expected/desired behavior
Expected behaviour is to allow a fallback chain of languages

environment:

  • ngx-translate version: 9.0.2
  • Angular version: 5.2.0
feature request

Most helpful comment

The fallback chain feature was available in angular-translate of AngularJS. i.e you could do something like de-DE ---- de---- en, providing translations incrementally and for specific regions. Any plans of including this feature in future releases?

All 2 comments

That would be very helpful to at least have a two step approach instead of the one step as available today.

Additional scenario , which would be most relevant for me, is:

  • Developer define keys and initial values. May call it developer-en.json
  • To release, we may polish this English first, to create a nice en.json
  • What might be enhanced with various more languages fr.json, ... let's call this any-other-lang.json

Then fallback strategy should be, in case not found: any-other-lang.json --> en.json --> developer-en.json.

This would allow to never have empty strings, at least asured by developer-en.json. Potentially with a loss in quality of texts but at least operate-able.

The fallback chain feature was available in angular-translate of AngularJS. i.e you could do something like de-DE ---- de---- en, providing translations incrementally and for specific regions. Any plans of including this feature in future releases?

Was this page helpful?
0 / 5 - 0 ratings