Skip to content

Commit

Permalink
Update available locales list
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Ray committed Aug 17, 2024
1 parent 53ab42e commit 4f66e77
Showing 1 changed file with 37 additions and 15 deletions.
52 changes: 37 additions & 15 deletions apps/app/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,59 @@ import {
es,
ptBR,
Locale as DateFnsLocale,
pt,
hi,
hy,
nb,
pl,
tr,
zhCN,
} from 'date-fns/locale'

export type Locale = 'en' | 'fr' | 'ru' | 'de' | 'es' | 'pt_br'

export const translations = {
en: require('./locales/en.json'),
fr: require('./locales/fr.json'),
ru: require('./locales/ru.json'),
const translations = {
de: require('./locales/de.json'),
en: require('./locales/en.json'),
es: require('./locales/es.json'),
fr: require('./locales/fr.json'),
hi: require('./locales/hi.json'),
hy: require('./locales/hy.json'),
nb_NO: require('./locales/nb_NO.json'),
pl: require('./locales/pl.json'),
pt_br: require('./locales/pt_br.json'),
ru: require('./locales/ru.json'),
tr: require('./locales/tr.json'),
zh_Hans: require('./locales/zh_Hans.json'),
}

/** We can only load font available in Inter */
export const translationsLanguages = {
en: 'English',
fr: 'Français',
ru: 'Русский',
de: 'Deutsch',
en: 'English',
es: 'Español',
fr: 'Français',
// hi: 'हिन्दी',
// hy: 'Հայերեն',
nb_NO: 'Bokmål',
pl: 'Polski',
pt_br: 'Português brasileiro',
ru: 'Русский',
tr: 'Türkçe',
// zh_Hans: '简体字',
}

export const getDateFnsLocale = (locale: Locale) => {
const localeToDateFnsLocale: Record<Locale, DateFnsLocale> = {
en: enUS,
fr: fr,
ru: ru,
export const getDateFnsLocale = (locale: string) => {
const localeToDateFnsLocale: Record<string, DateFnsLocale> = {
de: de,
en: enUS,
es: es,
fr: fr,
hi: hi,
hy: hy,
nb_NO: nb,
pl: pl,
pt_br: ptBR,
ru: ru,
tr: tr,
zh_Hans: zhCN,
}

return localeToDateFnsLocale[locale] ?? enUS
Expand Down

0 comments on commit 4f66e77

Please sign in to comment.