Joe91 / fun-bots

A highly customizable and configurable bot mod for your Venice Unleashed Battlefield 3 server.
https://discord.gg/zNk3qCzk6x
237 stars 45 forks source link

feat: python script to auto translate language files #238

Closed joao-vitor-souza closed 1 year ago

joao-vitor-souza commented 1 year ago

Running python3 auto_translate.py xx inside the fun-bots/ext/Shared/Languages/auto_translate directory will now create the file xx_XX.lua in fun-bots/ext/Shared/Languages. For example, running python3 auto_translate.py ja wiil create the file ja_JA.lua that looks like this:

local code = 'ja_JA' -- Add/replace the xx_XX here with your language code (like de_DE, en_US, or other)!

--GENERAL
Language:add(code, "Bot Weapon", "ボット武器")
Language:add(code, "Select the weapon the bots use", "ボットが使用する武器を選択します")
Language:add(code, "Bot Kit", "ボットキット")
Language:add(code, "The Kit of the Bots", "ボットのキット")
Language:add(code, "Bot Color", "ボットの色")
Language:add(code, "The Color of the Bots", "ボットの色")
Language:add(code, "Zombie Mode", "ゾンビモード")
Language:add(code, "Zombie Bot Mode", "ゾンビボットモード")
...

This will help you guys with the overall translation, now a person that wants to translate DEFAULT.lua to his language can run this script and then only review the results, there's no need to translate line by line anymore.

Obs: The script needs to parse and translate more than 300 lines, so the process may take some seconds to complete.

Firjens commented 1 year ago

Do not merge to master, merge to dev

Joe91 commented 1 year ago

Wow! Really amazing!! I will try to modify this a little that it also supports the files in the folder "WebUI\languages". Really amazing! Thanks a lot!!

Joe91 commented 1 year ago

Works really amazing!! Do you have some languages you would like to have supported in fun-bots? I just added japanes on the dev-branch.

joao-vitor-souza commented 1 year ago

Works really amazing!! Do you have some languages you would like to have supported in fun-bots?

Portuguese; I'm gonna review pt_PT.lua and make a PR.

Joe91 commented 1 year ago

added it to the current dev-commit. It's really amazing! Please also review pt_PT.js in webUI/languages...