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

react-i18next shared to Module federation apps #1622

Closed
el-j opened this issue Mar 7, 2023 · 3 comments
Closed

react-i18next shared to Module federation apps #1622

el-j opened this issue Mar 7, 2023 · 3 comments
Labels

Comments

@el-j
Copy link

el-j commented Mar 7, 2023

hi, i am struggling with a sharing problem.
i have a module federation app (lerna nx). with a structure like:

| -- library
| -- apps
       | --- containerApp (main menu + nav)
       | --- remoteApp (content in containerApp)
       | --- remoteApp2 (content in containerApp)
      ....

the i18n instance lives in the library and should work shared to the remoteApps. The ContainerApp has the language switch button.

so now i tried to use i18nProviders in the remoteApp and the containerApp to pass the instance from the library.
all the translations get loaded, so this is nice, but a language change does only render and translate the containerApp, not
the remoteApps....

i also tried this approach with no luck
#787
and using it as external always complains about missing react in react-i18next
#788
so no luck...

any idea how i can have this working?

the example provided for a library does not work for me, as my apps are not nested in each others folder structure like here:
https://github.com/i18next/react-i18next/tree/master/example/react-component-lib

currently i do a complete reload of the page on language change...but its very uncomfortable...

Originally posted by @el-j in #788 (comment)

@adrai
Copy link
Member

adrai commented Mar 7, 2023

Please provide a minimal reproducible repository.

@jamuhl
Copy link
Member

jamuhl commented Mar 7, 2023

my guess...you have two versions of react-i18next bundled...one with the container app one with the remote app -> make sure only one instance of react-i18next is bundled

@stale
Copy link

stale bot commented Mar 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 18, 2023
@stale stale bot closed this as completed Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants