Skip to content

Commit

Permalink
Fixed object translation not working properly when passing lng options
Browse files Browse the repository at this point in the history
  • Loading branch information
dlymonkai committed Nov 22, 2024
1 parent 5258aa1 commit 611aace
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/common/src/hooks/useObjectTranslation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ export function useObjectTranslation(
options?: UseTranslationOptions<any>,
): UseObjectTranslationResult {
const { i18n } = useTranslation(ns, options);
const language = options?.lng ? options.lng : i18n.language;
const tObj = useCallback(
(obj: TranslationObject) => {
return obj[getLanguage(i18n.language)] ?? 'translation-not-found';
return obj[getLanguage(language)] ?? 'translation-not-found';
},
[i18n.language],
);
Expand Down

0 comments on commit 611aace

Please sign in to comment.