2021-10-06 12:21:31 +02:00
|
|
|
import { createI18n } from "vue-i18n/index";
|
2021-09-12 19:23:51 +02:00
|
|
|
import en from "./languages/en";
|
2021-10-13 08:44:31 +02:00
|
|
|
|
2021-09-12 19:23:51 +02:00
|
|
|
const languageList = {
|
2022-01-18 09:50:11 +02:00
|
|
|
"cs-CZ": "Čeština",
|
2021-11-26 10:31:19 +02:00
|
|
|
"zh-HK": "繁體中文 (香港)",
|
|
|
|
"bg-BG": "Български",
|
|
|
|
"de-DE": "Deutsch (Deutschland)",
|
|
|
|
"nl-NL": "Nederlands",
|
|
|
|
"nb-NO": "Norsk",
|
|
|
|
"es-ES": "Español",
|
2022-06-23 13:29:37 +02:00
|
|
|
"eu": "Euskara",
|
2021-11-26 10:31:19 +02:00
|
|
|
"fa": "Farsi",
|
2022-07-26 03:07:38 +02:00
|
|
|
"pt-PT": "Português (Portugal)",
|
2021-11-26 10:31:19 +02:00
|
|
|
"pt-BR": "Português (Brasileiro)",
|
|
|
|
"fr-FR": "Français (France)",
|
|
|
|
"hu": "Magyar",
|
|
|
|
"hr-HR": "Hrvatski",
|
|
|
|
"it-IT": "Italiano (Italian)",
|
|
|
|
"id-ID": "Bahasa Indonesia (Indonesian)",
|
|
|
|
"ja": "日本語",
|
|
|
|
"da-DK": "Danish (Danmark)",
|
|
|
|
"sr": "Српски",
|
2021-12-14 18:59:26 +02:00
|
|
|
"sl-SI": "Slovenščina",
|
2021-11-26 10:31:19 +02:00
|
|
|
"sr-latn": "Srpski",
|
|
|
|
"sv-SE": "Svenska",
|
|
|
|
"tr-TR": "Türkçe",
|
|
|
|
"ko-KR": "한국어",
|
|
|
|
"ru-RU": "Русский",
|
|
|
|
"zh-CN": "简体中文",
|
|
|
|
"pl": "Polski",
|
|
|
|
"et-EE": "eesti",
|
2022-02-06 06:33:04 +02:00
|
|
|
"vi-VN": "Tiếng Việt",
|
2022-03-31 10:24:28 +02:00
|
|
|
"zh-TW": "繁體中文 (台灣)",
|
|
|
|
"uk-UA": "Український",
|
2022-05-19 14:44:59 +02:00
|
|
|
"th-TH": "ไทย",
|
2021-11-26 10:31:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
let messages = {
|
2021-09-12 19:23:51 +02:00
|
|
|
en,
|
|
|
|
};
|
|
|
|
|
2021-11-26 10:31:19 +02:00
|
|
|
for (let lang in languageList) {
|
|
|
|
messages[lang] = {
|
|
|
|
languageName: languageList[lang]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-17 09:27:35 +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-11-26 10:31:19 +02:00
|
|
|
messages: messages,
|
2021-09-12 19:23:51 +02:00
|
|
|
});
|