Skip to content

client: fix i18next config to generate i18n data correctly#511

Open
virusbb001 wants to merge 9 commits intoleanprover-community:mainfrom
virusbb001:fix-client-i18n-config
Open

client: fix i18next config to generate i18n data correctly#511
virusbb001 wants to merge 9 commits intoleanprover-community:mainfrom
virusbb001:fix-client-i18n-config

Conversation

@virusbb001
Copy link
Copy Markdown
Contributor

I tried to create JSON data by running npm run translate in the repository's root directory as per https://github.com/leanprover-community/lean4game/blob/main/doc/translation-interface.md, but instead of being created in client/public/locales/{language}/translation.json as it should have been, it was created as an empty object in client/client/public/locales/{language}/translation.json. This is because when I ran it with npm --workspace client, client/ became the working directory, and the i18next settings were also treated as relative to that directory.

@virusbb001 virusbb001 marked this pull request as draft May 3, 2026 04:07
@virusbb001
Copy link
Copy Markdown
Contributor Author

When regenerating for other languages ​​(such as en and de), some translations were lost. This pull request needs to be corrected.

virusbb001 added 8 commits May 3, 2026 21:35
When I regenerated the translation data, some usable translation data disappeared.
Some data seemed incompatible with the new display, and some data, despite being in use, didn't appear to be detected by i18next-scanner.

Therefore, it became necessary to set this setting to `false`.
@virusbb001
Copy link
Copy Markdown
Contributor Author

virusbb001 commented May 3, 2026

Since keySeparator was set to false, I changed the JSON to the corresponding format.
Also, after updating the translation data, I noticed some unexpected deletions in some keys, so I set removeUnusedKeys to false. I believe it can be safely set back to true after updating the translation data and resolving the warnings generated by i18next-scanner.
For newly created translation data, you can set it to true in the following way:

removeUnusedKeys: function(lng, ns, key) {
  return lng === "ja";
}

I am not familiar with either language, so I have not made any changes that would require changing the values ​​in the translation data.

@virusbb001 virusbb001 marked this pull request as ready for review May 3, 2026 13:31
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.

1 participant