[Feature Request] i18n.te doesnt look for global locales
See original GitHub issueNot sure if this a bug or a feature, but when I’m trying to check if global translation exists, te
returns false
for all translations, except component level locales.
Given global locale file en.yaml
:
en:
hello: 'Hello'
i18n.te('hello')
returns false
In case I have hello
tranlsation defined inside my component, it returns true
as expected.
I’ve tried to check source code, and it seems te
doesnt look for global locales intentionally.
Could you please confirm this, or should this be treated as a bug?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:8 (1 by maintainers)
Top Results From Across the Web
[Feature Request] i18n.te doesnt look for global locales -
Not sure if this a bug or a feature, but when I'm trying to check if global translation exists, te returns false for...
Read more >[Feature Request] i18n.te doesnt look for global locales #547
In this config file users can provide a title property for every route. This prop can be a LocaleMessageObject or a string. Objects...
Read more >Problem in accessing i18n.locales in vue components and ...
I have installed the vue-i18n plugin from the vue cli. I have two locales and everything works as expected - whenever I manually...
Read more >i18n Implementation and Best Practices in Strapi
One more thing you can do is disable localization in parts of the Post that you want to retain the default language. Editing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can describe you my use case for this feature:
Sometimes backend returns list of error codes. On the UI side we try to translate them, and we do this dynamically. Because of big amount of different words to be translated we do this dynamically (translation lookup based on error code received from backend, like
company.name
), checking if error code exists in global locales. If it’s absent, we display general error message. Otherwise, error code translated, and human readable message is shown.That’s not bug. But it’s might be improved.
I personally think that
te
is not necessary. Because, we ship the application after we will test whether there is a translation missing. In the future, I’ll plan to remove thete
from vue-i18n.