Appearance
Plugins
Plugins allow you to quickly install sophisticated functionality to your applications. 🔥
Localization - i18n
In today's technological world, the ability of your website to draw in new visitors is more crucial than ever. You may reach a much larger audience and increase your reach by having a multilingual website.
We have provided multiple language options using vue-i18n
plugin.
Basic sample
Let's add the French language to our project :
- Navigate to
src/plugins/i18n
folder.
📂 src
└── 📂 plugins
└── 📂 i18n
├── 📂 locales
| ├── ar.json
| └── en.json
└── index.js
Create a new file named
fr.json
in thesrc/plugins/locales
folder with following contentjson{ "hello": "Bonjour" }
Add the new language in the
src/plugins/index.js
file.
js
import {createI18n} from "vue-i18n";
import en from "./locales/en.json";
import ar from "./locales/ar.json";
import fr from "./locales/fr.json";
export default createI18n({
locale: "en",
legacy: false,
messages: {
en,
ar,
fr,
},
});
TIP
- i18n
language
is auto stored in the localStorage for further usage. - If you need more info about
i18n
plugin please read its official documentation here.