Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
During implementation of #703, I noticed that the language files were a bit inconsistent. Some had empty lines for missing translations, others didn't do that.
To make this a bit more uniform, I wrote a script (and applied it) to the current state of lang files.
Implementation
At first it looks for all the possible "language items" in
Lang.zig
. Then it goes through each .ini file and saves all the key-value pairs into an array. Finally, the script loops through the items found in Lang.zig again and puts it aslang-item = <value-found-in-current-file>
or<empty line>
, overriding the current lang file.Also I sorted the language items in ASCII order, as it was a bit inconsistent between Lang.zig and the lang files.
PS: At first I made the script in Python. Afterwards, I decided to opt for bash instead, as it should be more available to people using/contributing to ly. (Korn shell wasn't an option unfortunately, as it doesn't support associative arrays)
Result
With that change, a translator can open Lang.zig and his desired language.ini side by side, then look at empty lines and by matching the line number get the key from Lang.zig and add the translation.
Also after adding a new "language item" (like err_sleep), the script should be run.