mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-13 13:22:57 +00:00
useLocalize simply provides i18n t function
This commit is contained in:
1 parent
cbd44102f9
commit
f87ce1ed27
1 file changed
+1
-7
@@ -3,15 +3,9 @@ import { useTranslation } from 'react-i18next';
|
||||
import { i18n2 } from "App";
|
||||
|
||||
export default function useLocalize(nameSpace: string) {
|
||||
const { t, ...translation } = useTranslation(nameSpace,{ i18n: i18n2, useSuspense: false });
|
||||
|
||||
return {
|
||||
oldT,
|
||||
t: (key: string, placeholder = '') => {
|
||||
let str = t(key);
|
||||
return str === key ? placeholder : str;
|
||||
},
|
||||
...translation
|
||||
...useTranslation(nameSpace,{ i18n: i18n2, useSuspense: false })
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user