refactor(strings): replace ResourceManager.GetString with direct HellionStrings properties
Security / scan (push) Successful in 13s

- SettingsOverview: replace dynamic key lookup via ResourceManager with
  direct HellionStrings property access; switch static readonly array to
  BuildCardDefs() method to ensure correct initialization order
- ThemeAndLayout: replace all ResourceManager.GetString calls with direct
  HellionStrings/Language property access throughout DrawThemeSection()
  and DrawChatColorsApplyBanner()

Also rework DE/EN string copy for a more natural, less formal tone in the German localization, and to better match the English source text. This includes
This commit is contained in:
2026-05-11 20:11:53 +02:00
parent b1b6402827
commit 3a7f9b3adb
4 changed files with 245 additions and 248 deletions
+14 -32
View File
@@ -43,9 +43,9 @@ internal sealed class ThemeAndLayout : ISettingsTab
var registry = Plugin.ThemeRegistry;
var active = registry.Get(Mutable.Theme);
var activeLabelTemplate =
HellionStrings.ResourceManager.GetString("Settings_Themes_Active") ?? "Active: {0}";
ImGui.TextUnformatted(string.Format(activeLabelTemplate, active.Name));
ImGui.TextUnformatted(
string.Format(HellionStrings.Settings_Themes_Active, active.Name)
);
using (ImRaii.PushColor(ImGuiCol.Text, 0xFF8FA3B5u))
ImGui.TextUnformatted(active.Author);
@@ -55,10 +55,7 @@ internal sealed class ThemeAndLayout : ISettingsTab
ImGui.Separator();
ImGui.Spacing();
var builtInsLabel =
HellionStrings.ResourceManager.GetString("Settings_Themes_BuiltIns")
?? "Built-in themes";
ImGui.TextUnformatted(builtInsLabel);
ImGui.TextUnformatted(HellionStrings.Settings_Themes_BuiltIns);
ImGui.Spacing();
DrawThemeGrid(registry.AllBuiltIns(), active.Slug);
@@ -68,10 +65,7 @@ internal sealed class ThemeAndLayout : ISettingsTab
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
var customLabel =
HellionStrings.ResourceManager.GetString("Settings_Themes_Custom")
?? "Custom themes";
ImGui.TextUnformatted(customLabel);
ImGui.TextUnformatted(HellionStrings.Settings_Themes_Custom);
ImGui.Spacing();
DrawThemeGrid(customs, active.Slug);
}
@@ -80,10 +74,7 @@ internal sealed class ThemeAndLayout : ISettingsTab
ImGui.Separator();
ImGui.Spacing();
var openFolderLabel =
HellionStrings.ResourceManager.GetString("Settings_Themes_OpenFolder")
?? "Open themes folder";
if (ImGui.Button(openFolderLabel))
if (ImGui.Button(HellionStrings.Settings_Themes_OpenFolder))
{
var dir = Path.Combine(Plugin.Interface.ConfigDirectory.FullName, "themes");
Directory.CreateDirectory(dir);
@@ -91,10 +82,7 @@ internal sealed class ThemeAndLayout : ISettingsTab
}
ImGui.SameLine();
var exportLabel =
HellionStrings.ResourceManager.GetString("Settings_Themes_ExportActive")
?? "Export active...";
if (ImGui.Button(exportLabel))
if (ImGui.Button(HellionStrings.Settings_Themes_ExportActive))
{
var dir = Path.Combine(Plugin.Interface.ConfigDirectory.FullName, "themes");
Directory.CreateDirectory(dir);
@@ -206,25 +194,19 @@ internal sealed class ThemeAndLayout : ISettingsTab
draw.AddRectFilled(origin, origin + new Vector2(width, height), bgFill, 4f);
draw.AddRect(origin, origin + new Vector2(width, height), border, 4f, ImDrawFlags.None, 1f);
var hint =
HellionStrings.ResourceManager.GetString("Settings_Themes_ApplyChatColors_Hint")
?? "This theme suggests its own chat channel colours.";
var applyLabel =
HellionStrings.ResourceManager.GetString("Settings_Themes_ApplyChatColors_Apply")
?? "Apply";
var keepLabel =
HellionStrings.ResourceManager.GetString("Settings_Themes_ApplyChatColors_Keep")
?? "Keep current";
var textColor = ColourUtil.RgbaToAbgr(active.Colors.TextPrimary);
draw.AddText(origin + new Vector2(12f, 10f), textColor, hint);
draw.AddText(
origin + new Vector2(12f, 10f),
textColor,
HellionStrings.Settings_Themes_ApplyChatColors_Hint
);
using (ImRaii.PushColor(ImGuiCol.Button, active.Colors.Primary))
using (ImRaii.PushColor(ImGuiCol.ButtonHovered, active.Colors.PrimaryLight))
using (ImRaii.PushColor(ImGuiCol.ButtonActive, active.Colors.PrimaryDark))
{
ImGui.SetCursorScreenPos(origin + new Vector2(12f, 32f));
if (ImGui.Button(applyLabel))
if (ImGui.Button(HellionStrings.Settings_Themes_ApplyChatColors_Apply))
{
foreach (var kvp in themeChatColors.Channels)
Mutable.ChatColours[kvp.Key] = kvp.Value;
@@ -233,7 +215,7 @@ internal sealed class ThemeAndLayout : ISettingsTab
}
ImGui.SameLine();
if (ImGui.Button(keepLabel))
if (ImGui.Button(HellionStrings.Settings_Themes_ApplyChatColors_Keep))
{
_applyDismissedFor = active.Slug;
}