DEV Community

Cover image for Language translation plugin for vue js
Ankit Zore
Ankit Zore

Posted on • Edited on

Language translation plugin for vue js

Hello everyone 👋,

I'm Ankit Zore Full stack developer from India. Currently working on laravel nova and vue js frameworks.

I have created vue language plugin which out of the box provides translation feature.

I have used different alternatives but I felt they were complex to solve just translation issues if you have custom words. So I created plugin which does it for you.

How it works?

You create the language file where you define all words which needs to be translated as key and there translations as value.

Eg:fr.js

export default
    {
        "title": "titre",
        "Hello World": "Bonjour le monde"
    }
Enter fullscreen mode Exit fullscreen mode

This file will be used by plugin to check for translations.

When you install plugin you get "translate()" out of the box which can be used in templates as well as scripts to translate words.

Plugin also provides vuex store where you can mutate the current locale variable. If locale variable is set to fr it will show translations of fr file similar for other languages.

Check vue_language_plugin for complete installation and guide on how to use it.

This is my 1st open source project. Any suggestions, advices, help are most welcomed

Top comments (0)