TrevorBarns / luxart-vehicle-control

A siren / (non-els) emergency lights controller for FiveM.
https://www.luxartengineering.com/
GNU General Public License v3.0
135 stars 56 forks source link

Multiple language support #57

Open dhauer opened 2 years ago

dhauer commented 2 years ago

Hello all!

Is there any interest here to support multiple languages? I have to manually convert translations every time I update. I could very well imagine working here, as in many other scripts, with an extra 'locales' folder and existing locale files for each supported language.

If such support is desired, then I would be willing to implement this conversion and create a pull request for later review.

Best regards Dustin

TrevorBarns commented 2 years ago

Great idea! I have started implementing a locale system from QBCore. Once finished I will push a commit, feel free to PR additional locale / languages to support as I will likely only be providing a base english option.

Beware though, LVC has many many (dare I say many again) strings..

dhauer commented 2 years ago

Perfect! Then I'll wait for your commit and extend that with another language (in that case that would be German).

But I have one more question. Do you implement all the used parts of QBCore in this script or will there be a dependency to QBCore? Because for me as an ESX user the latter would not be really good. Then I would have to implement a workaround.

"Beware though, LVC has many many (dare I say many again) strings.." I already noticed this painfully when installing it on the server. I have to maintain this also currently with every update.

TrevorBarns commented 2 years ago

Because QBCore is a GNU licensed open-source project, I am "borrowing" (with due copyright given) the small piece of code that manages locales. It will be included with the standard download and will not require any dependancies or have any conflicts with other frameworks.

TrevorBarns commented 2 years ago

https://github.com/TrevorBarns/luxart-vehicle-control/commit/d7f2b77c943166bd42df9d35f39c50c0ee8cdda1 Added locale support: \UI\locale\en.lua contains translations, %{variable} indicates the script is replacing that portion with info, do not remove these, however they can be moved. The language is set in fxmanifest.luam

There are a ton of strings, feedback is welcome :)

dhauer commented 2 years ago

Overall everything looks wonderful! I just created a pull request with a new language and a small typo correction for the English translation: https://github.com/TrevorBarns/luxart-vehicle-control/pull/60

TrevorBarns commented 2 years ago

Just realized I added all the plugins to support translation, but when committing I must have override my progress, so plugins are still messed up.

dhauer commented 2 years ago

Another thing: You wrote that I can select the language in the fxmanifest.lua file (probably by implementing the file), but there is nothing related to translations.

TrevorBarns commented 2 years ago

Fixed https://github.com/TrevorBarns/luxart-vehicle-control/commit/14ea34ff7e125edc454bb9e3a3eac7e13f04fcf5