diff --git a/src/components/services/providers/language/LanguageProvider.tsx b/src/components/services/providers/language/LanguageProvider.tsx index 4e19587..2f42ae6 100644 --- a/src/components/services/providers/language/LanguageProvider.tsx +++ b/src/components/services/providers/language/LanguageProvider.tsx @@ -9,6 +9,8 @@ export type LanguageProviderProps = { language: Language children: ReactNode } +type Messages = { [messageKey: string]: string | string[] } +type LanguageDictionary = { [languageKey: string]: Messages } export const LanguageProvider: React.FC = ({ language, @@ -17,9 +19,7 @@ export const LanguageProvider: React.FC = ({ const [currentLanguage, setCurrentLanguage] = useState(language) const changeLanguage = (language: Language) => setCurrentLanguage(language) - const dictionary: { - [languageKey: string]: { [messageKey: string]: string } - } = { en, de } + const dictionary: LanguageDictionary = { en, de, } const getMessage = (messageKey: string) => { const message = dictionary[currentLanguage][messageKey]