Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Need help with translation #53

Open
Nats-ji opened this issue Jan 25, 2021 · 9 comments
Open

Need help with translation #53

Nats-ji opened this issue Jan 25, 2021 · 9 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Nats-ji
Copy link
Collaborator

Nats-ji commented Jan 25, 2021

Include i18n.lua library for multi-language support, since CET 1.9 now allow user to change font to show utf8 characters.

  • Need to have languages in separate files. (e.g. en.lua, cn.lua, de.lua ...)
  • A language list file for the GUI to add more languages without needing to edit the init.lua (similar to protocols.lua)
  • Save user language setting into a config.json file

i18n has been implemented in the i18-support branch.

i18n has been merged into the main branch. Please PR your translations.
Here is a guide on how to add a new language and update existing language files.

@Nats-ji Nats-ji added enhancement New feature or request help wanted Extra attention is needed labels Jan 25, 2021
@Nats-ji Nats-ji self-assigned this Jan 25, 2021
@Nats-ji Nats-ji mentioned this issue Jan 26, 2021
@Nats-ji Nats-ji changed the title Add multi-language support. Need help with translation Jan 26, 2021
@ghost
Copy link

ghost commented Jan 26, 2021

I did my part, added danish translation. Merged it into your branch: #56

@Nats-ji
Copy link
Collaborator Author

Nats-ji commented Jan 27, 2021

I did my part, added danish translation. Merged it into your branch: #56

Thank you.

@osulli osulli added documentation Improvements or additions to documentation good first issue Good for newcomers labels Jan 28, 2021
@Nats-ji
Copy link
Collaborator Author

Nats-ji commented Jan 28, 2021

#60 (comment)

I added a button in the language menu for updating the existing language files.
You need to add { "debug": true } in config.json for it to show up.
Imgur

This is how it works:

  1. It will scan init.lua for strings inside i18n("some_string"), and strings from protocols.lua.
  2. Then it will read and compare with the old language files.
  3. If the translation of this string exists in the old language files, it will copy it over.
  4. If the translation doesn't exist in the old language files, but exists in en.lua, it will copy it over from en.lua and comment it.
  5. Else it will leave it blank and comment. (e.g. -- window_title = "")
  6. Save into a new file with "_update" as the suffix. (e.g. en_update.lua)

@ghost
Copy link

ghost commented Jan 28, 2021

So, after merging my new-features-v2 branch, the menu is empty. Probably because of missing strings I suppose.
Adding the debug = true in config.json doesn't seem to work for me at least.
The menu won't load, if I add debug = true in config.json. It loads fine with the default value {"lang":"en"}, but the menu is just empty.

@Nats-ji
Copy link
Collaborator Author

Nats-ji commented Jan 28, 2021

So, after merging my new-features-v2 branch, the menu is empty. Probably because of missing strings I suppose.

I don't think protocols.lua got merged properly. #63

The menu won't load, if I add debug = true in config.json. It loads fine with the default value {"lang":"en"}, but the menu is just empty.

Actually, it should be "debug" : true, I confused the json format with lua table.

{"lang":"en", "debug":true}

@ghost
Copy link

ghost commented Jan 28, 2021

Ah, damn. That's my bad, I totally overlooked the item_, _name, _tip and _btn.

I'll not be able to fix it for now, since I'm going to bed. Will fix it whenever tomorrow hopefully.

@Nats-ji Nats-ji pinned this issue Jan 29, 2021
@Nats-ji
Copy link
Collaborator Author

Nats-ji commented Jan 29, 2021

Ah, damn. That's my bad, I totally overlooked the item_, _name, _tip and _btn.

I'll not be able to fix it for now, since I'm going to bed. Will fix it whenever tomorrow hopefully.

Don't worry. I fixed it #67

@ghost
Copy link

ghost commented Jan 29, 2021

Haha god damnit, I just fixed all that haha. It should be easily mergeable
Nevermind, I'll just remove my PR lol. It's essentially the same.

@Nats-ji
Copy link
Collaborator Author

Nats-ji commented Jan 29, 2021

oop, sorry. Didn't know you were already working on that. I wrote a script for this before, so I thought I'll do it and save you some trouble. xD

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants