mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 03:45:10 +00:00
cc47041519
* feat: load multiple languages dynamically * fix: map locale * fix: antd * fix: locale * fix: th * fix: cronstrue locales * fix: improve code * fix: defaults
10 lines
268 B
TypeScript
10 lines
268 B
TypeScript
export const getAntdLocale = (lang) => {
|
|
const lng = lang.replace('-', '_');
|
|
try {
|
|
require.resolve(`antd/lib/locale/${lng}`);
|
|
return require(`antd/lib/locale/${lng}`).default;
|
|
} catch (error) {
|
|
return require(`antd/lib/locale/en_US`).default;
|
|
}
|
|
};
|