From 21129ab5582598dcdd41156de2a367119a50ed7a Mon Sep 17 00:00:00 2001 From: Diego Fabricio Date: Wed, 16 Oct 2024 02:32:36 -0500 Subject: [PATCH] Fix dateFnsLocale for French and Spanish languages for job duration (#836) * fix dateFnsLocale for French and Spanish languages for job duration * Revert changes and update logic in setDateFnsLocale() --- packages/ui/localesSync.config.js | 2 +- packages/ui/src/components/SettingsModal/SettingsModal.tsx | 2 +- packages/ui/src/services/i18n.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/ui/localesSync.config.js b/packages/ui/localesSync.config.js index ff97faf0..7adbe290 100644 --- a/packages/ui/localesSync.config.js +++ b/packages/ui/localesSync.config.js @@ -1,6 +1,6 @@ module.exports = { primaryLanguage: 'en-US', - secondaryLanguages: ['pt-BR', 'fr-FR', 'zh-CN', 'es-ES'], + secondaryLanguages: ['es-ES', 'fr-FR', 'pt-BR', 'zh-CN'], localesFolder: './src/static/locales', spaces: 2, }; diff --git a/packages/ui/src/components/SettingsModal/SettingsModal.tsx b/packages/ui/src/components/SettingsModal/SettingsModal.tsx index e7fdef22..61595406 100644 --- a/packages/ui/src/components/SettingsModal/SettingsModal.tsx +++ b/packages/ui/src/components/SettingsModal/SettingsModal.tsx @@ -15,7 +15,7 @@ export interface SettingsModalProps { } const pollingIntervals = [-1, 3, 5, 10, 20, 60, 60 * 5, 60 * 15]; -const languages = ['en-US', 'fr-FR', 'pt-BR', 'zh-CN', 'es-ES']; +const languages = ['en-US', 'es-ES', 'fr-FR', 'pt-BR', 'zh-CN']; const maxJobsPerPage = 300; export const SettingsModal = ({ open, onClose }: SettingsModalProps) => { diff --git a/packages/ui/src/services/i18n.ts b/packages/ui/src/services/i18n.ts index fd880c3c..d9ec89ce 100644 --- a/packages/ui/src/services/i18n.ts +++ b/packages/ui/src/services/i18n.ts @@ -6,6 +6,8 @@ import { initReactI18next } from 'react-i18next'; export let dateFnsLocale = undefined; async function setDateFnsLocale(lng: string) { + if(lng==='es-ES') lng='es'; + if(lng==='fr-FR') lng='fr'; dateFnsLocale = await import(`date-fns/locale/${lng}/index.js`).catch((e) => console.error(e)); }