fix(gantt): correctly import languages from dayjs
continuous-integration/drone/push Build is failing Details

Resolves https://community.vikunja.io/t/error-in-gannt-with-spanish-language/1973/3
This commit is contained in:
kolaente 2024-02-05 21:57:21 +01:00
parent 45f5d522d1
commit 5b2a9a42c0
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,7 @@ export const SUPPORTED_LOCALES = {
'hu-HU': 'Magyar',
'ar-SA': 'اَلْعَرَبِيَّةُ',
'sl-SI': 'Slovenščina',
// IMPORTANT: Also add new languages to useDayjsLanguageSync
} as const
export type SupportedLocale = keyof typeof SUPPORTED_LOCALES

View File

@ -15,6 +15,13 @@ export const DAYJS_LOCALE_MAPPING = {
'nl-nl': 'nl',
'pt-pt': 'pt',
'zh-cn': 'zh-cn',
'no-NO': 'nn',
'es-ES': 'es',
'da-DK': 'da',
'ja-JP': 'ja',
'hu-HU': 'hu',
'ar-SA': 'ar-sa',
'sl-SI': 'sl',
} as Record<SupportedLocale, ISOLanguage>
export const DAYJS_LANGUAGE_IMPORTS = {
@ -29,6 +36,13 @@ export const DAYJS_LANGUAGE_IMPORTS = {
'nl-nl': () => import('dayjs/locale/nl'),
'pt-pt': () => import('dayjs/locale/pt'),
'zh-cn': () => import('dayjs/locale/zh-cn'),
'no-no': () => import('dayjs/locale/nn'),
'es-es': () => import('dayjs/locale/es'),
'da-dk': () => import('dayjs/locale/da'),
'ja-jp': () => import('dayjs/locale/ja'),
'hu-hu': () => import('dayjs/locale/hu'),
'ar-sa': () => import('dayjs/locale/ar-sa'),
'sl-si': () => import('dayjs/locale/sl'),
} as Record<SupportedLocale, () => Promise<ILocale>>
export function useDayjsLanguageSync(dayjsGlobal: typeof dayjs) {