Skip to content
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

Make language files uniform #704

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

moritz-reinel
Copy link
Contributor

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 as lang-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.

Copy link
Collaborator

@AnErrupTion AnErrupTion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moritz-reinel I like the idea, but I feel like a Python script would be much, much more readable while still being accessible to all contributors. Python is quite universal these days, so I wouldn't see this as a problem.

@moritz-reinel
Copy link
Contributor Author

@AnErrupTion Re-added the python version and did some refactoring. PR would be ready to merge from my side.

Although, thinking more about it, would it be possible/make sense to do that as some "build step" that can be triggered manually?
Would keep the tools needed to zig and not introduce anything.

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