Make #12158 feature toggleable (#12569)

This commit is contained in:
redloong
2026-09-01 16:49:47 -04:00
committed by GitHub
parent 79c314a983
commit 0d5c83f928
4 changed files with 14 additions and 4 deletions
+2
View File
@@ -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.
@@ -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取消选中该选项将使你的游戏公开 - 任何人都可以加入。
+9 -4
View File
@@ -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(){
@@ -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);