Fix translation function to access current language content correctly
This commit is contained in:
parent
fb7a6a214c
commit
425bdc3063
@ -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];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user