Add full language extraction and integrate with CI workflow#51
Open
Q2297045667 wants to merge 13 commits into
Open
Add full language extraction and integrate with CI workflow#51Q2297045667 wants to merge 13 commits into
Q2297045667 wants to merge 13 commits into
Conversation
Localization
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 adds full multi-language translation extraction, Fabric i18n support, CI/CD, code quality improvements,
Changes
1. Extract all languages (
Translations.kt)en_us.jsonvia classpathLanguageManager+ResourceManagerMinecraft.getInstance().getLanguageManager().getLanguages()to discover every available languageResourceManager.getResourceStack()(has full assets — the dev-mapped jar only shipsen_us)pumpkin_extractor_output/lang/<code>_java.jsontranslations.jsonrecords a summary array of all extracted language codesen_usonly (the sole lang file on the data-only classpath)2. Fabric i18n (
Lang.kt+ language files)Lang.kt— loads the mod's ownen_us.jsonat runtime, exposesLang.fmt(key, args...)withString.formatsemantics. All log strings are defined in the lang file as the single source of truth.en_us.json/zh_cn.json— 16 translation keys each, covering mod metadata and every log messagefabric.mod.json—nameanddescriptionnow reference translation keys; Fabric Loader resolves them per the player's locale3. CI/CD (
.github/workflows/build.yml)pushandpull_requesttomasterextractor-build4. Code quality (
Extractor.kt)modIDfield andLoggerimportFileWriterswitched to Kotlin.use {}for auto-closecompanion object OUTPUT_DIRFiles.createDirectories(out.parent)try/catch(Throwable)prevents silent fatal failureserrorinstead ofinfoFile overview
.github/workflows/build.ymlLang.ktassets/extractor/lang/en_us.jsonassets/extractor/lang/zh_cn.jsonExtractor.kt.use {}, defensive error handlingTranslations.ktfabric.mod.jsonREADME.mdOutput structure
.