Skip to content

Commit

Permalink
修复自动切换语言的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Feb 7, 2024
1 parent 635ae69 commit 93b350f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
10 changes: 2 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
## Changelog
- Add mod release workflow
- clean code
- fix config typo
- update Fabric version
- fix switch lang issue

## Changelog
- 添加 mod release workflow
- 代码清理
- 修复config拼写错误
- 升级Fabric版本
- 修复自动切换语言的问题
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import top.vmctcn.vmtranslationupdate.util.*;

import java.nio.file.Files;
import java.util.Locale;
import java.util.Random;
import java.util.concurrent.CompletableFuture;

Expand All @@ -26,8 +25,8 @@ public class VMTranslationUpdate {
private static final boolean isStenographerLoaded = Platform.isModLoaded("stenographer"); // Stenographer 兼容

public static void init() {
if (ModConfigUtil.getConfig().autoSwitchLanguage && !isStenographerLoaded) {
client.options.language = (Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry()).toLowerCase();
if (ModConfigUtil.getConfig().autoSwitchLanguage && !isStenographerLoaded && ModConfigUtil.getConfig().switchLanguage != null) {
client.options.language = ModConfigUtil.getConfig().switchLanguage;
}

if (ModConfigUtil.getConfig().autoDownloadVMTranslationPack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class ModConfigs implements ConfigData {
public boolean autoInstallVMTranslationPack = true;
public boolean displayTips = true;
public boolean playerNameCheck = true;
public String switchLanguage = "zh_cn";
public String modPackTranslationUpdateCheckUrl = "https://vmct-cn.top/modpacks/example/update.txt";
public String modPackTranslationUrl = "https://vmct-cn.top/modpacks/example/";
public String tipsUrl = "https://vmct-cn.top/tips.txt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"vmtranslationupdate.message.pack": "VM Chinese Update auto enable localization failed! Please enable \"%s\" pack manually in \"Options -> Resource Packs\".",

"text.autoconfig.vmtranslationupdate.title": "VM Translation Update Config",
"text.autoconfig.vmtranslationupdate.option.autoSwitchLanguage": "Auto switch languages by region",
"text.autoconfig.vmtranslationupdate.option.autoSwitchLanguage": "Auto switch language",
"text.autoconfig.vmtranslationupdate.option.checkModPackTranslationUpdate": "Auto-detect modpack translation version update",
"text.autoconfig.vmtranslationupdate.option.autoDownloadVMTranslationPack": "Automatically download VM Chinese Resource pack",
"text.autoconfig.vmtranslationupdate.option.autoInstallVMTranslationPack": "Automatically install the VM Chinese Resource pack",
"text.autoconfig.vmtranslationupdate.option.displayTips": "Display knowledge",
"text.autoconfig.vmtranslationupdate.option.playerNameCheck": "Detecting player name",
"text.autoconfig.vmtranslationupdate.option.switchLanguage": "Switch language to",
"text.autoconfig.vmtranslationupdate.option.modPackTranslationUpdateCheckUrl": "Update link",
"text.autoconfig.vmtranslationupdate.option.modPackTranslationUrl": "Download link",
"text.autoconfig.vmtranslationupdate.option.tipsUrl": "Get knowledge link",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"vmtranslationupdate.message.pack": "VM汉化更新自动启用汉化失败!请在 “选项 -> 资源包” 中手动启用 “%s” 资源包",

"text.autoconfig.vmtranslationupdate.title": "VM汉化更新检测配置",
"text.autoconfig.vmtranslationupdate.option.autoSwitchLanguage": "自动根据地区切换语言",
"text.autoconfig.vmtranslationupdate.option.autoSwitchLanguage": "自动切换语言",
"text.autoconfig.vmtranslationupdate.option.checkModPackTranslationUpdate": "自动检测整合包版本更新",
"text.autoconfig.vmtranslationupdate.option.autoDownloadVMTranslationPack": "自动下载VM汉化资源包",
"text.autoconfig.vmtranslationupdate.option.autoInstallVMTranslationPack": "自动安装VM汉化资源包",
"text.autoconfig.vmtranslationupdate.option.displayTips": "显示知识内容",
"text.autoconfig.vmtranslationupdate.option.playerNameCheck": "检测玩家名称",
"text.autoconfig.vmtranslationupdate.option.switchLanguage": "切换语言为",
"text.autoconfig.vmtranslationupdate.option.modPackTranslationUpdateCheckUrl": "更新检测链接",
"text.autoconfig.vmtranslationupdate.option.modPackTranslationUrl": "下载链接",
"text.autoconfig.vmtranslationupdate.option.tipsUrl": "获取知识内容的链接",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"vmtranslationupdate.message.pack": "VM漢化更新自動啟用漢化失敗!請在 「選項 -> 資源包」 中手動啟用 「%s」 資源包",

"text.autoconfig.vmtranslationupdate.title": "VM漢化更新檢測配寘",
"text.autoconfig.vmtranslationupdate.option.autoSwitchLanguage": "自動根據地區切換語言",
"text.autoconfig.vmtranslationupdate.option.autoSwitchLanguage": "自動切換語言",
"text.autoconfig.vmtranslationupdate.option.checkModPackTranslationUpdate": "自動檢測整合包版本更新",
"text.autoconfig.vmtranslationupdate.option.autoDownloadVMTranslationPack": "自動下載VM漢化資源包",
"text.autoconfig.vmtranslationupdate.option.autoInstallVMTranslationPack": "自動安裝VM漢化資源包",
"text.autoconfig.vmtranslationupdate.option.displayTips": "顯示知識內容",
"text.autoconfig.vmtranslationupdate.option.playerNameCheck": "檢測玩家名稱",
"text.autoconfig.vmtranslationupdate.option.switchLanguage": "切換語言为",
"text.autoconfig.vmtranslationupdate.option.modPackTranslationUpdateCheckUrl": "更新檢測鏈接",
"text.autoconfig.vmtranslationupdate.option.modPackTranslationUrl": "下載鏈接",
"text.autoconfig.vmtranslationupdate.option.tipsUrl": "獲取知識內容的鏈接",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enabled_platforms=fabric,forge,neoforge
yarn_mappings=1.20.2+build.4

archives_base_name=VMTranslationUpdate
mod_version=2.3.1
mod_version=2.3.2
maven_group=top.vmctcn.vmtranslationupdate

architectury_version=10.0.17
Expand Down

0 comments on commit 93b350f

Please sign in to comment.