umami/lib/lang.js

101 lines
2.9 KiB
JavaScript
Raw Normal View History

2020-10-03 20:45:19 +02:00
import {
arSA,
2022-08-02 02:14:36 +02:00
bn,
2020-10-22 19:36:08 +02:00
cs,
2021-03-15 22:25:43 +01:00
sk,
2020-10-22 19:36:08 +02:00
da,
2020-10-03 20:45:19 +02:00
de,
2020-10-22 19:36:08 +02:00
el,
enUS,
enGB,
2020-10-03 20:45:19 +02:00
es,
2020-10-22 19:36:08 +02:00
fi,
2020-10-03 20:45:19 +02:00
fr,
2021-03-13 07:30:26 +01:00
faIR,
2020-12-04 12:13:18 +01:00
he,
hi,
2022-11-13 06:03:47 +01:00
hr,
2020-10-22 19:36:08 +02:00
id,
2020-12-12 10:10:58 +01:00
it,
2020-10-22 19:36:08 +02:00
ja,
2021-07-23 04:16:21 +02:00
ko,
lt,
2021-05-17 07:04:40 +02:00
mn,
2021-03-27 04:52:54 +01:00
ms,
2020-10-22 19:36:08 +02:00
nb,
nl,
2020-11-07 02:30:21 +01:00
pl,
2020-10-03 20:45:19 +02:00
pt,
ptBR,
2020-10-03 20:45:19 +02:00
ro,
2020-10-22 19:36:08 +02:00
ru,
2021-08-20 10:09:04 +02:00
sl,
2020-10-22 19:36:08 +02:00
sv,
2020-11-25 09:32:34 +01:00
ta,
2022-08-02 02:14:36 +02:00
th,
2020-10-22 19:36:08 +02:00
tr,
2020-10-03 20:45:19 +02:00
uk,
2020-10-22 19:36:08 +02:00
zhCN,
zhTW,
2021-05-20 00:40:03 +02:00
ca,
2021-06-29 06:11:12 +02:00
hu,
2021-11-22 07:38:11 +01:00
vi,
si,
2020-10-03 20:45:19 +02:00
} from 'date-fns/locale';
2020-09-08 04:48:40 +02:00
export const languages = {
2021-11-05 01:09:03 +01:00
'ar-SA': { label: 'العربية', dateLocale: arSA, dir: 'rtl' },
2022-08-02 02:14:36 +02:00
'bn-BD': { label: 'বাংলা', dateLocale: bn },
2021-11-05 01:09:03 +01:00
'zh-CN': { label: '中文', dateLocale: zhCN },
'zh-TW': { label: '中文(繁體)', dateLocale: zhTW },
'ca-ES': { label: 'Català', dateLocale: ca },
'cs-CZ': { label: 'Čeština', dateLocale: cs },
'da-DK': { label: 'Dansk', dateLocale: da },
'de-DE': { label: 'Deutsch', dateLocale: de },
'en-US': { label: 'English (US)', dateLocale: enUS },
'en-GB': { label: 'English (UK)', dateLocale: enGB },
'es-MX': { label: 'Español', dateLocale: es },
'fa-IR': { label: 'فارسی', dateLocale: faIR, dir: 'rtl' },
'fo-FO': { label: 'Føroyskt' },
'fr-FR': { label: 'Français', dateLocale: fr },
2022-06-27 05:56:24 +02:00
'ga-ES': { label: 'Galacian (Spain)', dateLocale: es },
2021-11-05 01:09:03 +01:00
'el-GR': { label: 'Ελληνικά', dateLocale: el },
'he-IL': { label: 'עברית', dateLocale: he },
'hi-IN': { label: 'हिन्दी', dateLocale: hi },
'hu-HU': { label: 'Hungarian', dateLocale: hu },
2022-11-13 06:03:47 +01:00
'hr-HR': { label: 'hrvatski', dateLocale: hr },
2021-11-05 01:09:03 +01:00
'it-IT': { label: 'Italiano', dateLocale: it },
'id-ID': { label: 'Bahasa Indonesia', dateLocale: id },
'ja-JP': { label: '日本語', dateLocale: ja },
'ko-KR': { label: '한국어', dateLocale: ko },
'lt-LT': { label: 'Lietuvių', dateLocale: lt },
2021-11-05 01:09:03 +01:00
'ms-MY': { label: 'Malay', dateLocale: ms },
'mn-MN': { label: 'Монгол', dateLocale: mn },
'nl-NL': { label: 'Nederlands', dateLocale: nl },
'nb-NO': { label: 'Norsk Bokmål', dateLocale: nb },
'pl-PL': { label: 'Polski', dateLocale: pl },
'pt-PT': { label: 'Português', dateLocale: pt },
'pt-BR': { label: 'Português do Brasil', dateLocale: ptBR },
'ru-RU': { label: 'Русский', dateLocale: ru },
'ro-RO': { label: 'Română', dateLocale: ro },
'sk-SK': { label: 'Slovenčina', dateLocale: sk },
'sl-SI': { label: 'Slovenščina', dateLocale: sl },
'fi-FI': { label: 'Suomi', dateLocale: fi },
'sv-SE': { label: 'Svenska', dateLocale: sv },
'ta-IN': { label: 'தமிழ்', dateLocale: ta },
'si-LK': { label: 'සිංහල', dateLocale: si },
2022-08-02 02:14:36 +02:00
'th-TH': { label: 'ภาษาไทย', dateLocale: th },
2021-11-05 01:09:03 +01:00
'tr-TR': { label: 'Türkçe', dateLocale: tr },
'uk-UA': { label: 'українська', dateLocale: uk },
'ur-PK': { label: 'Urdu (Pakistan)', dateLocale: uk, dir: 'rtl' },
2021-11-22 07:38:11 +01:00
'vi-VN': { label: 'Tiếng Việt', dateLocale: vi },
2020-09-08 04:48:40 +02:00
};
2021-11-21 02:18:25 +01:00
export function getDateLocale(locale) {
return languages[locale]?.dateLocale || enUS;
}
export function getTextDirection(locale) {
return languages[locale]?.dir || 'ltr';
}