fix: address localization review issues

This commit is contained in:
2026-06-23 21:35:09 +08:00
parent 036243fd4a
commit 51fc080ff2
16 changed files with 189 additions and 188 deletions
+3 -3
View File
@@ -184,13 +184,13 @@ public static class TechFunctions
}
if (!enough)
{
UIMessageBox.Show(I18NKeys.Metadata.Translate(), I18NKeys.InsufficientMetadata.Translate(), I18NKeys.Ok.Translate(), UIMessageBox.ERROR);
UIMessageBox.Show(I18NKeys.Metadata.Translate(), I18NKeys.InsufficientMetadata.Translate(), I18NKeys.OK.Translate(), UIMessageBox.ERROR);
return;
}
if (!history.hasUsedPropertyBanAchievement)
{
UIMessageBox.Show(I18NKeys.FirstTimeUsingMetadataTitle.Translate(), I18NKeys.FirstTimeUsingMetadataDescription.Translate(), I18NKeys.Cancel.Translate(), I18NKeys.Ok.Translate(), UIMessageBox.QUESTION, null, DoUnlockCalculatedTechs);
UIMessageBox.Show(I18NKeys.FirstTimeUsingMetadataTitle.Translate(), I18NKeys.FirstTimeUsingMetadataDescription.Translate(), I18NKeys.Cancel.Translate(), I18NKeys.OK.Translate(), UIMessageBox.QUESTION, null, DoUnlockCalculatedTechs);
return;
}
@@ -233,7 +233,7 @@ public static class TechFunctions
if (consumption.Value <= 0) continue;
msg += $"\n {LDB.items.Select(consumption.Key).propertyName}x{consumption.Value}";
}
UIMessageBox.Show("Batch buyout tech".Translate(), msg, I18NKeys.Cancel.Translate(), I18NKeys.Ok.Translate(), UIMessageBox.QUESTION, null, UnlockWithPropertiesImmediately);
UIMessageBox.Show("Batch buyout tech".Translate(), msg, I18NKeys.Cancel.Translate(), I18NKeys.OK.Translate(), UIMessageBox.QUESTION, null, UnlockWithPropertiesImmediately);
return;
void AddToMsg(ref string str, Tuple<TechProto, int, int> tuple)
+3 -3
View File
@@ -58,7 +58,7 @@ internal static class AutoConstructUI
ConstructCountText = GameObject.Instantiate(UIRoot.instance.uiGame.assemblerWindow.stateText);
ConstructCountText.gameObject.name = "construct-count-text";
ConstructCountText.text = String.Format("Buildings to construct: {0}".Translate(), 0);
ConstructCountText.text = String.Format(I18NKeys.BuildingsToConstruct0.Translate(), 0);
ConstructCountText.color = new Color(1f, 1f, 1f, 0.4f);
ConstructCountText.alignment = TextAnchor.MiddleLeft;
ConstructCountText.fontSize = 16;
@@ -78,11 +78,11 @@ internal static class AutoConstructUI
{
if (ToggleAutoConstruct.Checked)
{
ToggleAutoConstruct.SetLabelText("Disable auto-construct");
ToggleAutoConstruct.SetLabelText(I18NKeys.DisableAutoConstruct);
}
else
{
ToggleAutoConstruct.SetLabelText("Enable auto-construct");
ToggleAutoConstruct.SetLabelText(I18NKeys.EnableAutoConstruct);
}
}
}
+6 -6
View File
@@ -80,13 +80,13 @@ internal static class MenuButtonUI
var l = btn.text.GetComponent<Localizer>();
if (l != null)
{
l.stringKey = "UXAssist Config";
l.translation = "UXAssist Config".Translate();
l.stringKey = I18NKeys.UXAssistConfig;
l.translation = I18NKeys.UXAssistConfig.Translate();
}
btn.text.text = "UXAssist Config".Translate();
btn.text.text = I18NKeys.UXAssistConfig.Translate();
btn.text.fontSize = btn.text.fontSize * 7 / 8;
I18N.OnInitialized += () => { btn.text.text = "UXAssist Config".Translate(); };
I18N.OnInitialized += () => { btn.text.text = I18NKeys.UXAssistConfig.Translate(); };
var vec = ((RectTransform)mainMenu.exitButton.transform).anchoredPosition3D;
var vec2 = ((RectTransform)mainMenu.creditsButton.transform).anchoredPosition3D;
var transform1 = (RectTransform)btn.transform;
@@ -116,8 +116,8 @@ internal static class MenuButtonUI
rect.anchoredPosition3D = new Vector3(64f, -5f, 0f);
b.onClick.RemoveAllListeners();
btn.onClick += _ => { ToggleConfigWindow(); };
btn.tips.tipTitle = "UXAssist Config";
I18N.OnInitialized += () => { btn.tips.tipTitle = "UXAssist Config".Translate(); };
btn.tips.tipTitle = I18NKeys.UXAssistConfig;
I18N.OnInitialized += () => { btn.tips.tipTitle = I18NKeys.UXAssistConfig.Translate(); };
btn.tips.tipText = null;
btn.tips.corner = 9;
btn.tips.offset = new Vector2(-20f, -20f);
+5 -5
View File
@@ -113,7 +113,7 @@ internal static class MilkyWayUI
{
if (_clusterUploadResultsCount == 0)
{
UIMessageBox.Show("UXAssist".Translate(), "No recent milkyway upload results".Translate(), I18NKeys.Ok.Translate(), UIMessageBox.INFO, null);
UIMessageBox.Show(I18NKeys.UXAssist.Translate(), I18NKeys.NoRecentMilkywayUploadResults.Translate(), I18NKeys.OK.Translate(), UIMessageBox.INFO, null);
return;
}
StringBuilder sb = new();
@@ -122,9 +122,9 @@ internal static class MilkyWayUI
for (var i = start - 1; i >= end; i--)
{
var res = _clusterUploadResults[(i + _clusterUploadResultsHead) % ClusterUploadResultKeepCount];
sb.AppendLine($"{res.UploadTime.ToString("yyyy-MM-dd HH:mm:ss")} - {((res.Result is 0 or 20) ? "Success".Translate() : ("Failure: ".Translate() + res.Result.ToString()))} - {res.RequestTime:F2}s");
sb.AppendLine($"{res.UploadTime.ToString("yyyy-MM-dd HH:mm:ss")} - {((res.Result is 0 or 20) ? I18NKeys.Success.Translate() : (I18NKeys.Failure.Translate() + res.Result.ToString()))} - {res.RequestTime:F2}s");
}
UIMessageBox.Show("UXAssist".Translate(), sb.ToString(), I18NKeys.Ok.Translate(), UIMessageBox.INFO, null);
UIMessageBox.Show(I18NKeys.UXAssist.Translate(), sb.ToString(), I18NKeys.OK.Translate(), UIMessageBox.INFO, null);
}
}
@@ -164,7 +164,7 @@ internal static class MilkyWayUI
MyFlatButton[] buttons = [];
Text[] textFields = [];
MilkyWayTopTenPlayersToggler = MyCheckButton.CreateCheckButton(0, 0, rtrans, false, "Show top players".Translate()).WithSize(120f, 24f);
MilkyWayTopTenPlayersToggler = MyCheckButton.CreateCheckButton(0, 0, rtrans, false, I18NKeys.ShowTopPlayers.Translate()).WithSize(120f, 24f);
MilkyWayTopTenPlayersToggler.OnChecked += UpdateButtons;
MilkyWayTopTenPlayersToggler.Checked = false;
UpdateButtons();
@@ -290,7 +290,7 @@ internal static class MilkyWayUI
global::UXAssist.UI.Util.NormalizeRectWithTopLeft(textFields[i * 4 + 3].rectTransform, 24f + maxWidth0 + 10f + maxWidth1 + 5f + maxWidth2 + 5f + maxWidth3, y);
}
}
MilkyWayTopTenPlayersToggler.SetLabelText(chk ? "Hide top players".Translate() : "Show top players".Translate());
MilkyWayTopTenPlayersToggler.SetLabelText(chk ? I18NKeys.HideTopPlayers.Translate() : I18NKeys.ShowTopPlayers.Translate());
string ToKMG(long value)
{
+10 -10
View File
@@ -94,7 +94,7 @@ internal static class StarmapFilterUI
rtrans.pivot = new Vector2(0f, 1f);
rtrans.anchoredPosition3D = new Vector3(0, 0, 0f);
var cornerComboBox = MyCornerComboBox.CreateComboBox(135, 0, rtrans, true).WithItems("Show original name".Translate(), "Show distance".Translate(), "Show planet count".Translate(), "Show all information".Translate());
var cornerComboBox = MyCornerComboBox.CreateComboBox(135, 0, rtrans, true).WithItems(I18NKeys.ShowOriginalName.Translate(), I18NKeys.ShowDistance.Translate(), I18NKeys.ShowPlanetCount.Translate(), I18NKeys.ShowAllInformation.Translate());
cornerComboBox.SetIndex(CornerComboBoxIndex);
cornerComboBox.OnSelChanged += (index) =>
{
@@ -132,13 +132,13 @@ internal static class StarmapFilterUI
MyCheckButton.CreateCheckButton(24, 354, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
MyCheckButton.CreateCheckButton(24, 378, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
];
var unionCheckBox = MyCheckBox.CreateCheckBox(312, 0, rtrans, false, "Union results".Translate(), 15).WithSmallerBox(24f);
var unionCheckBox = MyCheckBox.CreateCheckBox(312, 0, rtrans, false, I18NKeys.UnionResults.Translate(), 15).WithSmallerBox(24f);
unionCheckBox.gameObject.SetActive(false);
unionCheckBox.OnChecked += () =>
{
UpdateStarmapStarFilters();
};
var allOresText = MyWindow.AddText(20, 190, rtrans, "All 6 Basic Ores".Translate(), 12);
var allOresText = MyWindow.AddText(20, 190, rtrans, I18NKeys.All6BasicOres.Translate(), 12);
allOresText.gameObject.SetActive(false);
StarmapFilterToggler.OnChecked += UpdateButtons;
foreach (var button in buttons)
@@ -277,10 +277,10 @@ internal static class StarmapFilterUI
{
var items = cornerComboBox.Items;
cornerComboBox.UpdateLabelText();
items[0] = "Show original name".Translate();
items[1] = "Show distance".Translate();
items[2] = "Show planet count".Translate();
items[3] = "Show all information".Translate();
items[0] = I18NKeys.ShowOriginalName.Translate();
items[1] = I18NKeys.ShowDistance.Translate();
items[2] = I18NKeys.ShowPlanetCount.Translate();
items[3] = I18NKeys.ShowAllInformation.Translate();
}
if (buttons != null)
{
@@ -307,10 +307,10 @@ internal static class StarmapFilterUI
switch (i)
{
case 5:
buttons[12 + i].SetLabelText($"{themeProto.DisplayName.Translate()} ({"High yield".Translate()})");
buttons[12 + i].SetLabelText($"{themeProto.DisplayName.Translate()} ({I18NKeys.HighYield.Translate()})");
break;
case 6:
buttons[12 + i].SetLabelText($"{themeProto.DisplayName.Translate()} ({"Perfect".Translate()})");
buttons[12 + i].SetLabelText($"{themeProto.DisplayName.Translate()} ({I18NKeys.Perfect.Translate()})");
break;
default:
buttons[12 + i].SetLabelText(themeProto.DisplayName.Translate());
@@ -318,7 +318,7 @@ internal static class StarmapFilterUI
}
}
}
if (allOresText != null) allOresText.text = "All 6 Basic Ores".Translate();
if (allOresText != null) allOresText.text = I18NKeys.All6BasicOres.Translate();
}
void UpdateButtons()
{
+1 -1
View File
@@ -55,7 +55,7 @@ public static class WindowFunctions
WinApi.NORMAL_PRIORITY_CLASS => "Normal".Translate(),
WinApi.BELOW_NORMAL_PRIORITY_CLASS => "Below Normal".Translate(),
WinApi.IDLE_PRIORITY_CLASS => "Idle".Translate(),
_ => "Unknown".Translate()
_ => I18NKeys.Unknown.Translate()
};
}