Translate the App

Vuely support multilingual feature which helps you to build your app in multilingual. Read the documentation carefully and follow the steps.

How To Set Default Language

Follow the steps if you want to set default language you can choose english, french, hebrew, russian and arabic according to your desired language.

Go to the public-> javascripts-> main.js

// Change code of the language to set the default language
  var langCode = 'en'; 

Go to the routes->session->session.js

// Change code of the language to set the default language
var defaultLang = '?clang=en';

After that access any page.

Where languages is type of array which provides you to set of locales. Languages are defined in the data.js file under the

routes-> data.js

data.js
exports.languages = [{
                        name: "English",
                        icon: "en"
                     },{
                        name: "French",
                        icon: "fr"
                     },{
                        name: "Hebrew",
                        icon: "he"
                     },{
                        name: "Russian",
                        icon: "ru"
                     }
                   ]        

How To Add A New Locale

Here are the instructions to add a new locale in your app. We are taken an example of German that we are going to add.

Create ge.json file under the directory lang->ge.jsonthat you have just created and define the static strings which you want translate into German, you can check the other locale files how strings are defined.

ge.json
{
   "general": "Allgemeines",
   "overview": "Überblick",
}

Add new "ge" variable in app.js file

app.js
app.use(i18n({
   translationsPath: path.join(__dirname, 'lang'), // <--- use here. Specify translations files path.
   siteLangs: ["ar","en","cn","fr","he","es","ru","ge"], // add new locales
   cookieLangName : 'ulang',
   browserEnable : 'true',
   textsVarName: 'translation'  
}));

Now you need to add your locale inside the data.js file under the routes-> data.js directory.

data.js
...
exports.languages = [{
                        name: "English",
                        icon: "en"
                     },{
                        name: "French",
                        icon: "fr"
                     },{
                        name: "Hebrew",
                        icon: "he"
                     },{
                        name: "Russian",
                        icon: "ru"
                     },
                     // your locale goes to here
                     {
                        name: "German",
                        icon: "ge"
                     }
                  ]       
...                  

That's it, Now you can translate your app in your preferred language.

Last updated