mirror of
https://github.com/suitenumerique/meet.git
synced 2026-09-01 05:07:56 +00:00
a20a0a6b38
Add Spanish to the language selection system on both trees, with 872 frontend phrases and 145 backend ones translated from the French source. The frontend to backend language map gains it too, so a Spanish browser does not write an empty language to the account on every load.
30 lines
705 B
TypeScript
30 lines
705 B
TypeScript
import { useTranslation } from 'react-i18next'
|
|
|
|
const languageLabels: Record<string, string> = {
|
|
en: 'English',
|
|
fr: 'Français',
|
|
de: 'Deutsch',
|
|
nl: 'Nederlands',
|
|
es: 'Español',
|
|
}
|
|
|
|
export const useLanguageLabels = () => {
|
|
const { i18n } = useTranslation()
|
|
// cimode is a testing value from i18next, don't include it
|
|
const supportedLanguages = (i18n.options.supportedLngs || []).filter(
|
|
(lang) => lang !== 'cimode'
|
|
)
|
|
const languagesList = supportedLanguages.map((lang) => ({
|
|
key: lang,
|
|
value: lang,
|
|
label: languageLabels[lang],
|
|
}))
|
|
return {
|
|
languagesList,
|
|
currentLanguage: {
|
|
key: i18n.language,
|
|
label: languageLabels[i18n.language],
|
|
},
|
|
}
|
|
}
|