mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 05:53:09 +02:00
良い感じに
This commit is contained in:
parent
4153b0db38
commit
8dc9ec06f8
13 changed files with 16 additions and 13419 deletions
1219
locales/ca.yml
1219
locales/ca.yml
File diff suppressed because it is too large
Load diff
1219
locales/de.yml
1219
locales/de.yml
File diff suppressed because it is too large
Load diff
1219
locales/en.yml
1219
locales/en.yml
File diff suppressed because it is too large
Load diff
1219
locales/es.yml
1219
locales/es.yml
File diff suppressed because it is too large
Load diff
1219
locales/fr.yml
1219
locales/fr.yml
File diff suppressed because it is too large
Load diff
|
@ -11,13 +11,13 @@ const loadLang = lang => yaml.safeLoad(
|
||||||
const native = loadLang('ja-JP');
|
const native = loadLang('ja-JP');
|
||||||
|
|
||||||
const langs = {
|
const langs = {
|
||||||
'de': loadLang('de'),
|
'de-DE': loadLang('de-DE'),
|
||||||
'en': loadLang('en'),
|
'en-US': loadLang('en-US'),
|
||||||
'fr': loadLang('fr'),
|
'fr-FR': loadLang('fr-FR'),
|
||||||
'ja': native,
|
'ja-JP': native,
|
||||||
'ja-KS': loadLang('ja-KS'),
|
'ja-KS': loadLang('ja-KS'),
|
||||||
'pl': loadLang('pl'),
|
'pl-PL': loadLang('pl-PL'),
|
||||||
'es': loadLang('es')
|
'es-ES': loadLang('es-ES')
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.values(langs).forEach(locale => {
|
Object.values(langs).forEach(locale => {
|
||||||
|
|
1219
locales/it.yml
1219
locales/it.yml
File diff suppressed because it is too large
Load diff
1219
locales/ko.yml
1219
locales/ko.yml
File diff suppressed because it is too large
Load diff
1219
locales/pl.yml
1219
locales/pl.yml
File diff suppressed because it is too large
Load diff
1219
locales/pt.yml
1219
locales/pt.yml
File diff suppressed because it is too large
Load diff
1219
locales/ru.yml
1219
locales/ru.yml
File diff suppressed because it is too large
Load diff
1219
locales/zh.yml
1219
locales/zh.yml
File diff suppressed because it is too large
Load diff
|
@ -38,12 +38,18 @@
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Detect the user language
|
//#region Detect the user language
|
||||||
let lang = navigator.language;
|
let lang = null;
|
||||||
|
|
||||||
if (!LANGS.includes(lang)) lang = lang.split('-')[0];
|
if (LANGS.includes(navigator.language)) {
|
||||||
|
lang = navigator.language;
|
||||||
|
} else {
|
||||||
|
lang = LANGS.find(x => x.split('-')[0] == lang);
|
||||||
|
|
||||||
// The default language is English
|
if (lang == null) {
|
||||||
if (!LANGS.includes(lang)) lang = 'en';
|
// Fallback
|
||||||
|
lang = 'en-US';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (settings) {
|
if (settings) {
|
||||||
if (settings.device.lang) lang = settings.device.lang;
|
if (settings.device.lang) lang = settings.device.lang;
|
||||||
|
|
Loading…
Reference in a new issue