Wurst7 icon indicating copy to clipboard operation
Wurst7 copied to clipboard

Large translations update: Part 1

Open BlueGradientHorizon opened this issue 1 year 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

[!IMPORTANT]

Review skipped

Auto reviews are limited to specific labels.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Walkthrough

The project has introduced a new Gradle task for generating JSON translation files, enhancing localization support. Significant updates include the introduction of a LocalesGenerator class for managing localization files, refining key bindings, and improving translation handling across various classes. Changes focus on standardizing translation keys, adding fallback mechanisms for missing translations, and updating descriptions to align with new localization standards. This overhaul aims to streamline localization processes and ensure consistency in translations across the application.

Changes

File(s) Summary
build.gradle Added localesGenerate Gradle task for generating JSON translation files.
src/main/java/net/wurstclient/LocalesGenerator.java Introduced to manage localization files, including generation and updates.
src/main/java/net/wurstclient/WurstClient.java,
.../mixin/ControlsListWidgetMixin.java
Updated key bindings and improved translation handling.
src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java,
.../nochatreports/NcrModRequiredScreen.java,
.../other_features/NoChatReportsOtf.java,
.../other_features/TranslationsOtf.java
Updated translation keys to new naming convention for consistency.
src/main/java/net/wurstclient/hack/Hack.java,
.../hacks/*.java
Modified description string generation and updated setting descriptions with new keys.
src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java,
.../settings/*.java
Updated translation keys and descriptions for various settings and warnings.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Mar 10 '24 17:03 coderabbitai[bot]

This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks.

Pull requests should be closed if:

  • They have been superseded by another pull request
  • They are out of scope or don't align with the project
  • They have become obsolete due to other changes
  • They have bugs or conflicts that won't be resolved

github-actions[bot] avatar Jun 04 '24 02:06 github-actions[bot]

I remember this PR. I'll update to the master branch and review my changes in my free time.

BlueGradientHorizon avatar Jun 04 '24 05:06 BlueGradientHorizon

Hey @BlueGradientHorizon, I'm not sure if we already talked about this on the forum, but I want to be clear that I'm not interested in moving away from the type.namespace.path format for translations (i.e. description.wurst.hack.killaura should not become wurst.hack.killaura.description). It's a documented convention that all Minecraft mods are recommended to follow.

Alexander01998 avatar Jun 04 '24 07:06 Alexander01998

This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks.

Pull requests should be closed if:

  • They have been superseded by another pull request
  • They are out of scope or don't align with the project
  • They have become obsolete due to other changes
  • They have bugs or conflicts that won't be resolved

github-actions[bot] avatar Aug 05 '24 02:08 github-actions[bot]