mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
24 lines
601 B
JavaScript
24 lines
601 B
JavaScript
import enMessages from 'lang-compiled/en.json';
|
|
import zhCNMessages from 'lang-compiled/zh-CN.json';
|
|
import { format } from 'date-fns';
|
|
import { enUS, zhCN } from 'date-fns/locale';
|
|
|
|
export const messages = {
|
|
en: enMessages,
|
|
'zh-CN': zhCNMessages,
|
|
};
|
|
|
|
export const dateLocales = {
|
|
en: enUS,
|
|
'zh-CN': zhCN,
|
|
};
|
|
|
|
export const menuOptions = [
|
|
{ label: 'English', value: 'en', display: 'EN' },
|
|
{ label: '中文 (Chinese Simplified)', value: 'zh-CN', display: '中文' },
|
|
];
|
|
|
|
export function dateFormat(date, str, locale) {
|
|
return format(date, str, { locale: dateLocales[locale] || enUS });
|
|
}
|