question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] i18n.te doesnt look for global locales

See original GitHub issue

Not 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:open
  • Created 4 years ago
  • Reactions:8
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
vladracommented, Apr 15, 2019

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.

11reactions
kazuponcommented, Apr 12, 2019

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 the te from vue-i18n.

Read more comments on GitHub >

github_iconTop 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 >
Roadmap - Vue I18n - Intlify
Internationalization plugin for Vue.js.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found