uptime-kuma/src/i18n.js

78 lines
2 KiB
JavaScript
Raw Normal View History

import { createI18n } from "vue-i18n/index";
import daDK from "./languages/da-DK";
import deDE from "./languages/de-DE";
import en from "./languages/en";
import esEs from "./languages/es-ES";
import etEE from "./languages/et-EE";
2021-10-04 21:33:52 +00:00
import fa from "./languages/fa";
import frFR from "./languages/fr-FR";
2021-10-03 21:15:34 +00:00
import hu from "./languages/hu";
2021-10-28 14:07:14 +00:00
import hrHR from "./languages/hr-HR";
import itIT from "./languages/it-IT";
2021-10-12 19:57:36 +00:00
import idID from "./languages/id-ID";
import ja from "./languages/ja";
import koKR from "./languages/ko-KR";
import nlNL from "./languages/nl-NL";
2021-10-10 16:38:15 +00:00
import nbNO from "./languages/nb-NO";
import pl from "./languages/pl";
import ptBR from "./languages/pt-BR";
import bgBG from "./languages/bg-BG";
import ruRU from "./languages/ru-RU";
import sr from "./languages/sr";
import srLatn from "./languages/sr-latn";
import svSE from "./languages/sv-SE";
import trTR from "./languages/tr-TR";
2021-10-13 06:44:31 +00:00
import vi from "./languages/vi";
import zhCN from "./languages/zh-CN";
import zhHK from "./languages/zh-HK";
2021-10-29 07:44:33 +00:00
import zhTW from "./languages/zh-TW";
2021-10-13 06:44:31 +00:00
const languageList = {
en,
"zh-HK": zhHK,
2021-09-28 20:21:59 +00:00
"bg-BG": bgBG,
"de-DE": deDE,
"nl-NL": nlNL,
2021-10-10 16:38:15 +00:00
"nb-NO": nbNO,
"es-ES": esEs,
"fa": fa,
"pt-BR": ptBR,
"fr-FR": frFR,
2021-10-03 21:15:34 +00:00
"hu": hu,
2021-10-28 14:07:14 +00:00
"hr-HR": hrHR,
"it-IT": itIT,
2021-10-12 19:58:09 +00:00
"id-ID" : idID,
"ja": ja,
"da-DK": daDK,
"sr": sr,
"sr-latn": srLatn,
"sv-SE": svSE,
2021-09-14 23:55:04 +00:00
"tr-TR": trTR,
"ko-KR": koKR,
"ru-RU": ruRU,
"zh-CN": zhCN,
"pl": pl,
"et-EE": etEE,
2021-10-13 06:44:31 +00:00
"vi": vi,
2021-10-29 07:44:33 +00:00
"zh-TW": zhTW
};
const rtlLangs = ["fa"];
2021-10-04 21:33:52 +00:00
2021-10-07 15:59:15 +00: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 21:33:52 +00:00
return rtlLangs.includes(currentLocale()) ? "rtl" : "ltr";
};
export const i18n = createI18n({
locale: currentLocale(),
fallbackLocale: "en",
silentFallbackWarn: true,
2021-10-04 21:33:52 +00:00
silentTranslationWarn: true,
messages: languageList,
});