Wurst7 icon indicating copy to clipboard operation
Wurst7 copied to clipboard

Large translations update: Part 1

Open BlueGradientHorizon opened this issue 3 months ago • 4 comments

Description

I've noticed what Wurst have "Translations" feature, but actually the only translated values were hacks descriptions, altmanager and nochatreports strings. Almost all hack settings names and descriptions are hardcoded. I want to change it. I want move out all currently hardcoded strings into locale files to be able to fully translate Wurst for me and for future contrubutors. But it is not a trivial work. I've divided this task into 2 parts. This PR is part 1. And this is what I already did:

  • Translation keys naming scheme change I've find it illogical to name descriptions for hacks as description.wurst.hack.<HackName>. Let's take my PR changes as an example. If we want to get string DEFAULT_LC in class LocalesGenerator.Settings, then the fully qualified name of this string will be net.wurstclient.LocalesGenerator.Settings.DEFAULT_LC, and not the DEFAULT_LC.net.wurstclient.LocalesGenerator.Settings. The same is applicable to hacks settings translation key names (ArrowDMG, AutoEat, InvWalk). I really hope you get me right.

  • LocalesGenerator.java This is standalone program, which tracks changes in default locale file (en_us.json) and synchronizes them among all other locale files. Specifically: (1) adds new JSON keys with default values to locale files if they were added to default locale; (2) preserves same key-value pairs sequence and same empty line positions as default locale file has; (3) moves any unknown keys to the end of locale file (with 3 empty lines indentation).

  • localesGenerate Gradle task I've written a localesGenerate Gradle task which will be run every Wurst build after compileJava, but before processResources to keep locale files always synchronized when implementing new hacks/features/other functions and translations to them.

  • Small addings in TranslationsOtf.java Added Fallback to English checkbox just to get more control about translation handling.

Second part of translations update PR will include:

  • moving out all hardcoded values to locale files
  • code changes if needed
  • full Russian translation
  • adapting and including into my PR all current PRs about locales addings or translation updates, if you'll allow

Testing

~~So far,~~ it's working as intended.

References

WurstForum discussion

BlueGradientHorizon avatar Mar 10 '24 17:03 BlueGradientHorizon