To enable i18n support in your application, you need to define all translatable text. The most effective way to do this is by storing the text in an external JSON file. For example:
{
"dashboards": "Dashboards",
"dashboard-one": "Dashboard v.1",
"dashboard-two": "Dashboard v.2"
}
{
"dashboards": "Paneles",
"dashboard-one": "Panel v.1",
"dashboard-two": "Panel v.2"
}
{
"dashboards": "Панели",
"dashboard-one": "Панель v.1",
"dashboard-two": "Панель v.2"
}
Next you need to add html indicators in all place you want to use data-lang
.
<div>
<span data-lang="dashboards"> Dashboards </span>
<span data-lang="dashboard-one"> Dashboard v.1 </span>
<span data-lang="dashboard-two"> Dashboard v.2 </span>
</div>
After that if you want to change the language you just need to add buttons and fire the selectedLanguage
.
<a class="btn btn-light" data-translator-lang="en"> Set EN language</a>
<a class="btn btn-light" data-translator-lang="es"> Set ES language</a>
let selectedLanguage = "en";
Easily configure layout, styles, and preferences for your admin interface.