Skip to content

Conversation

vilanell000
Copy link

I figured out what is going wrong when switching language to Chinese:

  1. The URL expects just zh for Chinese, not zh_Hans
  2. But the translation files are in zh_Hans and zh_Hant directories
  3. The i18n backend tries to load /locales/zh/translation.json but the file is actually at /locales/zh_Hans/translation.json

solutions

I see there are other languages with underscores have same problems.
So, I created symbolic links:

  • Add zh -> zh_Hans symlink for Chinese language support
  • Add nb -> nb_NO symlink for Norwegian language support
  • Add pt-br -> pt_BR symlink for Brazilian Portuguese
  • Add pt-pt -> pt_PT symlink for European Portuguese

Related Issue(s)

#1123

Screenshots after add symlinks:

截屏2025-09-28 上午1 47 49 截屏2025-09-28 上午1 48 00

- Add zh -> zh_Hans symlink for Chinese language support
- Add nb -> nb_NO symlink for Norwegian language support
- Add pt-br -> pt_BR symlink for Brazilian Portuguese
- Add pt-pt -> pt_PT symlink for European Portuguese
@rolandgeider
Copy link
Member

Hi, thanks for the pr! I'm not sure adding symlinks is the right solution here (among other things, I'm not sure how weblate will handle this). It would be cleaner to configure the i18n service to handle this case itself. From a quick glance at the docs it seems it should already do the fallback pt-BR to pt, but perhaps we didn't configure it correctly?

https://www.i18next.com/principles/fallback

@rolandgeider
Copy link
Member

Also note that we also have translations in Django itself, which uses different files etc, so that is also something to consider

@vilanell000
Copy link
Author

Hi, thanks for the pr! I'm not sure adding symlinks is the right solution here (among other things, I'm not sure how weblate will handle this). It would be cleaner to configure the i18n service to handle this case itself. From a quick glance at the docs it seems it should already do the fallback pt-BR to pt, but perhaps we didn't configure it correctly?

https://www.i18next.com/principles/fallback

got it. Thanks for your reply.
Now I'm tring to fix the not showing chinese problem.
I would say something wrong with the maspping because i18next is looking for zh/translation.json, not zh_Hans or zh_Hant.

When switch to chinese simplified, I can see in the console: GET http://localhost:8000/static/react/locales/zh/translation.json 404 (Not Found)

the files exist at: public/locales/zh_Hans/translation.json and public/locales/zh_Hant/translation.json

I've tried add fallback mappings In i18n.ts, but not working.

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 this pull request may close these issues.

2 participants