uptime-kuma/src/i18n.js

76 lines
2 KiB
JavaScript
Raw Normal View History

import { createI18n } from "vue-i18n/dist/vue-i18n.esm-browser.prod.js";
2022-12-27 02:11:53 -08:00
import en from "./lang/en.json";
2021-10-12 23:44:31 -07:00
const languageList = {
"ar-SY": "العربية",
2022-01-17 23:50:11 -08:00
"cs-CZ": "Čeština",
2021-11-26 00:31:19 -08:00
"zh-HK": "繁體中文 (香港)",
"bg-BG": "Български",
"de-DE": "Deutsch (Deutschland)",
"de-CH": "Deutsch (Schweiz)",
2021-11-26 00:31:19 -08:00
"nl-NL": "Nederlands",
"nb-NO": "Norsk",
"es-ES": "Español",
2022-06-23 04:29:37 -07:00
"eu": "Euskara",
2021-11-26 00:31:19 -08:00
"fa": "Farsi",
2022-07-25 18:07:38 -07:00
"pt-PT": "Português (Portugal)",
2021-11-26 00:31:19 -08:00
"pt-BR": "Português (Brasileiro)",
"fi": "Suomi",
2021-11-26 00:31:19 -08:00
"fr-FR": "Français (France)",
2023-02-28 09:45:35 -08:00
"he-IL": "עברית",
2021-11-26 00:31:19 -08:00
"hu": "Magyar",
"hr-HR": "Hrvatski",
"it-IT": "Italiano (Italian)",
"id-ID": "Bahasa Indonesia (Indonesian)",
"ja": "日本語",
"da-DK": "Danish (Danmark)",
"sr": "Српски",
"sl-SI": "Slovenščina",
2021-11-26 00:31:19 -08:00
"sr-latn": "Srpski",
"sv-SE": "Svenska",
"tr-TR": "Türkçe",
"ko-KR": "한국어",
"ru-RU": "Русский",
"zh-CN": "简体中文",
"pl": "Polski",
"et-EE": "eesti",
"vi-VN": "Tiếng Việt",
2022-03-31 01:24:28 -07:00
"zh-TW": "繁體中文 (台灣)",
2023-03-04 10:49:47 -08:00
"uk-UA": "Українська",
2022-05-19 05:44:59 -07:00
"th-TH": "ไทย",
2022-10-07 01:55:12 -07:00
"el-GR": "Ελληνικά",
2023-01-24 09:58:12 -08:00
"yue": "繁體中文 (廣東話 / 粵語)",
2023-02-05 23:21:31 -08:00
"ro": "Limba română",
"ur": "Urdu",
"ge": "ქართული"
2021-11-26 00:31:19 -08:00
};
let messages = {
en,
};
2021-11-26 00:31:19 -08:00
for (let lang in languageList) {
messages[lang] = {
languageName: languageList[lang]
};
}
const rtlLangs = [ "fa", "ar-SY", "ur" ];
2021-10-04 14:33:52 -07:00
2021-10-07 08:59:15 -07:00
export const currentLocale = () => localStorage.locale
|| languageList[navigator.language] && navigator.language
|| languageList[navigator.language.substring(0, 2)] && navigator.language.substring(0, 2)
|| "en";
export const localeDirection = () => {
2021-10-04 14:33:52 -07:00
return rtlLangs.includes(currentLocale()) ? "rtl" : "ltr";
};
export const i18n = createI18n({
locale: currentLocale(),
fallbackLocale: "en",
silentFallbackWarn: true,
2021-10-04 14:33:52 -07:00
silentTranslationWarn: true,
2021-11-26 00:31:19 -08:00
messages: messages,
});