Vue.locale is not a function - Issue after upgrading to 3.0
See original GitHub issueI’m getting Unknown TypeError: Vue.locale is not a function
var VueI18n = require('vue-i18n')
Vue.use(VueI18n)
Vue.config.lang = 'sv'
var locales = require('./lang/locales')
Object.keys(locales).forEach(function (lang) {
Vue.locale(lang, locales[lang])
})
And in my locales file I have like I had in 2.*:
module.exports = {
en: {
message: 'Hi',
},
sv: {
message: 'Hej',
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:28 (6 by maintainers)
Top Results From Across the Web
vue.js - _vue2.default.locale is not a function - Stack Overflow
When I used vue-i18n in my project ...
Read more >Frequently asked questions — Vuetify
When will Vuetify v3 be released? Why is Search Vuetify not working properly? My application won't compile due to sass / scss errors....
Read more >The Ultimate Vue Localization Guide | Phrase
Dive into Vue localization and learn how to plug the Vue I18n library into your app, so you can make it accessible to...
Read more >Single file components | Vue I18n
If you are building Vue component or Vue application using single file components, you can manage the locale messages i18n custom block.
Read more >Localization - VeeValidate
If you have multiple locales in your app, loading all the validation messages for those locales is not optimal. You can load a...
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
Can confirm,
npm install vue-i18n
is installing"^6.0.0-alpha.2"
which is triggering the errorUncaught TypeError: __WEBPACK_IMPORTED_MODULE_0_vue___default.a.locale is not a function
when following the getting started guide exactly (setting up before initiating vue-router etc)The error goes away if I manually force in package.json
"vue-i18n": "^5.0.3"
I have the same issue (
vue-i18n@^4.0.1
) but I do not usevue-router
. It is just Vue.js and a custom component. This is my script:The line setting the locale strings (
Vue.locale(lang, locales[lang]);
) results in the error _coboo-4a6b9317b0.js:11410 Uncaught TypeError: vue2.default.locale is not a function. Browserify compiles it to: