2020-09-10 01:12:29 +02:00
|
|
|
import { format } from 'date-fns';
|
2020-09-21 20:26:13 +02:00
|
|
|
import { enUS, nl, zhCN, tr, ru, de, ja, es, fr, da, sv, el } from 'date-fns/locale';
|
2020-09-12 12:49:31 +02:00
|
|
|
import enMessages from 'lang-compiled/en-US.json';
|
2020-09-08 10:59:56 +02:00
|
|
|
import nlMessages from 'lang-compiled/nl-NL.json';
|
2020-09-08 04:48:40 +02:00
|
|
|
import zhCNMessages from 'lang-compiled/zh-CN.json';
|
2020-09-08 23:01:26 +02:00
|
|
|
import trTRMessages from 'lang-compiled/tr-TR.json';
|
2020-09-09 17:13:27 +02:00
|
|
|
import ruRUMessages from 'lang-compiled/ru-RU.json';
|
2020-09-09 19:24:55 +02:00
|
|
|
import deDEMessages from 'lang-compiled/de-DE.json';
|
2020-09-12 05:49:41 +02:00
|
|
|
import jaMessages from 'lang-compiled/ja-JP.json';
|
2020-09-13 02:11:31 +02:00
|
|
|
import esMXMessages from 'lang-compiled/es-MX.json';
|
2020-09-14 18:56:22 +02:00
|
|
|
import frMessages from 'lang-compiled/fr-FR.json';
|
2020-09-14 12:31:15 +02:00
|
|
|
import mnMNMessages from 'lang-compiled/mn-MN.json';
|
2020-09-19 19:50:08 +02:00
|
|
|
import daMessages from 'lang-compiled/da-DK.json';
|
2020-09-20 20:38:37 +02:00
|
|
|
import svMessages from 'lang-compiled/sv-SE.json';
|
2020-09-21 20:26:13 +02:00
|
|
|
import grMessages from 'lang-compiled/el-GR.json';
|
2020-09-24 09:11:58 +02:00
|
|
|
import foMessages from 'lang-compiled/fo-FO.json';
|
2020-09-08 04:48:40 +02:00
|
|
|
|
|
|
|
export const messages = {
|
2020-09-13 10:26:54 +02:00
|
|
|
'en-US': enMessages,
|
2020-09-08 10:35:24 +02:00
|
|
|
'nl-NL': nlMessages,
|
2020-09-08 04:48:40 +02:00
|
|
|
'zh-CN': zhCNMessages,
|
2020-09-09 19:24:55 +02:00
|
|
|
'de-DE': deDEMessages,
|
2020-09-09 17:13:27 +02:00
|
|
|
'ru-RU': ruRUMessages,
|
2020-09-08 23:01:26 +02:00
|
|
|
'tr-TR': trTRMessages,
|
2020-09-12 05:49:41 +02:00
|
|
|
'ja-JP': jaMessages,
|
2020-09-13 02:11:31 +02:00
|
|
|
'es-MX': esMXMessages,
|
2020-09-14 18:56:22 +02:00
|
|
|
'fr-FR': frMessages,
|
2020-09-14 12:31:15 +02:00
|
|
|
'mn-MN': mnMNMessages,
|
2020-09-19 19:50:08 +02:00
|
|
|
'da-DK': daMessages,
|
2020-09-20 20:38:37 +02:00
|
|
|
'sv-SE': svMessages,
|
2020-09-21 20:26:13 +02:00
|
|
|
'el-GR': grMessages,
|
2020-09-24 09:11:58 +02:00
|
|
|
'fo-FO': foMessages,
|
2020-09-08 04:48:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export const dateLocales = {
|
2020-09-13 10:26:54 +02:00
|
|
|
'en-US': enUS,
|
2020-09-08 10:35:24 +02:00
|
|
|
'nl-NL': nl,
|
2020-09-08 04:48:40 +02:00
|
|
|
'zh-CN': zhCN,
|
2020-09-09 19:24:55 +02:00
|
|
|
'de-DE': de,
|
2020-09-19 19:50:08 +02:00
|
|
|
'da-DK': da,
|
2020-09-09 17:13:27 +02:00
|
|
|
'ru-RU': ru,
|
2020-09-20 20:38:37 +02:00
|
|
|
'sv-SE': sv,
|
2020-09-08 23:01:26 +02:00
|
|
|
'tr-TR': tr,
|
2020-09-12 05:49:41 +02:00
|
|
|
'ja-JP': ja,
|
2020-09-13 02:11:31 +02:00
|
|
|
'es-MX': es,
|
2020-09-14 18:56:22 +02:00
|
|
|
'fr-FR': fr,
|
2020-09-14 12:31:15 +02:00
|
|
|
'mn-MN': enUS,
|
2020-09-21 20:26:13 +02:00
|
|
|
'el-GR': el,
|
2020-09-24 09:11:58 +02:00
|
|
|
'fo-FO': da,
|
2020-09-08 04:48:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export const menuOptions = [
|
2020-09-21 06:31:53 +02:00
|
|
|
{ label: 'English', value: 'en-US', display: 'en' },
|
|
|
|
{ label: '中文', value: 'zh-CN', display: 'cn' },
|
|
|
|
{ label: 'Dansk', value: 'da-DK', display: 'da' },
|
|
|
|
{ label: 'Deutsch', value: 'de-DE', display: 'de' },
|
|
|
|
{ label: 'Español', value: 'es-MX', display: 'es' },
|
2020-09-25 05:20:24 +02:00
|
|
|
{ label: 'Føroyskt', value: 'fo-FO', display: 'fo' },
|
2020-09-21 06:31:53 +02:00
|
|
|
{ label: 'Français', value: 'fr-FR', display: 'fr' },
|
2020-09-21 20:26:13 +02:00
|
|
|
{ label: 'Ελληνικά', value: 'el-GR', display: 'el' },
|
2020-09-21 06:31:53 +02:00
|
|
|
{ label: '日本語', value: 'ja-JP', display: 'ja' },
|
|
|
|
{ label: 'Монгол', value: 'mn-MN', display: 'mn' },
|
|
|
|
{ label: 'Nederlands', value: 'nl-NL', display: 'nl' },
|
|
|
|
{ label: 'Русский', value: 'ru-RU', display: 'ru' },
|
|
|
|
{ label: 'Svenska', value: 'sv-SE', display: 'sv' },
|
2020-09-25 05:20:24 +02:00
|
|
|
{ label: 'Türkçe', value: 'tr-TR', display: 'tr' },
|
2020-09-08 04:48:40 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
export function dateFormat(date, str, locale) {
|
|
|
|
return format(date, str, { locale: dateLocales[locale] || enUS });
|
|
|
|
}
|