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

Feature(config): support translation without needing to specify availableLangs #653

Open
1 task done
dkimmich-onventis opened this issue May 3, 2023 · 3 comments · May be fixed by #689
Open
1 task done

Feature(config): support translation without needing to specify availableLangs #653

dkimmich-onventis opened this issue May 3, 2023 · 3 comments · May be fixed by #689
Labels
enhancement New feature or request

Comments

@dkimmich-onventis
Copy link

dkimmich-onventis commented May 3, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Which Transloco package(s) will this feature affect?

Transloco

Is your feature request related to a problem? Please describe

In our company, we have a third party tool where the translations are maintained. The developers add the keys in the english language and upload the keys to the tool. Someone else will take care that the keys will be translated in all supported languages. During build, we download all the translation files. However, the developers don't care which languages are supported, either the translation file is there, or it's missing and we run the fallback logic. Transloco though forces us developers to maintain a list of all supported languages, which is annoying for us as it's not our responsibility. Adding new languages now requires code changes, which complicates this process unnecessarily.

Describe the solution you'd like

In TranslocoConfig, when omitting availableLangs, or setting it to null, I can load any language without restrictions.

Describe alternatives you've considered

We can bite the bullet and maintain the list of supported languages

Additional context

We are migrating from ngx-translate, there we don't need to specify the available languages.

I would like to make a pull request for this feature

Yes 🚀

@majora2007
Copy link

I'm in the same boat here, it makes it painful when adding a tool like Weblate or Crowdin and not hardcoding a ton of different languages. I think passing undefined or omitting should allow for any locale to be used.

I went the hardcoding route but still require maintenance as Weblate has a ton of language codes:

const languageCodes = [
  'af', 'af-ZA', 'ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW',
  'ar-LB', 'ar-LY', 'ar-MA', 'ar-OM', 'ar-QA', 'ar-SA', 'ar-SY', 'ar-TN', 'ar-YE',
  'az', 'az-AZ', 'az-AZ', 'be', 'be-BY', 'bg', 'bg-BG', 'bs-BA', 'ca', 'ca-ES', 'cs',
  'cs-CZ', 'cy', 'cy-GB', 'da', 'da-DK', 'de', 'de-AT', 'de-CH', 'de-DE', 'de-LI', 'de-LU',
  'dv', 'dv-MV', 'el', 'el-GR', 'en', 'en-AU', 'en-BZ', 'en-CA', 'en-CB', 'en-GB', 'en-IE',
  'en-JM', 'en-NZ', 'en-PH', 'en-TT', 'en-US', 'en-ZA', 'en-ZW', 'eo', 'es', 'es-AR', 'es-BO',
  'es-CL', 'es-CO', 'es-CR', 'es-DO', 'es-EC', 'es-ES', 'es-ES', 'es-GT', 'es-HN', 'es-MX',
  'es-NI', 'es-PA', 'es-PE', 'es-PR', 'es-PY', 'es-SV', 'es-UY', 'es-VE', 'et', 'et-EE',
  'eu', 'eu-ES', 'fa', 'fa-IR', 'fi', 'fi-FI', 'fo', 'fo-FO', 'fr', 'fr-BE', 'fr-CA',
  'fr-CH', 'fr-FR', 'fr-LU', 'fr-MC', 'gl', 'gl-ES', 'gu', 'gu-IN', 'he', 'he-IL', 'hi',
  'hi-IN', 'hr', 'hr-BA', 'hr-HR', 'hu', 'hu-HU', 'hy', 'hy-AM', 'id', 'id-ID', 'is',
  'is-IS', 'it', 'it-CH', 'it-IT', 'ja', 'ja-JP', 'ka', 'ka-GE', 'kk', 'kk-KZ', 'kn',
  'kn-IN', 'ko', 'ko-KR', 'kok', 'kok-IN', 'ky', 'ky-KG', 'lt', 'lt-LT', 'lv', 'lv-LV',
  'mi', 'mi-NZ', 'mk', 'mk-MK', 'mn', 'mn-MN', 'mr', 'mr-IN', 'ms', 'ms-BN', 'ms-MY',
  'mt', 'mt-MT', 'nb', 'nb-NO', 'nl', 'nl-BE', 'nl-NL', 'nn-NO', 'ns', 'ns-ZA', 'pa',
  'pa-IN', 'pl', 'pl-PL', 'ps', 'ps-AR', 'pt', 'pt-BR', 'pt-PT', 'qu', 'qu-BO', 'qu-EC',
  'qu-PE', 'ro', 'ro-RO', 'ru', 'ru-RU', 'sa', 'sa-IN', 'se', 'se-FI', 'se-FI', 'se-FI',
  'se-NO', 'se-NO', 'se-NO', 'se-SE', 'se-SE', 'se-SE', 'sk', 'sk-SK', 'sl', 'sl-SI',
  'sq', 'sq-AL', 'sr-BA', 'sr-BA', 'sr-SP', 'sr-SP', 'sv', 'sv-FI', 'sv-SE', 'sw', 'sw-KE',
  'syr', 'syr-SY', 'ta', 'ta-IN', 'te', 'te-IN', 'th', 'th-TH', 'tl', 'tl-PH', 'tn',
  'tn-ZA', 'tr', 'tr-TR', 'tt', 'tt-RU', 'ts', 'uk', 'uk-UA', 'ur', 'ur-PK', 'uz',
  'uz-UZ', 'uz-UZ', 'vi', 'vi-VN', 'xh', 'xh-ZA', 'zh', 'zh-CN', 'zh-HK', 'zh-MO',
  'zh-SG', 'zh-TW', 'zu', 'zu-ZA', 'zh_Hans'
];

json-derulo added a commit to json-derulo/transloco that referenced this issue Aug 10, 2023
Currently the available languages need to be set, otherwise the
translated values won't be returned. With this change the translation
will also work when omitting the availableLangs config, or setting it to
null.

✅ Closes: jsverse#653
@json-derulo json-derulo linked a pull request Aug 10, 2023 that will close this issue
13 tasks
json-derulo added a commit to json-derulo/transloco that referenced this issue Aug 12, 2023
Currently the available languages need to be set, otherwise the
translated values won't be returned. With this change, the translation
will also work when omitting the availableLangs config, or setting it to
null.

✅ Closes: jsverse#653
@shaharkazaz
Copy link
Collaborator

I see your point/pain.
I need to figure out how this affects Transloco as it was made for a reason so we'd make the best solution 👍

@shaharkazaz shaharkazaz added the enhancement New feature or request label Aug 13, 2023
@Naikno
Copy link

Naikno commented May 7, 2024

any news about this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants