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:
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.
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:
and it spats out the following error:
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.https://github.com/tolgee/tolgee-js/pull/3304
Please let me know if I can help with anything to accelerate solving this issue, and thank you for your awesome platform! ;)