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(transloco): use fallback language for resolving referenced keys #742

Open
1 task done
Tlepel opened this issue Jan 23, 2024 · 1 comment
Open
1 task done

Comments

@Tlepel
Copy link

Tlepel commented Jan 23, 2024

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

We reference translations quite often using this method: https://jsverse.github.io/transloco/docs/additional-functionality#reference-other-keys

However, when a regional language is used, those keys don't use the fallback language.

Describe the solution you'd like

I think it would be nice if the transpiler would use the fallback language for referenced keys if the current language doesn't include the key.

Describe alternatives you've considered

Alternatives I've considered are for example duplicating the necessary keys, but that's not ideal since maintenance would become very tedious.

Another alternative is rejecting the use of regions, but that's not really likely.

Additional context

Let me know if there's any pointers as to whether there are consequences I haven't thought of, since to me it seems like this shouldn't impact any current implementations.

I would like to make a pull request for this feature

Yes 🚀

@Tlepel Tlepel changed the title Feature(transloco): Feature(transloco): use fallback language for resolving referenced keys Feb 5, 2024
@eestein
Copy link

eestein commented Sep 4, 2024

I'm looking for exactly that. I thought setFallbackLangForMissingTranslation would do that, but it didn't. It'd be great to have a way to fallback to a specific provided language, if the key is not found in the current one. In my case, I register a lot of keys with the service in a library where the language is named en. In the consuming app, the language is named en-US. If the key is not present in en-US, I'd like transloco to get it from the fallback language, which doesn't seem to be happening today.

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

No branches or pull requests

2 participants