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