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.

can't get list of global availableLocales from component

See original GitHub issue

vue & vue-i18n version

"vue": "^3.0.4",
"vue-i18n": "^9.0.0-beta.16",
"@intlify/vue-i18n-loader": "^2.0.0-beta.3",

Reproduction Link

https://github.com/Alymbek/vue3-i18n-next/blob/master/src/pages/layout/components/Language.vue

Steps to reproduce

Standard steps

What is Expected?

Want to get a list of global availableLocales from the component.

What is actually happening?

Getting only fallbackLocale value, I guess.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Alymbekcommented, Jan 2, 2021

thank you, dear @kazupon ! it is working with this.$i18n.availableLocales

PS. there is a typo in your sample code (this.$i18n.availableLocale)

0reactions
kazuponcommented, Jan 1, 2021

@Alymbek

You can check the components that is assiend global scope with using vue-devtools. (You need to upgrade vue-i18n@v9.0.0-beta.18 & vue-devtools@6.0.0.beta.3)

The following is a screenshot of vue-devtools appearing the scopes of vue-i18n:

image

In the component inspector, vue-i18n tags components that are assigned a local scope with i18n (xxx scope). Other than that label, components are assigned **global scope`. (In legacy mode).

Your Vue application is making in Vue I18n legacy mode (legacy: true). The General component has been assigned a global scope. (legacy mode) Your Vue application is running in legacy mode, and the General component has been assigned a global scope, which means it can be accecced on the component with this.$i18n.availableLocale.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamically generate a list of available languages in Spring ...
findResources("messages");. Then iterate over the Enumeration , getting the locale ( en , de etc) part from each URL.
Read more >
API references | Vue I18n
Localize in preferentially component locale messages than global locale ... The list of available locales in messages in lexical order.
Read more >
Composition API - Vue I18n
global property: VueI18n instance to Composer instance. You are now ready to use useI18n in the component setup . The code looks like...
Read more >
Managing Available Locales
Adding or Removing Locales by Using nlsadm. You can use the install-locale, list-locale, and uninstall-locale subcommands of the nlsadm command to administer ...
Read more >
The Ultimate Vue Localization Guide | Phrase
You can get all of it from the start-options branch of our GitHub repo ... component, which shows the coordinates of the International...
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