mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 23:27:09 +00:00
* Added Russian * Updated Russian, removed old «source_enitity», «direct_enitity» * zh-CN: Moved «direct_entity» and «source_entity»
27 lines
630 B
JavaScript
27 lines
630 B
JavaScript
const lngs = [
|
|
['en', 'English'],
|
|
['ru', 'Русский'],
|
|
['zh-CN', '简体中文']
|
|
]
|
|
|
|
lngs.forEach(v => $('#lngList').append(`<a class="dropdown-item" onclick="changeLng('${v[0]}')">${v[1]}</a>`))
|
|
|
|
i18next
|
|
.use(i18nextBrowserLanguageDetector)
|
|
.use(i18nextXHRBackend)
|
|
.init({
|
|
backend: { loadPath: 'locales/{{lng}}.json' },
|
|
fallbackLng: 'en',
|
|
whitelist: lngs.map(v => v[0])
|
|
})
|
|
.then(() => {
|
|
jqueryI18next.init(i18next, $, { parseDefaultValueFromContent: false })
|
|
$('html').localize()
|
|
})
|
|
|
|
function changeLng(code) {
|
|
i18next.changeLanguage(code).then(() => {
|
|
$('html').localize()
|
|
})
|
|
}
|