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

i18next integration fails to fetch some translations due to how resources are loaded on update #3305

Closed
perebusquets opened this issue Jan 31, 2024 · 0 comments · Fixed by #3304
Assignees

Comments

@perebusquets
Copy link
Contributor

Hi, I'm opening this issue to discuss the fact that, for some reason, the i18next-tolgee adapter is failing to load some translations.

After some debugging, I figured out the issue was here:

        tolgee.getAllRecords().forEach(({ language, namespace, data }) => {
            if (i18n.getResourceBundle(language, namespace)) {
                i18n.removeResourceBundle(language, namespace);
                i18n.addResources(language, namespace, Object.fromEntries(data));
            }
        });

and it spats out the following error:
image

I'm not sure why only some translations fail (maybe a race condition on the side of i18next due to eliminating and recreating them one after the other?).

Anyway, looking at the i18next documentation, I saw that there's the addResourceBundle function for adding/overwriting resources, so with the changes proposed in this PR it works like a charm.

#3304

Please let me know if I can help with anything to accelerate solving this issue, and thank you for your awesome platform! ;)

@stepan662 stepan662 linked a pull request Jan 31, 2024 that will close this issue
stepan662 pushed a commit that referenced this issue Jan 31, 2024
PR to solve some translations missing in i18next-tolgee adapter. More
details in the following issue:
#3305
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

Successfully merging a pull request may close this issue.

2 participants