Wurst7
Wurst7 copied to clipboard
Large translations update: Part 1
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 stringDEFAULT_LCin classLocalesGenerator.Settings, then the fully qualified name of this string will benet.wurstclient.LocalesGenerator.Settings.DEFAULT_LC, and not theDEFAULT_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.javaThis 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). -
localesGenerateGradle task I've written alocalesGenerateGradle task which will be run every Wurst build aftercompileJava, but beforeprocessResourcesto keep locale files always synchronized when implementing new hacks/features/other functions and translations to them. -
Small addings in
TranslationsOtf.javaAddedFallback to Englishcheckbox 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
[!IMPORTANT]
Review skipped
Auto reviews are limited to specific labels.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein 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?
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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto 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.yamlfile 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.
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
I remember this PR. I'll update to the master branch and review my changes in my free time.
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.
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