-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
i18n error when adding new languages #200
Comments
How many languages do you use? I use "fr, en" and never ran into this so far. Haven't tried to reproduce it yet. |
@Vadorequest 20 languages, this started happening recently, it was not happening before. |
Suspense was disabled on the NRN Locize implementation, I don't think it's related. Seems to be related to a misconfiguration of your Locize project somehow. |
Ok the problem is because I changed how locize fetch languages from: const i18nTranslations: I18nextResources = await fetchTranslations(lang); // ie: fr to: const i18nTranslations: I18nextResources = await fetchTranslations(locale); // ie: fr-FR The reason is because I need to fetch translations and their variations like: |
Did you find a solution? I didn't play around with i18n variations with Locize, I haven't much experience with those. But I'm advising against that design, because I believe Locize provide a much better way of dealing with language variations (which handles native fallback values), but I don't remember how. You should check their doc. 😄 |
I already have It's not about design, it's about the languages I need to support. I thought it would work without any problem considering that it's just a different language. I will check the docs, thanks! |
Then the error message seems to point out those languages don't have a |
Seems like I was wrong about two things:
You might want to check how the fallback works: https://www.i18next.com/principles/fallback |
What do you mean? As far as I know i18next support variation as any other language. |
I can see that the translations are being fetched and returned properly from Locize, so in fact it's not a problem with Locize. |
I think the problem is a misconfig using And all others locales work just fine, just variations like (es-ES, es-CO, fr-FR) generates the problem. |
Any feedback here @Vadorequest ? |
Yeah, yeah, I meant I was wrong about I don't have the time to debug this at the moment, buried under many other things. |
Ok, could you label this issue as a bug to be fixed? I don't have time right now but if find any I can take a look. I think this is critical considering that language variations is very common. |
@samuelcastro I've found the root cause of this issue. It's simply because the
next-right-now/src/utils/nextjs/SSG.ts Line 137 in 30d83e9
I guess my first implementation didn't consider providing a I found out this by reviewing the documentation, I wasn't specifically working on this issue. I'll need to review this, and make sure it doesn't create non-backward compatible change. (it shouldn't) |
Maybe providing a locale instead of a lang wouldn't automatically fallback from the locale to the lang. Meaning, if a translation isn't defined in If that's the case, then we should either:
|
Yeah I knew this was the issue, I just didn't have time to find where it was being misused, see: #200 (comment) Glad you found it. :)
I'll try that today.
It sounds like a reasonable approach. |
Actually it seems I tested this already see: #200 (comment) |
Alright, then I guess it didn't work because Locize wasn't called twice, but only once (with the variant) instead of variant + base. But that doesn't actually sound related to the original issue. No more idea then, I'll have to take a look myself and see what's wrong. I think I'll implement a proper fallback for the language when doing that. |
There is an issue when adding new languages that I believe is related to react suspense. See i18next/react-i18next#977
Error:
Steps to reproduce:
Are you able to reproduce it as well?
The text was updated successfully, but these errors were encountered: