Fix translation function to access current language content correctly

This commit is contained in:
michi 2025-06-24 15:49:33 +02:00
parent fb7a6a214c
commit 425bdc3063

View File

@ -51,10 +51,12 @@ export const LanguageProvider = ({ children }: LanguageProviderProps) => {
fetchSiteConfig(lang);
}
};
const t = (key: string): string => {
const currentLangTranslations = translations[currentLanguage];
if (!currentLangTranslations) return key;
const keys = key.split('.');
let value = translations;
let value = currentLangTranslations;
for (const k of keys) {
value = value?.[k];