You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can only provide one key to translate. Something I always wanted, is to easily provide an array where it just picks the first value that actually gets a translation.
Expected behavior
For my project I have a lot of small translations that I would want to fall back on to not supply endless lists of repeated values.
So instead of doing {{'my.translation' | translate}}, I want to do something like this {{['some.translation', 'some.other.translation', 'common.translation'] | translate}}. It will be most useful for dynamic translations where values are dropped in from a backend and you need to provide keys to translate. But instead of repeating yourself, you have multiple locations with values where one could pick from.
The current alternative is to do this in the component logic. To translate a key and check whether it was actually translated or not and return another one, etcetera.
What is the motivation / use case for changing the behavior?
Current situation makes things overly complex for implementing translations
How do you think that we should implement this?
Allow arrays in our item we want to translate. If it is an array, try the first value, do we get a valid response? Return that. Is it not present (with or without language fallback), then we go to the second key and so on. And if we still cant find it, we return the regular value.
The text was updated successfully, but these errors were encountered:
Current behavior
You can only provide one key to translate. Something I always wanted, is to easily provide an array where it just picks the first value that actually gets a translation.
Expected behavior
For my project I have a lot of small translations that I would want to fall back on to not supply endless lists of repeated values.
So instead of doing
{{'my.translation' | translate}}
, I want to do something like this{{['some.translation', 'some.other.translation', 'common.translation'] | translate}}
. It will be most useful for dynamic translations where values are dropped in from a backend and you need to provide keys to translate. But instead of repeating yourself, you have multiple locations with values where one could pick from.The current alternative is to do this in the component logic. To translate a key and check whether it was actually translated or not and return another one, etcetera.
What is the motivation / use case for changing the behavior?
Current situation makes things overly complex for implementing translations
How do you think that we should implement this?
Allow arrays in our item we want to translate. If it is an array, try the first value, do we get a valid response? Return that. Is it not present (with or without language fallback), then we go to the second key and so on. And if we still cant find it, we return the regular value.
The text was updated successfully, but these errors were encountered: