-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Convert locale files from ini to json format #35489
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Very good choice. |
By the way, you also need to fix
|
We should eventually remove all HTML from translations which will solve this. There are always ways to interpolate translation into templates without having HTML in the translation itself. |
The "eventually has been years, many "eventually" things have been years. |
I believe switching to TOML would be preferable, as existing translations can be easily converted to the TOML format, Nor will you see a screen full of |
Still I think JSON is a big step forward over INI. It has clear and well-known escaping rules, and any mistake will be found by any JSON parser (which should run on the CI, and this is trivial to add). |
Yes, any well-defined format is a big step. Still think it should clean up the legacy HTML quotes before migrating, to make the code base clean and avoid low-level mistakes. |
One drawback of JSON format is that it does not support adding comments. |
Agree, that's also a problem. |
YAML has comments. Does crowdin support it? Thought I see no pressing need to comment translations. |
Support, and also support TOML format. |
ref: #32937 |
Why do we need comments for translation keys? Currently, almost none of the existing translations include comments. Although JSON has it's drawback, but the format is parsed well by all kinds of languages and platforms like crowdin, weblate and others. I have a plan to replace all |
So how do you plan to replace the HTML tags? |
TOML is also a possible choice but it seems weblate haven't support it. A drawback of the YAML format is that incorrect indentation can easily lead to invalid or unintended keys. i.e.
|
If we need to switch to another translation platform in the future, we should consider using a more widely compatible file format. If this requirement does not exist, I currently recommend using the TOML format. |
JSON is widely supported, ensuring we are not locked into any specific platform. JSON i18next is a standalone standard. ref: https://www.i18next.com/ |
I think JSON is a good choice. TOML and YAML are both more much complex specs. I think the downside of having to escape |
As a next step, we can consider converting to the i18next JSON format, which allows using placeholders like {name} instead of the current %[1]s syntax.
All original ini files have been converted with
go run ./tools/convert_locale_ini_json.go