Resources To Initialize With
This is the most basic example to demonstrate direct language switching on click or change event. Just Pass resources to initialize with and every time the link is clicked i18next loads the translation text without page reload.
Translation Text
At ourselves direction believing do he departure. Celebrated her had sentiments understood are projection set. Possession ye no mr unaffected remarkably at. Wrote house in never fruit up. Pasture imagine my garrets an he. However distant she request behaved see nothing. Talking settled at pleased an of me brother weather.
Example Markup
<div aria-labelledby="dropdown-flag" class="dropdown-menu dropdown-menu-right">
<a href="#" class="dropdown-item">
<i class="flag-icon flag-icon-gb"></i> English
</a>
<a href="#" class="dropdown-item">
<i class="flag-icon flag-icon-es"></i> Spanish
</a>
<a href="#" class="dropdown-item">
<i class="flag-icon flag-icon-pt"></i> Portuguese
</a>
<a href="#" class="dropdown-item">
<i class="flag-icon flag-icon-fr"></i> French
</a>
</div>
Js Code For Switching
i18next.init({
resources: {
en: {
translation: {
key: "At ourselves direction..."
}
},
es: {
translation: {
key: "A nosotros mismos la dirección..."
}
},
pt: {
translation: {
key: "Em nós mesmos..."
}
},
fr: {
translation: {
key: "À nous-mêmes la direction..."
}
}
},
debug: true,
fallbackLng: false
}, function(err, t) {
// Initialize Localization
jqueryI18next.init(i18next, $);
});