Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature-Request: Support react-i18next useTranslation namespace import #464

Open
mastacheata opened this issue Feb 20, 2025 · 0 comments
Open

Comments

@mastacheata
Copy link

We're using react-18next and the useTranslation hook to import one or more namespaces per code file which are consequentially omitted from the actual translation function-call, but EasyI18n doesn't inspect the useTranslation hook and expects the translation function to always have a fully qualified translation-key.

Would it be possible to grab the namespaces from the useTranslation hook and then inspect the t-calls with those namespaces in memory?

Here's an example:

const { t } = useTranslation(['admin', 'common']);

const translatedText = t('User.FirstName');

The corresponding translation files would be common.js and admin.js with either one containing the

{
  "User": {
    "FirstName": "First Name"
  }
}

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant