Feature: Chinese Localization Enhancement and Pinyin Search Support#317
Draft
BIANG-qilie wants to merge 2 commits intoblushiemagic:1.4.4from
Draft
Feature: Chinese Localization Enhancement and Pinyin Search Support#317BIANG-qilie wants to merge 2 commits intoblushiemagic:1.4.4from
BIANG-qilie wants to merge 2 commits intoblushiemagic:1.4.4from
Conversation
…lified Chinese (#1) * feat(i18n): update Chinese localization for Magic Storage mod * feat(i18n): enhance Chinese localization for Magic Storage mod with new translations and updates * fix(i18n): correct formatting in Chinese localization for Magic Storage mod --------- Co-authored-by: biang <leyobiang@gmail.com>
…t method (#2) * feat(pinyin): Add Pinyin search functionality for Chinese item names - Introduced a new configuration option to enable Pinyin search in `MagicStorageConfig.cs`. - Implemented Pinyin search logic in `StorageViewControls.cs`, allowing users to search item names using full Pinyin or initials. - Added a new utility class `PinyinHelper.cs` for handling Pinyin conversion and caching. - Updated project references to include `NPinyin.Core` for Pinyin processing. - Enhanced localization files to support new Pinyin search feature in both English and Simplified Chinese. - Documented the feature in a new markdown file for clarity on usage and implementation. * refactor(auditing, shimmering): Update Utils references to use Terraria.Utils - Changed references from Utils to Terraria.Utils for coin splitting and clamping in AuditEntry.cs and ShimmerResultReports.cs. - Improved code clarity and consistency by ensuring the correct namespace is used for utility functions. * feat(pinyin): Integrate NPinyin.Core for enhanced Pinyin search functionality - Added support for loading NPinyin.Core.dll as an embedded resource to enable Pinyin search capabilities. - Implemented logic to delay JIT compilation of the ConvertToPinyin method until NPinyin.Core is fully loaded. - Enhanced PinyinHelper to utilize reflection for method invocation, ensuring compatibility and avoiding direct dependencies. - Updated localization files to include options for enabling Pinyin search in multiple languages. - Introduced checks to ensure Pinyin search is only active in a Simplified Chinese environment. * refactor(pinyin): Simplify method retrieval and enhance error handling in PinyinHelper - Introduced GetMethodsSafely and FindMethod utility functions to streamline method retrieval and improve error handling. - Updated PinyinHelper to utilize these new methods, reducing code complexity and enhancing maintainability. - Added comments for clarity on the purpose and functionality of the new methods. * refactor(pinyin): Update comments and documentation for clarity in PinyinHelper and MagicStorageMod * refactor(pinyin): Remove debug logging for Pinyin search feature in MagicStorageMod * feat(pinyin): Remove Pinyin search documentation file --------- Co-authored-by: biang <leyobiang@gmail.com>
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.
Summary
This PR introduces two major enhancements for Chinese users: comprehensive Simplified Chinese localization improvements and a new Pinyin search feature that allows users to search items using Pinyin input methods.
Changes
1. Chinese Localization Enhancement (8a2ccb5)
Localization/zh-Hans.hjsonwith 333 additions and 331 deletions, representing a comprehensive review and improvement of existing translations2. Pinyin Search Feature (fd6db47)
EnablePinyinSearchoption in mod configuration, allowing users to enable/disable the featureConcurrentDictionaryfor cachingNPinyin.Core.dllas an embedded resourcePreJITFilterto delay JIT compilation until NPinyin is loadedPinyinHelperutility class with robust error handling3. Additional Improvements
Utils→Terraria.Utils) inAuditEntry.csandShimmerResultReports.csTechnical Details
Files Changed
Common/Utils/PinyinHelper.cs(new, 405 lines): Core Pinyin search utility classMagicStorageMod.cs: Added NPinyin assembly loading logicMagicStorageConfig.cs: AddedEnablePinyinSearchconfiguration optionCommon/Threading/Refreshing/StorageViewControls.cs: Integrated Pinyin search into item filteringCheckModBuildVersionBeforeJIT.cs: Added JIT filter for Pinyin functionalityLocalization/zh-Hans.hjson: Comprehensive translation improvementsLocalization/*.hjson: Added Pinyin search configuration text in all supported languagesMagicStorage.csproj: Added NPinyin.Core.dll as embedded resourceKey Features
ConcurrentDictionaryand double-checked locking patternTesting
Breaking Changes
None. This is a purely additive feature that maintains backward compatibility.
Note: This PR combines two related features that enhance the experience for Chinese users. The localization improvements provide better translation quality, while the Pinyin search feature adds a convenient way to search items using Pinyin input methods commonly used by Chinese users.