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:

Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 2024 â‹… 7 min read
Using Aoi Js To Build A Bot For Discord

Using aoi.js to build a bot on Discord

Explore how the aoi.js library makes it easy to create Discord bots with useful functionalities for frontend applications.

Rahul Padalkar
Apr 17, 2024 â‹… 9 min read
Web Components Adoption Guide: Overview, Examples, And Alternatives

Web Components adoption guide: Overview, examples, and alternatives

Evaluate Web Components, a set of standards that allow you to create custom HTML tags for more reusable, manageable code.

Elijah Asaolu
Apr 16, 2024 â‹… 11 min read
Using Aws Lambda And Aws Cloudfront To Optimize Image Handling

Using AWS Lambda and CloudFront to optimize image handling

Leverage services like AWS Lambda, CloudFront, and S3 to handle images more effectively, optimizing performance and providing a better UX.

Nitish Sharma
Apr 12, 2024 â‹… 12 min 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