Complete Localization System with Simplified Chinese Support#18
Open
iRyougi wants to merge 4 commits intoteutinsa:masterfrom
Open
Complete Localization System with Simplified Chinese Support#18iRyougi wants to merge 4 commits intoteutinsa:masterfrom
iRyougi wants to merge 4 commits intoteutinsa:masterfrom
Conversation
在 `App.xaml.cs` 中初始化 `LocalizationService` 和 `SettingsService`,以支持本地化和设置管理。 在 `SettingsService.cs` 中添加 `Language` 属性以获取和设置当前语言。 在 `DashboardPageViewModel.cs` 和 `MainViewModel.cs` 中引入本地化服务,更新界面文本以支持动态语言切换。 在 `SettingsPageViewModel.cs` 中添加本地化标签,允许用户选择语言。 将 `DashboardPageView.xaml` 和 `SettingsPageView.xaml` 中的硬编码文本替换为数据绑定。 新增 `LocalizationService`、`LocalizationConverter` 和 `LocalizeExtension`,以管理语言文件和支持 XAML 绑定。 创建语言文件(如 `en.json` 和 `zh-cn.json`),并更新文档以提供本地化系统的使用指南和实现细节。
Owner
|
I'm not entirely sure if and how I'll integrate this. I see nothing wrong with this, but I did pan on not having any more major updates, which this feature would be, until 2.0. |
Author
Anyway, I have added a lot of new functions in my fork (not just localization). If you are interested in joining your version, I will be happy to help. |
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.
Overview
This PR introduces a comprehensive localization system to Helldivers 2 Mod Manager, enabling multi-language support with instant language switching. The initial implementation includes full English (en) and Simplified Chinese (zh-cn) translations for the entire core UI.
Motivation
Key Features
1. Localization Service Architecture
LocalizationServicemanaging all translations2. Settings Integration
settings.jsonLanguages/folder3. Complete UI Localization
Files Changed
New Files Added (5)
Helldivers2ModManager/Services/LocalizationService.csHelldivers2ModManager/Converters/LocalizationConverter.csHelldivers2ModManager/Extensions/LocalizeExtension.cs{loc:Localize Key}syntax (planned)Languages/en.json(auto-generated)Languages/zh-cn.json(auto-generated)Modified Files (7)
Helldivers2ModManager/Services/SettingsService.csHelldivers2ModManager/App.xaml.csHelldivers2ModManager/ViewModels/MainViewModel.csHelldivers2ModManager/ViewModels/DashboardPageViewModel.csHelldivers2ModManager/ViewModels/SettingsPageViewModel.csHelldivers2ModManager/Views/DashboardPageView.xamlHelldivers2ModManager/Views/SettingsPageView.xamlTechnical Architecture
Data Flow
Design Patterns Used
Translation Access Pattern
Translation Coverage
English (en.json)
{ "Window.Title": "Mod Manager", "Dashboard.Add": "Add", "Dashboard.Settings": "Settings", "Dashboard.Purge": "Purge", "Dashboard.Deploy": "Deploy", "Dashboard.LaunchHD2": "Launch HD2", // ... 76 more keys }Simplified Chinese (zh-cn.json)
{ "Window.Title": "模组管理器", "Dashboard.Add": "添加", "Dashboard.Settings": "设置", "Dashboard.Purge": "清理", "Dashboard.Deploy": "部署", "Dashboard.LaunchHD2": "启动游戏", // ... 76 more keys (100% complete) }Translation Key Categories
Testing Performed
Manual Test Cases
Language Switching on Dashboard
Language Switching on Settings
Language Persistence
Tooltips Localization
Window Title Dynamic Update
Missing Translation Handling
[KeyName]with warning logInvalid Language File
Performance Testing
Before & After Comparison
Before (English Only)
After (Chinese Supported)
User Experience Improvements
Instant Language Switching
Community-Friendly
Developer-Friendly
How to Add New Languages
Community members can easily add support for their language:
Step 1: Create Language File
Step 2: Translate Values
{ "Dashboard.Add": "追加", // Japanese "Dashboard.Settings": "設定", // ... translate all values, keep keys unchanged }Step 3: Test
Popular Language Codes
ja- Japanese (日本語)ko- Korean ()fr- French (Franais)de- German (Deutsch)es- Spanish (Espaol)ru- Russian (Русский)pt-br- Portuguese Brazil (Português)it- Italian (Italiano)Design Decisions & Rationale
Why JSON over RESX
Why Singleton Service
Why Property-Based over Markup Extension
Future Enhancements (Optional)
Short Term
Long Term
<TextBlock Text="{loc:Localize Dashboard.Add}" />Breaking Changes
NONE - This is a pure feature addition with zero breaking changes.
Backward Compatibility
Code Quality
Static Analysis
Best Practices Applied
Logging
Documentation
This PR includes comprehensive documentation (7 files):
完整汉化测试指南.md (Chinese)
汉化快速参考.md (Chinese)
Checklist
Contribution Impact
For Users
For Developers
For Project
Acknowledgments
This implementation prioritizes:
Visual Proof
Settings Page - Language Selector
Dashboard - Chinese
Related Issues
This PR addresses the need for internationalization and localization as discussed in the community.
Closes: #[issue-number-if-exists]
Questions & Discussion
If you have any questions about:
Please feel free to comment on this PR. I'm happy to provide clarifications or make adjustments based on your feedback.
Summary
This PR adds a complete, production-ready localization system with 100% coverage of core UI in English and Simplified Chinese. The system is: