2020-02-03
2270
#vue
Preetish HS
13235
Feb 3, 2020 ⋅ 8 min read

Localization in Vue.js with vue-i18n

Preetish HS Freelance web developer, digital nomad, and design enthusiast. You can find me online at preetish.in.

Recent posts:

gemini 3 and antigravity

A developer’s guide to Antigravity and Gemini 3

Check out Google’s latest AI releases, Gemini and the Antigravity AI IDE. Understand what’s new, how they work, and how they can reshape your development workflow.

Elijah Asaolu
Dec 4, 2025 ⋅ 6 min read
bun 1.3 javascript runtime what's new

Bun 1.3: Is it time for devs to rethink the Node stack?

Learn about Bun 1.3, which marks a shift from fast runtime to full JS toolchain—and see the impact of Anthropic’s acquisition of Bun.

Alex Merced
Dec 4, 2025 ⋅ 9 min read

Stop using JavaScript to solve CSS problems

Stop defaulting to JavaScript. Modern CSS handles virtualization, responsive layouts, and scroll animations better than ever – with far less code.

Chizaram Ken
Dec 4, 2025 ⋅ 7 min read
replay december 3

The Replay (12/3/25): React’s next era, AI code review tools, and more

React’s next era, AI code review tools, and more: discover what’s new in The Replay, LogRocket’s newsletter for dev and engineering leaders, in the December 3rd issue.

Matt MacCormack
Dec 3, 2025 ⋅ 30 sec read
View all posts

4 Replies to "Localization in Vue.js with vue-i18n"

  1. Hi Preetish! I’m following along with your tutorial and after making the changes to App.vue and HelloWorld.vue and attempting to run the app, I’m getting the error ‘languageArray:’ is defined but never used. Do you know why this might be?

  2. Hi,
    Thank you very much for such detailed article and knowledge share.

    I’ve made a small change to cehckDefaultLanguage because forEach continues to iterate despite already having a match.

    function checkDefaultLanguage () {
    let matched = null
    const supportedLanguages = Object.getOwnPropertyNames(loadLocaleMessages())
    matched = supportedLanguages.find(lang => lang === navigator.language)
    if (!matched) {
    const navigatorLanguagePartials = navigator.language.split(‘-‘)[0]
    matched = supportedLanguages.find(lang => lang === navigatorLanguagePartials)
    }
    if (!matched) {
    const navigatorLanguagePartials = navigator.language.split(‘-‘)[0]
    matched = supportedLanguages.find(lang => lang.split(‘-‘)[0] === navigatorLanguagePartials)
    }
    return matched
    }

Leave a Reply

Would you be interested in joining LogRocket's developer community?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now