refactor(strings): replace ResourceManager.GetString with direct HellionStrings properties
Security / scan (push) Successful in 13s
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:
@@ -12,43 +12,59 @@ internal sealed class SettingsOverview
|
||||
private readonly SettingsWindow _window;
|
||||
|
||||
// Card order matches the Tabs index in SettingsWindow 1:1.
|
||||
private static readonly (FontAwesomeIcon Icon, string TitleKey, string SubtextKey)[] CardDefs =
|
||||
[
|
||||
(FontAwesomeIcon.SlidersH, "Settings_Card_General_Title", "Settings_Card_General_Subtext"),
|
||||
(
|
||||
FontAwesomeIcon.Palette,
|
||||
"Settings_Card_ThemeAndLayout_Title",
|
||||
"Settings_Card_ThemeAndLayout_Subtext"
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.Font,
|
||||
"Settings_Card_FontsAndColours_Title",
|
||||
"Settings_Card_FontsAndColours_Subtext"
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.WindowMaximize,
|
||||
"Settings_Card_Window_Title",
|
||||
"Settings_Card_Window_Subtext"
|
||||
),
|
||||
(FontAwesomeIcon.Comments, "Settings_Card_Chat_Title", "Settings_Card_Chat_Subtext"),
|
||||
(FontAwesomeIcon.FolderTree, "Settings_Card_Tabs_Title", "Settings_Card_Tabs_Subtext"),
|
||||
(FontAwesomeIcon.ShieldAlt, "Settings_Card_Privacy_Title", "Settings_Card_Privacy_Subtext"),
|
||||
(
|
||||
FontAwesomeIcon.Database,
|
||||
"Settings_Card_DataManagement_Title",
|
||||
"Settings_Card_DataManagement_Subtext"
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.Plug,
|
||||
"Settings_Card_Integrations_Title",
|
||||
"Settings_Card_Integrations_Subtext"
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.InfoCircle,
|
||||
"Settings_Card_Information_Title",
|
||||
"Settings_Card_Information_Subtext"
|
||||
),
|
||||
];
|
||||
private static (FontAwesomeIcon Icon, string Title, string Subtext)[] BuildCardDefs() =>
|
||||
[
|
||||
(
|
||||
FontAwesomeIcon.SlidersH,
|
||||
HellionStrings.Settings_Card_General_Title,
|
||||
HellionStrings.Settings_Card_General_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.Palette,
|
||||
HellionStrings.Settings_Card_ThemeAndLayout_Title,
|
||||
HellionStrings.Settings_Card_ThemeAndLayout_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.Font,
|
||||
HellionStrings.Settings_Card_FontsAndColours_Title,
|
||||
HellionStrings.Settings_Card_FontsAndColours_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.WindowMaximize,
|
||||
HellionStrings.Settings_Card_Window_Title,
|
||||
HellionStrings.Settings_Card_Window_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.Comments,
|
||||
HellionStrings.Settings_Card_Chat_Title,
|
||||
HellionStrings.Settings_Card_Chat_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.FolderTree,
|
||||
HellionStrings.Settings_Card_Tabs_Title,
|
||||
HellionStrings.Settings_Card_Tabs_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.ShieldAlt,
|
||||
HellionStrings.Settings_Card_Privacy_Title,
|
||||
HellionStrings.Settings_Card_Privacy_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.Database,
|
||||
HellionStrings.Settings_Card_DataManagement_Title,
|
||||
HellionStrings.Settings_Card_DataManagement_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.Plug,
|
||||
HellionStrings.Settings_Card_Integrations_Title,
|
||||
HellionStrings.Settings_Card_Integrations_Subtext
|
||||
),
|
||||
(
|
||||
FontAwesomeIcon.InfoCircle,
|
||||
HellionStrings.Settings_Card_Information_Title,
|
||||
HellionStrings.Settings_Card_Information_Subtext
|
||||
),
|
||||
];
|
||||
|
||||
public SettingsOverview(SettingsWindow window)
|
||||
{
|
||||
@@ -63,14 +79,13 @@ internal sealed class SettingsOverview
|
||||
// 110f accommodates two-line subtexts; wrap width is matched in DrawCard.
|
||||
var cardHeight = 110f;
|
||||
|
||||
for (var i = 0; i < CardDefs.Length; i++)
|
||||
var cardDefs = BuildCardDefs();
|
||||
for (var i = 0; i < cardDefs.Length; i++)
|
||||
{
|
||||
var (icon, titleKey, subtextKey) = CardDefs[i];
|
||||
var title = HellionStrings.ResourceManager.GetString(titleKey) ?? titleKey;
|
||||
var subtext = HellionStrings.ResourceManager.GetString(subtextKey) ?? subtextKey;
|
||||
var (icon, title, subtext) = cardDefs[i];
|
||||
DrawCard(i, icon, title, subtext, cardWidth, cardHeight);
|
||||
|
||||
if ((i + 1) % columns != 0 && i != CardDefs.Length - 1)
|
||||
if ((i + 1) % columns != 0 && i != cardDefs.Length - 1)
|
||||
ImGui.SameLine();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user