diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index a975537cb2..8e5fa406a2 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1521,6 +1521,8 @@ setting.hidedisplays.name = Hide Logic Displays setting.hidedisplays.description = Hides the content of logic displays, which may improve performance. setting.macnotch.name = Adapt interface to display notch setting.macnotch.description = On MacOS devices with a notch, lowers the UI to avoid it.\nRestart required to apply changes. +setting.logiclocalization.name = Logic Localization +setting.logiclocalization.description = When enabled, text in the logic editor is translated,\ninstead of being English for all languages. steam.friendsonly = Steam Friends Only steam.friendsonly.tooltip = Whether only Steam friends will be able to join your game.\nUnchecking this box will make your game public - anyone can join. diff --git a/core/assets/bundles/bundle_zh_CN.properties b/core/assets/bundles/bundle_zh_CN.properties index 0680a6ca57..ec5c5fc5bb 100644 --- a/core/assets/bundles/bundle_zh_CN.properties +++ b/core/assets/bundles/bundle_zh_CN.properties @@ -1516,6 +1516,8 @@ setting.hidedisplays.name = 不显示逻辑绘图 setting.hidedisplays.description = 隐藏逻辑显示屏内容,可能会提升性能。 setting.macnotch.name = 适应刘海显示 setting.macnotch.description = 需要重启才能应用更改 +setting.logiclocalization.name = 逻辑本地化 +setting.logiclocalization.description = 翻译逻辑处理器中的术语。 steam.friendsonly = 仅限好友 steam.friendsonly.tooltip = 是否只有 Steam 好友才能加入你的游戏。\n取消选中该选项将使你的游戏公开 - 任何人都可以加入。 diff --git a/core/src/mindustry/logic/LStatement.java b/core/src/mindustry/logic/LStatement.java index b11d5bab55..bb78a1e0dd 100644 --- a/core/src/mindustry/logic/LStatement.java +++ b/core/src/mindustry/logic/LStatement.java @@ -122,7 +122,12 @@ public abstract class LStatement{ return value; } + protected static boolean logicLocalization(){ + return Core.settings.getBool("logiclocalization", true); + } + public static String bundle(String key){ + if(!logicLocalization()) return key; return Core.bundle.get("name.token." + key, key); } @@ -132,17 +137,16 @@ public abstract class LStatement{ }else if(value instanceof ConditionOp op){ return selectTranslate(op.symbol); } - String name = value.name().toLowerCase(Locale.ROOT); String labelKey = value.getClass().getSimpleName().toLowerCase(Locale.ROOT) + ".label." + name; - if(Core.bundle.has(labelKey)){ + if(logicLocalization() && Core.bundle.has(labelKey)){ return Core.bundle.get(labelKey); } return value.name(); } protected static String selectTranslate(String text){ - if(text == null || text.isEmpty()) return text; + if(text == null || text.isEmpty() || !logicLocalization()) return text; return switch(text){ case "not", "and", "or", "b-and", "xor", "flip", "always" -> bundle(text); default -> text; @@ -337,7 +341,8 @@ public abstract class LStatement{ } public String localizedName(){ - return Core.bundle.get("instruction." + statementKey(), name()); + if(logicLocalization()) return Core.bundle.get("instruction." + statementKey(), name()); + return statementKey(); } public String name(){ diff --git a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java index 71f9faeaa5..cdb3d8f219 100644 --- a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -558,6 +558,7 @@ public class SettingsMenuDialog extends BaseDialog{ graphics.checkPref("skipcoreanimation", false); graphics.checkPref("hidedisplays", false); + graphics.checkPref("logiclocalization", true); if(OS.isMac){ graphics.checkPref("macnotch", false);