can't get list of global availableLocales from component
See original GitHub issuevue & 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:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top 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 >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
thank you, dear @kazupon ! it is working with
this.$i18n.availableLocales
PS. there is a typo in your sample code (
this.$i18n.availableLocale
)@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:
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
). TheGeneral
component has been assigned a global scope. (legacy mode) Your Vue application is running in legacy mode, and theGeneral
component has been assigned a global scope, which means it can be accecced on the component withthis.$i18n.availableLocale
.