BraindanceProtocol icon indicating copy to clipboard operation
BraindanceProtocol copied to clipboard

Need help with translation

Open Nats-ji opened this issue 3 years ago • 9 comments

~~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 avatar Jan 25 '21 09:01 Nats-ji

I did my part, added danish translation. Merged it into your branch: https://github.com/WolvenKit/BraindanceProtocol/pull/56

vp-en avatar Jan 26 '21 17:01 vp-en

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

Thank you.

Nats-ji avatar Jan 27 '21 14:01 Nats-ji

https://github.com/WolvenKit/BraindanceProtocol/pull/60#issuecomment-769188772

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)

Nats-ji avatar Jan 28 '21 19:01 Nats-ji

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.

vp-en avatar Jan 28 '21 21:01 vp-en

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}

Nats-ji avatar Jan 28 '21 21:01 Nats-ji

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.

vp-en avatar Jan 28 '21 22:01 vp-en

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 https://github.com/WolvenKit/BraindanceProtocol/pull/67

Nats-ji avatar Jan 29 '21 10:01 Nats-ji

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.

vp-en avatar Jan 29 '21 10:01 vp-en

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

Nats-ji avatar Jan 29 '21 11:01 Nats-ji