diff --git a/src/i18n/index.ts b/src/i18n/index.ts index cc9c2a6e..01ffb1e0 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -88,6 +88,10 @@ export const getSupportedLanguages = (): Array => { export const formatLanguageLabel = (language: string) => displayName(language, undefined, "language")?.toUpperCase(); -type LocalizedString = Record & { de: string }; -export const getLocalizedText = (text: LocalizedString, language: string): string => - text[language] || text.de; +export const getLocalizedText = ( + text: Record, + language: string = i18n.language, +): string => { + const baseLanguage = language.split('-')[0]; + return text[baseLanguage] || text[FALLBACK_LANGUAGE] || ''; +};