Merged
Conversation
Closed
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances localization support in HMCL by introducing improved Chinese language variants handling and font management capabilities.
- Adds environment variable
HMCL_LANGUAGEfor launcher language configuration - Implements
LocalizedTextclass for handling multilingual text content with JSON serialization - Introduces sophisticated locale candidate resolution with enhanced Chinese variants support
- Implements locale-aware font loading system
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| LocaleUtilsTest.java | Comprehensive test suite for locale utilities and Chinese variant handling |
| LocalizedText.java | New class for managing localized text with JSON adapter support |
| LocaleUtils.java | Core utility class for locale operations and Chinese language detection |
| DefaultResourceBundleControl.java | Enhanced resource bundle control with optimized Chinese locale resolution |
| LocalesTest.java | Test file removal (replaced by LocaleUtilsTest.java) |
| MinecraftWiki.java | Updated to use new LocaleUtils methods for Chinese variant detection |
| Locales.java | Refactored to use new locale utilities and added localized resource finding |
| I18n.java | Simplified by delegating to new locale utilities |
| FontManager.java | Enhanced with locale-aware font loading capabilities |
| HMCLGameLauncher.java | Updated Chinese locale handling for Minecraft options |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Comment on lines
+54
to
+56
| return null; | ||
| } else | ||
| return value; |
There was a problem hiding this comment.
The getText method returns null when no localized value is found, but this could lead to null pointer exceptions. Consider returning an empty string or the first available value as a fallback instead.
Suggested change
| return null; | |
| } else | |
| return value; | |
| // Fallback: return the first available value if present | |
| if (!localizedValues.isEmpty()) { | |
| return localizedValues.values().iterator().next(); | |
| } | |
| // If map is empty, return empty string | |
| return ""; | |
| } else { | |
| return value != null ? value : ""; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HMCL_LANGUAGE用于设置启动器语言;LocalizedText