-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Current method we need to add namespaces for each t.
According Refine docs, https://refine.dev/core/docs/i18n/i18n-provider/#translate
const { translate } = useTranslation();
translate("posts.fields.title", { ns: "resources" }, "Title");But i18next support directly load with useTranslation hook - https://react.i18next.com/latest/usetranslation-hook#loading-namespaces
// load a specific namespace
// the t function will be set to that namespace as default
const { t, i18n } = useTranslation('ns1');
t('key'); // will be looked up from namespace ns1
// load multiple namespaces
// the t function will be set to first namespace as default
const { t, i18n } = useTranslation(['ns1', 'ns2', 'ns3']);
t('key'); // will be looked up from namespace ns1This method will reduce boilerplate codes.
Describe alternatives you've considered
No response
Additional context
No response
Describe the thing to improve
I believe useTranslation and useTranslate get namespaces input as array or string like i18next package provide. Then directly give to options. Current method can not give namespaces as input.
| export const useTranslation = () => { |
| export const useTranslate = () => { |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request