refactor: localize hard-coded strings and translate comments

This commit is contained in:
2026-06-23 20:58:05 +08:00
parent 6e2b21a0a0
commit 34c99701ca
7 changed files with 41 additions and 26 deletions
+2 -2
View File
@@ -121,7 +121,7 @@ public static class PlayerFunctions
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
}
}
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, () =>
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null, () =>
{
foreach (var data in propertySystem.propertyDatas)
{
@@ -169,7 +169,7 @@ public static class PlayerFunctions
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
}
}
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, () =>
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null, () =>
{
for (var i = 0; i < clusterPropertyData.totalConsumption.Count; i++)
{
@@ -622,7 +622,7 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
}
}
// 水、硫酸、氢、重氢、光子
// Water, sulfuric acid, hydrogen, deuterium, photons
foreach (var itemId in ItemIds.ExtraOreItemIds)
{
ItemSources[itemId] = new ItemSource { Count = 1 };
+15 -9
View File
@@ -20,6 +20,12 @@ public static class UIConfigWindow
I18N.Add("Factory", "Factory", "工厂");
I18N.Add("Planet", "Planet", "行星");
I18N.Add("Mecha/Combat", "Mecha/Combat", "机甲/战斗");
I18N.Add("Cancel", "Cancel", "取消");
I18N.Add("OK", "OK", "确定");
I18N.Add("Bury all veins", "Bury all veins", "掩埋所有矿脉");
I18N.Add("Restore buried veins", "Restore buried veins", "还原所有矿脉");
I18N.Add("Reform entire planet", "Reform entire planet", "铺满星球地基");
I18N.Add("Revert planet terrain", "Revert planet terrain", "还原星球地形");
I18N.Add("Enable Dev Shortcuts", "Enable Dev Shortcuts", "开发模式快捷键");
I18N.Add("Disable Abnormal Checks", "Disable Abnormal Checks", "关闭数据异常检查");
I18N.Add("Hotkey", "Hotkey", "快捷键");
@@ -255,11 +261,11 @@ public static class UIConfigWindow
wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)");
x = 400f;
y = 10f;
wnd.AddButton(x, y, 200f, tab3, "矿物掩埋标题", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); });
wnd.AddButton(x, y, 200f, tab3, "Bury all veins", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); });
y += 36f;
wnd.AddButton(x, y, 200f, tab3, "矿物还原标题", 16, "button-bury-restore-all", () => { PlanetFunctions.BuryAllVeins(false); });
wnd.AddButton(x, y, 200f, tab3, "Restore buried veins", 16, "button-bury-restore-all", () => { PlanetFunctions.BuryAllVeins(false); });
y += 36f;
wnd.AddButton(x, y, 200f, tab3, "铺满地基提示", 16, "button-reform-all", () =>
wnd.AddButton(x, y, 200f, tab3, "Reform entire planet", 16, "button-reform-all", () =>
{
var player = GameMain.mainPlayer;
if (player == null) return;
@@ -269,7 +275,7 @@ public static class UIConfigWindow
GameMain.localPlanet.factory.PlanetReformAll(reformTool.brushType, reformTool.brushColor, reformTool.buryVeins);
});
y += 36f;
wnd.AddButton(x, y, 200f, tab3, "还原地形提示", 16, "button-reform-revert-all", () =>
wnd.AddButton(x, y, 200f, tab3, "Revert planet terrain", 16, "button-reform-revert-all", () =>
{
var factory = GameMain.localPlanet?.factory;
if (factory == null) return;
@@ -316,25 +322,25 @@ public static class UIConfigWindow
var originalY = y;
var btn0 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", () =>
{
UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.CreateIllegalDysonShellWithMaxOutput(); });
});
y += 36f;
var btn1 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell 2", 16, "button-generate-illegal-dyson-shells", () =>
{
UIMessageBox.Show("Generate illegal dyson shell 2".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
UIMessageBox.Show("Generate illegal dyson shell 2".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.CreateIllegalDysonShellWithMaxOutputForAllLayers(); });
});
y += 36f;
var btn2 = wnd.AddButton(x, y, 300f, tab4, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", () =>
{
UIMessageBox.Show("Keep max production shells and remove others".Translate(), "WARNING: This operation is DANGEROUS, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
UIMessageBox.Show("Keep max production shells and remove others".Translate(), "WARNING: This operation is DANGEROUS, continue?".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.KeepMaxProductionShells(); });
});
y += 36f;
var btn3 = wnd.AddButton(x, y, 300f, tab4, "Duplicate shells from that with highest production", 16, "button-duplicate-shells-from-the-highest-production", () =>
{
UIMessageBox.Show("Duplicate shells from that with highest production".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
UIMessageBox.Show("Duplicate shells from that with highest production".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.DuplicateShellsWithHighestProduction(); });
});
y += 30f;
@@ -343,7 +349,7 @@ public static class UIConfigWindow
y = originalY;
var btn4 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell quickly", 16, "button-generate-illegal-dyson-shells-quickly", () =>
{
UIMessageBox.Show("Generate illegal dyson shell quickly".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
UIMessageBox.Show("Generate illegal dyson shell quickly".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.WARNING, null,
() => { DysonSphereFunctions.CreateIllegalDysonShellQuickly(DysonSphereFunctions.ShellsCountForFunctions.Value); });
});
y += 30f;
+1 -1
View File
@@ -469,7 +469,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
var label1 = generator.DefineLabel();
var label2 = generator.DefineLabel();
matcher.MatchForward(false,
// this.stateText.text = "轨道未设置".Translate();
// this.stateText.text = "Standby".Translate();
new CodeMatch(OpCodes.Ldstr, "待机"),
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Localization), nameof(Localization.Translate))),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertySetter(typeof(Text), nameof(Text.text)))
+6 -6
View File
@@ -72,7 +72,7 @@ internal static class BeltSignalPatch
new SignalProto
{
ID = 301,
Name = "存储单元",
Name = "Memory Unit",
GridIndex = 3801,
IconPath = "assets/signal/memory.png",
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/memory.png", assembly),
@@ -81,7 +81,7 @@ internal static class BeltSignalPatch
new SignalProto
{
ID = 302,
Name = "能量碎片",
Name = "Energy Fragment",
GridIndex = 3802,
IconPath = "assets/signal/energy-fragment.png",
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/energy-fragment.png", assembly),
@@ -90,7 +90,7 @@ internal static class BeltSignalPatch
new SignalProto
{
ID = 303,
Name = "硅基神经元",
Name = "Silicon Neuron",
GridIndex = 3803,
IconPath = "assets/signal/silicon-neuron.png",
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/silicon-neuron.png", assembly),
@@ -99,7 +99,7 @@ internal static class BeltSignalPatch
new SignalProto
{
ID = 304,
Name = "负熵奇点",
Name = "Negentropy Singularity",
GridIndex = 3804,
IconPath = "assets/signal/negentropy.png",
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/negentropy.png", assembly),
@@ -108,7 +108,7 @@ internal static class BeltSignalPatch
new SignalProto
{
ID = 305,
Name = "物质重组器",
Name = "Matter Reassembler",
GridIndex = 3805,
IconPath = "assets/signal/reassembler.png",
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/reassembler.png", assembly),
@@ -117,7 +117,7 @@ internal static class BeltSignalPatch
new SignalProto
{
ID = 306,
Name = "虚粒子",
Name = "Virtual Particle",
GridIndex = 3806,
IconPath = "assets/signal/virtual-particle.png",
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/virtual-particle.png", assembly),
+2 -2
View File
@@ -182,7 +182,7 @@ public class MyKeyBinder : MonoBehaviour
return key;
}
//通常キーが押されているかチェック _lastKey に保存
// Check if any regular key is pressed and store it in _lastKey
private bool GetIunptKeys()
{
var anyKey = false;
@@ -201,7 +201,7 @@ public class MyKeyBinder : MonoBehaviour
{
conflictText.gameObject.SetActive(false);
waitingText.gameObject.SetActive(false);
setDefaultUIButton.button.Select(); // InputFieldのフォーカス外す
setDefaultUIButton.button.Select(); // Remove focus from the InputField
_lastKey = KeyCode.None;
}
+14 -5
View File
@@ -76,6 +76,12 @@ public static class UIConfigWindow
I18N.Add("Build Tesla Tower and Wireless Power Tower alternately", "Build Tesla Tower and Wireless Power Tower alternately", "交替建造电力感应塔和无线输电塔");
I18N.Add("Auto-construct button", "Auto-construct button", "自动建造按钮");
I18N.Add("Belt signals for buy out dark fog items automatically", "Belt signals for buy out dark fog items automatically", "用于自动购买黑雾物品的传送带信号");
I18N.Add("Memory Unit", "Memory Unit", "存储单元");
I18N.Add("Energy Fragment", "Energy Fragment", "能量碎片");
I18N.Add("Silicon Neuron", "Silicon Neuron", "硅基神经元");
I18N.Add("Negentropy Singularity", "Negentropy Singularity", "负熵奇点");
I18N.Add("Matter Reassembler", "Matter Reassembler", "物质重组器");
I18N.Add("Virtual Particle", "Virtual Particle", "虚粒子");
I18N.Add("Ctrl+Shift+Click to pick items from whole belts", "Ctrl+Shift+Click to pick items from whole belts", "按住Ctrl+Shift点击从整条传送带抓取物品");
I18N.Add("Include branches of belts", "Include branches of belts", "包含传送带分支");
I18N.Add("Include connected inserters", "Include connected inserters (and their connected belts if above is checked)", "包含连接的分拣器(若勾选上面的选项则包含分拣器连接的传送带)");
@@ -101,6 +107,9 @@ public static class UIConfigWindow
I18N.Add("Count of Vessels filled", "Count of Vessels filled", "填充的运输船数量");
I18N.Add("Collecting Speed", "Collecting Speed", "开采速度");
I18N.Add("Min. Piler Value", "Outgoing integration count", "输出货物集装数量");
I18N.Add("Use tech max for piler", "Use tech max for piler", "集装使用科技上限");
I18N.Add("Cancel", "Cancel", "取消");
I18N.Add("OK", "OK", "确定");
I18N.Add("Apply config to planet", "Apply", "应用");
I18N.Add("Apply all config to planet", "Apply All", "应用全部");
I18N.Add("Apply config to planet tips", "Apply this value to all facilities of this type on the current planet", "将此项数值应用到当前行星上所有该类型物流设施");
@@ -248,7 +257,7 @@ public static class UIConfigWindow
{
public override string FormatValue(string format, int value)
{
return value == 0 ? "集装使用科技上限".Translate().Trim() : value.ToString();
return value == 0 ? "Use tech max for piler".Translate().Trim() : value.ToString();
}
}
@@ -447,7 +456,7 @@ public static class UIConfigWindow
x = 400f;
y = 10f;
wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () =>
UIMessageBox.Show("Initialize This Planet".Translate(), "Initialize This Planet Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
UIMessageBox.Show("Initialize This Planet".Translate(), "Initialize This Planet Confirm".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null,
() => { PlanetFunctions.RecreatePlanet(true); })
);
y += 24f;
@@ -459,7 +468,7 @@ public static class UIConfigWindow
y += 36f;
wnd.AddButton(x, y, tab2, "Dismantle All Buildings", 16, "button-dismantle-all", () =>
UIMessageBox.Show("Dismantle All Buildings".Translate(), "Dismantle All Buildings Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
UIMessageBox.Show("Dismantle All Buildings".Translate(), "Dismantle All Buildings Confirm".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null,
() => { PlanetFunctions.DismantleAll(false); })
);
y += 72f;
@@ -794,7 +803,7 @@ public static class UIConfigWindow
x = 400f;
y = 10f;
_dysonInitBtn = wnd.AddButton(x, y, tab5, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () =>
UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null,
() => { DysonSphereFunctions.InitCurrentDysonLayer(null, -1); })
);
y += 36f;
@@ -806,7 +815,7 @@ public static class UIConfigWindow
var btn = wnd.AddFlatButton(x, y, tab5, id.ToString(), 12, "dismantle-layer-" + id, () =>
{
var star = DysonSphereFunctions.CurrentStarForDysonSystem();
UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "Cancel".Translate(), "OK".Translate(), UIMessageBox.QUESTION, null,
() => { DysonSphereFunctions.InitCurrentDysonLayer(star, id); });
}
).WithSize(40f, 20f);