-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Support namespaces per project in monorepo #890
Comments
Is there a reason you don't simply use the namespace everywhere? It would be more verbose but consistent and should work with the parser. |
Yeah this was a conscious decision to avoid doing |
🚀 Feature Proposal
True namespace detection through static function call analysis, or through allowing easy project-specific config.
See example below for what I would like to achieve.
Either adding functionality to detect the namespace specified in the 'wrapping' hook, or allow some config to be added to specify that the hook being used in any given package has a certain default namespace, other than the usual config.
Motivation
Please outline the motivation for the proposal.
I have multiple projects in a monorepo, which use their own namespace to split translations, but share a common one too. They also import from each other.
I want to avoid duplication and enforce consistency by providing a
useTranslation
hook per project.Example
Some component-library component
And in some app component:
This all works correctly, and helps us enforce using the correct namespace in each part of the app.
However, the
parser
is not aware that they are using the namespaces used within the project-specificuseTranslation
hooks.Is this something that would even be feasible with how the parser works currently?
Workaround
My idea for a workaround would just be to customise the config for every package, and specify a different default namespace.
For example,
and then run that script multiple times:
i18next -c i18next.admin.config.js && i18next -c i18next.webapp.config.js &&...
The text was updated successfully, but these errors were encountered: