Skip to content

Commit

Permalink
Fix dateFnsLocale for French and Spanish languages for job duration (#…
Browse files Browse the repository at this point in the history
…836)

* fix dateFnsLocale for French and Spanish languages for job duration

* Revert changes and update logic in setDateFnsLocale()
  • Loading branch information
difagume authored Oct 16, 2024
1 parent 463f5e1 commit 21129ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ui/localesSync.config.js
Original file line number Diff line number Diff line change
@@ -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,
};
2 changes: 1 addition & 1 deletion packages/ui/src/components/SettingsModal/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/services/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit 21129ab

Please sign in to comment.