mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Change it to LazyLoc instead
So CheapLoc can export localizations...
This commit is contained in:
parent
e421c4ec67
commit
95dbcb28c4
12 changed files with 113 additions and 98 deletions
|
|
@ -10,7 +10,7 @@ internal abstract class SettingsEntry
|
|||
/// <summary>
|
||||
/// Gets or sets the public, searchable name of this settings entry.
|
||||
/// </summary>
|
||||
public LocRef Name { get; protected set; }
|
||||
public LazyLoc Name { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this entry is valid.
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
|||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Utility;
|
||||
using Dalamud.Utility.Internal;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||
|
||||
|
|
@ -26,19 +27,19 @@ internal sealed class SettingsTabExperimental : SettingsTab
|
|||
public override SettingsEntry[] Entries { get; } =
|
||||
[
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsPluginTest", "Get plugin testing builds"),
|
||||
("DalamudSettingsPluginTestHint", "Receive testing prereleases for selected plugins.\nTo opt-in to testing builds for a plugin, you have to right click it in the \"Installed Plugins\" tab of the plugin installer and select \"Receive plugin testing versions\"."),
|
||||
LazyLoc.Localize("DalamudSettingsPluginTest", "Get plugin testing builds"),
|
||||
LazyLoc.Localize("DalamudSettingsPluginTestHint", "Receive testing prereleases for selected plugins.\nTo opt-in to testing builds for a plugin, you have to right click it in the \"Installed Plugins\" tab of the plugin installer and select \"Receive plugin testing versions\"."),
|
||||
c => c.DoPluginTest,
|
||||
(v, c) => c.DoPluginTest = v),
|
||||
new HintSettingsEntry(
|
||||
("DalamudSettingsPluginTestWarning", "Testing plugins may contain bugs or crash your game. Please only enable this if you are aware of the risks."),
|
||||
LazyLoc.Localize("DalamudSettingsPluginTestWarning", "Testing plugins may contain bugs or crash your game. Please only enable this if you are aware of the risks."),
|
||||
ImGuiColors.DalamudRed),
|
||||
|
||||
new GapSettingsEntry(5),
|
||||
|
||||
new ButtonSettingsEntry(
|
||||
("DalamudSettingsClearHidden", "Clear hidden plugins"),
|
||||
("DalamudSettingsClearHiddenHint", "Restore plugins you have previously hidden from the plugin installer."),
|
||||
LazyLoc.Localize("DalamudSettingsClearHidden", "Clear hidden plugins"),
|
||||
LazyLoc.Localize("DalamudSettingsClearHiddenHint", "Restore plugins you have previously hidden from the plugin installer."),
|
||||
() =>
|
||||
{
|
||||
Service<DalamudConfiguration>.Get().HiddenPluginInternalName.Clear();
|
||||
|
|
@ -50,16 +51,16 @@ internal sealed class SettingsTabExperimental : SettingsTab
|
|||
new DevPluginsSettingsEntry(),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingEnableImGuiAsserts", "Enable ImGui asserts"),
|
||||
("DalamudSettingEnableImGuiAssertsHint",
|
||||
LazyLoc.Localize("DalamudSettingEnableImGuiAsserts", "Enable ImGui asserts"),
|
||||
LazyLoc.Localize("DalamudSettingEnableImGuiAssertsHint",
|
||||
"If this setting is enabled, a window containing further details will be shown when an internal assertion in ImGui fails.\nWe recommend enabling this when developing plugins. " +
|
||||
"This setting does not persist and will reset when the game restarts.\nUse the setting below to enable it at startup."),
|
||||
c => Service<InterfaceManager>.Get().ShowAsserts,
|
||||
(v, _) => Service<InterfaceManager>.Get().ShowAsserts = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingEnableImGuiAssertsAtStartup", "Always enable ImGui asserts at startup"),
|
||||
("DalamudSettingEnableImGuiAssertsAtStartupHint", "This will enable ImGui asserts every time the game starts."),
|
||||
LazyLoc.Localize("DalamudSettingEnableImGuiAssertsAtStartup", "Always enable ImGui asserts at startup"),
|
||||
LazyLoc.Localize("DalamudSettingEnableImGuiAssertsAtStartupHint", "This will enable ImGui asserts every time the game starts."),
|
||||
c => c.ImGuiAssertsEnabledAtStartup ?? false,
|
||||
(v, c) => c.ImGuiAssertsEnabledAtStartup = v),
|
||||
|
||||
|
|
@ -70,8 +71,8 @@ internal sealed class SettingsTabExperimental : SettingsTab
|
|||
new GapSettingsEntry(5, true),
|
||||
|
||||
new EnumSettingsEntry<ReShadeHandlingMode>(
|
||||
("DalamudSettingsReShadeHandlingMode", "ReShade handling mode"),
|
||||
("DalamudSettingsReShadeHandlingModeHint", "You may try different options to work around problems you may encounter.\nRestart is required for changes to take effect."),
|
||||
LazyLoc.Localize("DalamudSettingsReShadeHandlingMode", "ReShade handling mode"),
|
||||
LazyLoc.Localize("DalamudSettingsReShadeHandlingModeHint", "You may try different options to work around problems you may encounter.\nRestart is required for changes to take effect."),
|
||||
c => c.ReShadeHandlingMode,
|
||||
(v, c) => c.ReShadeHandlingMode = v,
|
||||
fallbackValue: ReShadeHandlingMode.Default,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
using CheapLoc;
|
||||
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||
using Dalamud.Utility.Internal;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||
|
||||
|
|
@ -20,8 +22,8 @@ internal sealed class SettingsTabGeneral : SettingsTab
|
|||
new GapSettingsEntry(5),
|
||||
|
||||
new EnumSettingsEntry<XivChatType>(
|
||||
("DalamudSettingsChannel", "Dalamud Chat Channel"),
|
||||
("DalamudSettingsChannelHint", "Select the chat channel that is to be used for general Dalamud messages."),
|
||||
LazyLoc.Localize("DalamudSettingsChannel", "Dalamud Chat Channel"),
|
||||
LazyLoc.Localize("DalamudSettingsChannelHint", "Select the chat channel that is to be used for general Dalamud messages."),
|
||||
c => c.GeneralChatType,
|
||||
(v, c) => c.GeneralChatType = v,
|
||||
warning: v =>
|
||||
|
|
@ -37,46 +39,46 @@ internal sealed class SettingsTabGeneral : SettingsTab
|
|||
new GapSettingsEntry(5),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsWaitForPluginsOnStartup", "Wait for plugins before game loads"),
|
||||
("DalamudSettingsWaitForPluginsOnStartupHint", "Do not let the game load, until plugins are loaded."),
|
||||
LazyLoc.Localize("DalamudSettingsWaitForPluginsOnStartup", "Wait for plugins before game loads"),
|
||||
LazyLoc.Localize("DalamudSettingsWaitForPluginsOnStartupHint", "Do not let the game load, until plugins are loaded."),
|
||||
c => c.IsResumeGameAfterPluginLoad,
|
||||
(v, c) => c.IsResumeGameAfterPluginLoad = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsFlash", "Flash FFXIV window on duty pop"),
|
||||
("DalamudSettingsFlashHint", "Flash the FFXIV window in your task bar when a duty is ready."),
|
||||
LazyLoc.Localize("DalamudSettingsFlash", "Flash FFXIV window on duty pop"),
|
||||
LazyLoc.Localize("DalamudSettingsFlashHint", "Flash the FFXIV window in your task bar when a duty is ready."),
|
||||
c => c.DutyFinderTaskbarFlash,
|
||||
(v, c) => c.DutyFinderTaskbarFlash = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsDutyFinderMessage", "Chatlog message on duty pop"),
|
||||
("DalamudSettingsDutyFinderMessageHint", "Send a message in FFXIV chat when a duty is ready."),
|
||||
LazyLoc.Localize("DalamudSettingsDutyFinderMessage", "Chatlog message on duty pop"),
|
||||
LazyLoc.Localize("DalamudSettingsDutyFinderMessageHint", "Send a message in FFXIV chat when a duty is ready."),
|
||||
c => c.DutyFinderChatMessage,
|
||||
(v, c) => c.DutyFinderChatMessage = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsPrintDalamudWelcomeMsg", "Display Dalamud's welcome message"),
|
||||
("DalamudSettingsPrintDalamudWelcomeMsgHint", "Display Dalamud's welcome message in FFXIV chat when logging in with a character."),
|
||||
LazyLoc.Localize("DalamudSettingsPrintDalamudWelcomeMsg", "Display Dalamud's welcome message"),
|
||||
LazyLoc.Localize("DalamudSettingsPrintDalamudWelcomeMsgHint", "Display Dalamud's welcome message in FFXIV chat when logging in with a character."),
|
||||
c => c.PrintDalamudWelcomeMsg,
|
||||
(v, c) => c.PrintDalamudWelcomeMsg = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsPrintPluginsWelcomeMsg", "Display loaded plugins in the welcome message"),
|
||||
("DalamudSettingsPrintPluginsWelcomeMsgHint", "Display loaded plugins in FFXIV chat when logging in with a character."),
|
||||
LazyLoc.Localize("DalamudSettingsPrintPluginsWelcomeMsg", "Display loaded plugins in the welcome message"),
|
||||
LazyLoc.Localize("DalamudSettingsPrintPluginsWelcomeMsgHint", "Display loaded plugins in FFXIV chat when logging in with a character."),
|
||||
c => c.PrintPluginsWelcomeMsg,
|
||||
(v, c) => c.PrintPluginsWelcomeMsg = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsSystemMenu", "Dalamud buttons in system menu"),
|
||||
("DalamudSettingsSystemMenuMsgHint", "Add buttons for Dalamud plugins and settings to the system menu."),
|
||||
LazyLoc.Localize("DalamudSettingsSystemMenu", "Dalamud buttons in system menu"),
|
||||
LazyLoc.Localize("DalamudSettingsSystemMenuMsgHint", "Add buttons for Dalamud plugins and settings to the system menu."),
|
||||
c => c.DoButtonsSystemMenu,
|
||||
(v, c) => c.DoButtonsSystemMenu = v),
|
||||
|
||||
new GapSettingsEntry(5),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingDoMbCollect", "Anonymously upload market board data"),
|
||||
("DalamudSettingDoMbCollectHint", "Anonymously provide data about in-game economics to Universalis when browsing the market board. This data can't be tied to you in any way and everyone benefits!"),
|
||||
LazyLoc.Localize("DalamudSettingDoMbCollect", "Anonymously upload market board data"),
|
||||
LazyLoc.Localize("DalamudSettingDoMbCollectHint", "Anonymously provide data about in-game economics to Universalis when browsing the market board. This data can't be tied to you in any way and everyone benefits!"),
|
||||
c => c.IsMbCollect,
|
||||
(v, c) => c.IsMbCollect = v),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
|||
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Utility;
|
||||
using Dalamud.Utility.Internal;
|
||||
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||
|
|
@ -45,18 +47,18 @@ internal sealed class SettingsTabLook : SettingsTab
|
|||
new GapSettingsEntry(5, true),
|
||||
|
||||
new ButtonSettingsEntry(
|
||||
("DalamudSettingsOpenStyleEditor", "Open Style Editor"),
|
||||
("DalamudSettingsStyleEditorHint", "Modify the look & feel of Dalamud windows."),
|
||||
LazyLoc.Localize("DalamudSettingsOpenStyleEditor", "Open Style Editor"),
|
||||
LazyLoc.Localize("DalamudSettingsStyleEditorHint", "Modify the look & feel of Dalamud windows."),
|
||||
() => Service<DalamudInterface>.Get().OpenStyleEditor()),
|
||||
|
||||
new ButtonSettingsEntry(
|
||||
("DalamudSettingsOpenNotificationEditor", "Modify Notification Position"),
|
||||
("DalamudSettingsNotificationEditorHint", "Choose where Dalamud notifications appear on the screen."),
|
||||
LazyLoc.Localize("DalamudSettingsOpenNotificationEditor", "Modify Notification Position"),
|
||||
LazyLoc.Localize("DalamudSettingsNotificationEditorHint", "Choose where Dalamud notifications appear on the screen."),
|
||||
() => Service<NotificationManager>.Get().StartPositionChooser()),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingsUseDarkMode", "Use Windows immersive/dark mode"),
|
||||
("DalamudSettingsUseDarkModeHint", "This will cause the FFXIV window title bar to follow your preferred Windows color settings, and switch to dark mode if enabled."),
|
||||
LazyLoc.Localize("DalamudSettingsUseDarkMode", "Use Windows immersive/dark mode"),
|
||||
LazyLoc.Localize("DalamudSettingsUseDarkModeHint", "This will cause the FFXIV window title bar to follow your preferred Windows color settings, and switch to dark mode if enabled."),
|
||||
c => c.WindowIsImmersive,
|
||||
(v, c) => c.WindowIsImmersive = v,
|
||||
b =>
|
||||
|
|
@ -74,87 +76,87 @@ internal sealed class SettingsTabLook : SettingsTab
|
|||
|
||||
new GapSettingsEntry(5, true),
|
||||
|
||||
new HintSettingsEntry(("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below.")),
|
||||
new HintSettingsEntry(LazyLoc.Localize("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below.")),
|
||||
new GapSettingsEntry(3),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is toggled off"),
|
||||
("DalamudSettingToggleUiHideHint", "Hide any open windows by plugins when toggling the game overlay."),
|
||||
LazyLoc.Localize("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is toggled off"),
|
||||
LazyLoc.Localize("DalamudSettingToggleUiHideHint", "Hide any open windows by plugins when toggling the game overlay."),
|
||||
c => c.ToggleUiHide,
|
||||
(v, c) => c.ToggleUiHide = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleUiHideDuringCutscenes", "Hide plugin UI during cutscenes"),
|
||||
("DalamudSettingToggleUiHideDuringCutscenesHint", "Hide any open windows by plugins during cutscenes."),
|
||||
LazyLoc.Localize("DalamudSettingToggleUiHideDuringCutscenes", "Hide plugin UI during cutscenes"),
|
||||
LazyLoc.Localize("DalamudSettingToggleUiHideDuringCutscenesHint", "Hide any open windows by plugins during cutscenes."),
|
||||
c => c.ToggleUiHideDuringCutscenes,
|
||||
(v, c) => c.ToggleUiHideDuringCutscenes = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleUiHideDuringGpose", "Hide plugin UI while gpose is active"),
|
||||
("DalamudSettingToggleUiHideDuringGposeHint", "Hide any open windows by plugins while gpose is active."),
|
||||
LazyLoc.Localize("DalamudSettingToggleUiHideDuringGpose", "Hide plugin UI while gpose is active"),
|
||||
LazyLoc.Localize("DalamudSettingToggleUiHideDuringGposeHint", "Hide any open windows by plugins while gpose is active."),
|
||||
c => c.ToggleUiHideDuringGpose,
|
||||
(v, c) => c.ToggleUiHideDuringGpose = v),
|
||||
|
||||
new GapSettingsEntry(5, true),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleFocusManagement", "Use escape to close Dalamud windows"),
|
||||
("DalamudSettingToggleFocusManagementHint", "This will cause Dalamud windows to behave like in-game windows when pressing escape.\nThey will close one after another until all are closed. May not work for all plugins."),
|
||||
LazyLoc.Localize("DalamudSettingToggleFocusManagement", "Use escape to close Dalamud windows"),
|
||||
LazyLoc.Localize("DalamudSettingToggleFocusManagementHint", "This will cause Dalamud windows to behave like in-game windows when pressing escape.\nThey will close one after another until all are closed. May not work for all plugins."),
|
||||
c => c.IsFocusManagementEnabled,
|
||||
(v, c) => c.IsFocusManagementEnabled = v),
|
||||
|
||||
// This is applied every frame in InterfaceManager::CheckViewportState()
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleViewports", "Enable multi-monitor windows"),
|
||||
("DalamudSettingToggleViewportsHint", "This will allow you move plugin windows onto other monitors.\nWill only work in Borderless Window or Windowed mode."),
|
||||
LazyLoc.Localize("DalamudSettingToggleViewports", "Enable multi-monitor windows"),
|
||||
LazyLoc.Localize("DalamudSettingToggleViewportsHint", "This will allow you move plugin windows onto other monitors.\nWill only work in Borderless Window or Windowed mode."),
|
||||
c => !c.IsDisableViewport,
|
||||
(v, c) => c.IsDisableViewport = !v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleDocking", "Enable window docking"),
|
||||
("DalamudSettingToggleDockingHint", "This will allow you to fuse and tab plugin windows."),
|
||||
LazyLoc.Localize("DalamudSettingToggleDocking", "Enable window docking"),
|
||||
LazyLoc.Localize("DalamudSettingToggleDockingHint", "This will allow you to fuse and tab plugin windows."),
|
||||
c => c.IsDocking,
|
||||
(v, c) => c.IsDocking = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingEnablePluginUIAdditionalOptions", "Add a button to the title bar of plugin windows to open additional options"),
|
||||
("DalamudSettingEnablePluginUIAdditionalOptionsHint", "This will allow you to pin certain plugin windows, make them clickthrough or adjust their opacity.\nThis may not be supported by all of your plugins. Contact the plugin author if you want them to support this feature."),
|
||||
LazyLoc.Localize("DalamudSettingEnablePluginUIAdditionalOptions", "Add a button to the title bar of plugin windows to open additional options"),
|
||||
LazyLoc.Localize("DalamudSettingEnablePluginUIAdditionalOptionsHint", "This will allow you to pin certain plugin windows, make them clickthrough or adjust their opacity.\nThis may not be supported by all of your plugins. Contact the plugin author if you want them to support this feature."),
|
||||
c => c.EnablePluginUiAdditionalOptions,
|
||||
(v, c) => c.EnablePluginUiAdditionalOptions = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingEnablePluginUISoundEffects", "Enable sound effects for plugin windows"),
|
||||
("DalamudSettingEnablePluginUISoundEffectsHint", "This will allow you to enable or disable sound effects generated by plugin user interfaces.\nThis is affected by your in-game `System Sounds` volume settings."),
|
||||
LazyLoc.Localize("DalamudSettingEnablePluginUISoundEffects", "Enable sound effects for plugin windows"),
|
||||
LazyLoc.Localize("DalamudSettingEnablePluginUISoundEffectsHint", "This will allow you to enable or disable sound effects generated by plugin user interfaces.\nThis is affected by your in-game `System Sounds` volume settings."),
|
||||
c => c.EnablePluginUISoundEffects,
|
||||
(v, c) => c.EnablePluginUISoundEffects = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleGamepadNavigation", "Control plugins via gamepad"),
|
||||
("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and plugin navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."),
|
||||
LazyLoc.Localize("DalamudSettingToggleGamepadNavigation", "Control plugins via gamepad"),
|
||||
LazyLoc.Localize("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and plugin navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."),
|
||||
c => c.IsGamepadNavigationEnabled,
|
||||
(v, c) => c.IsGamepadNavigationEnabled = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingToggleTsm", "Show title screen menu"),
|
||||
("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen.\nDisabling this will also hide the Dalamud version text on the title screen."),
|
||||
LazyLoc.Localize("DalamudSettingToggleTsm", "Show title screen menu"),
|
||||
LazyLoc.Localize("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen.\nDisabling this will also hide the Dalamud version text on the title screen."),
|
||||
c => c.ShowTsm,
|
||||
(v, c) => c.ShowTsm = v),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingInstallerOpenDefault", "Open the Plugin Installer to the \"Installed Plugins\" tab by default"),
|
||||
("DalamudSettingInstallerOpenDefaultHint", "This will allow you to open the Plugin Installer to the \"Installed Plugins\" tab by default, instead of the \"Available Plugins\" tab."),
|
||||
LazyLoc.Localize("DalamudSettingInstallerOpenDefault", "Open the Plugin Installer to the \"Installed Plugins\" tab by default"),
|
||||
LazyLoc.Localize("DalamudSettingInstallerOpenDefaultHint", "This will allow you to open the Plugin Installer to the \"Installed Plugins\" tab by default, instead of the \"Available Plugins\" tab."),
|
||||
c => c.PluginInstallerOpen == PluginInstallerOpenKind.InstalledPlugins,
|
||||
(v, c) => c.PluginInstallerOpen = v ? PluginInstallerOpenKind.InstalledPlugins : PluginInstallerOpenKind.AllPlugins),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
("DalamudSettingReducedMotion", "Reduce motions"),
|
||||
("DalamudSettingReducedMotionHint", "This will suppress certain animations from Dalamud, such as the notification popup."),
|
||||
LazyLoc.Localize("DalamudSettingReducedMotion", "Reduce motions"),
|
||||
LazyLoc.Localize("DalamudSettingReducedMotionHint", "This will suppress certain animations from Dalamud, such as the notification popup."),
|
||||
c => c.ReduceMotions ?? false,
|
||||
(v, c) => c.ReduceMotions = v),
|
||||
|
||||
new SettingsEntry<float>(
|
||||
("DalamudSettingImeStateIndicatorOpacity", "IME State Indicator Opacity (CJK only)"),
|
||||
("DalamudSettingImeStateIndicatorOpacityHint", "When any of CJK IMEs is in use, the state of IME will be shown with the opacity specified here."),
|
||||
LazyLoc.Localize("DalamudSettingImeStateIndicatorOpacity", "IME State Indicator Opacity (CJK only)"),
|
||||
LazyLoc.Localize("DalamudSettingImeStateIndicatorOpacityHint", "When any of CJK IMEs is in use, the state of IME will be shown with the opacity specified here."),
|
||||
c => c.ImeStateIndicatorOpacity,
|
||||
(v, c) => c.ImeStateIndicatorOpacity = v)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
|||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||
internal sealed class ButtonSettingsEntry : SettingsEntry
|
||||
{
|
||||
private readonly LocRef description;
|
||||
private readonly LazyLoc description;
|
||||
private readonly Action runs;
|
||||
|
||||
public ButtonSettingsEntry(LocRef name, LocRef description, Action runs)
|
||||
public ButtonSettingsEntry(LazyLoc name, LazyLoc description, Action runs)
|
||||
{
|
||||
this.description = description;
|
||||
this.runs = runs;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Numerics;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using CheapLoc;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Configuration.Internal;
|
||||
|
|
@ -15,6 +16,7 @@ using Dalamud.Interface.ImGuiFileDialog;
|
|||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Utility.Internal;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||
|
||||
|
|
@ -29,7 +31,7 @@ internal sealed class DevPluginsSettingsEntry : SettingsEntry
|
|||
|
||||
public DevPluginsSettingsEntry()
|
||||
{
|
||||
this.Name = ("DalamudSettingsDevPluginLocation", "Dev Plugin Locations");
|
||||
this.Name = LazyLoc.Localize("DalamudSettingsDevPluginLocation", "Dev Plugin Locations");
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ internal sealed class EnumSettingsEntry<T> : SettingsEntry
|
|||
private T valueBacking;
|
||||
|
||||
public EnumSettingsEntry(
|
||||
LocRef name,
|
||||
LocRef description,
|
||||
LazyLoc name,
|
||||
LazyLoc description,
|
||||
LoadSettingDelegate load,
|
||||
SaveSettingDelegate save,
|
||||
Action<T>? change = null,
|
||||
|
|
@ -64,7 +64,7 @@ internal sealed class EnumSettingsEntry<T> : SettingsEntry
|
|||
}
|
||||
}
|
||||
|
||||
public LocRef Description { get; }
|
||||
public LazyLoc Description { get; }
|
||||
|
||||
public Action<EnumSettingsEntry<T>>? CustomDraw { get; init; }
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
|||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||
internal sealed class HintSettingsEntry : SettingsEntry
|
||||
{
|
||||
private readonly LocRef text;
|
||||
private readonly LazyLoc text;
|
||||
private readonly Vector4 color;
|
||||
|
||||
public HintSettingsEntry(LocRef text, Vector4? color = null)
|
||||
public HintSettingsEntry(LazyLoc text, Vector4? color = null)
|
||||
{
|
||||
this.text = text;
|
||||
this.color = color ?? ImGuiColors.DalamudGrey;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Linq;
|
||||
|
||||
using CheapLoc;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Utility.Internal;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||
|
||||
|
|
@ -21,7 +23,7 @@ internal sealed class LanguageChooserSettingsEntry : SettingsEntry
|
|||
{
|
||||
this.languages = [.. Localization.ApplicableLangCodes.Prepend("en")];
|
||||
|
||||
this.Name = ("DalamudSettingsLanguage", "Language");
|
||||
this.Name = LazyLoc.Localize("DalamudSettingsLanguage", "Language");
|
||||
this.IsValid = true;
|
||||
this.IsVisible = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
|||
private object? valueBacking;
|
||||
|
||||
public SettingsEntry(
|
||||
LocRef name,
|
||||
LocRef description,
|
||||
LazyLoc name,
|
||||
LazyLoc description,
|
||||
LoadSettingDelegate load,
|
||||
SaveSettingDelegate save,
|
||||
Action<T?>? change = null,
|
||||
|
|
@ -55,7 +55,7 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
|||
}
|
||||
}
|
||||
|
||||
public LocRef Description { get; }
|
||||
public LazyLoc Description { get; }
|
||||
|
||||
public Action<SettingsEntry<T>>? CustomDraw { get; init; }
|
||||
|
||||
|
|
|
|||
31
Dalamud/Utility/Internal/LazyLoc.cs
Normal file
31
Dalamud/Utility/Internal/LazyLoc.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using CheapLoc;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace Dalamud.Utility.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a lazily localized string, consisting of a localization key and a fallback value.
|
||||
/// </summary>
|
||||
/// <param name="Key">The localization key used to retrieve the localized value.</param>
|
||||
/// <param name="Fallback">The fallback text to use if the localization key is not found.</param>
|
||||
internal readonly record struct LazyLoc(string Key, string Fallback)
|
||||
{
|
||||
public static implicit operator ImU8String(LazyLoc locRef)
|
||||
=> new(locRef.ToString());
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="LazyLoc"/> with the specified localization key and fallback text.
|
||||
/// </summary>
|
||||
/// <param name="key">The localization key used to retrieve the localized value.</param>
|
||||
/// <param name="fallback">The fallback text to use if the localization key is not found.</param>
|
||||
/// <returns>A <see cref="LazyLoc"/> instance representing the localized value.</returns>
|
||||
public static LazyLoc Localize(string key, string fallback)
|
||||
=> new(key, fallback);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return Loc.Localize(this.Key, this.Fallback);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using CheapLoc;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace Dalamud.Utility.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a localization reference consisting of a key and a fallback text.
|
||||
/// </summary>
|
||||
/// <param name="Key">The localization key used to retrieve the localized text.</param>
|
||||
/// <param name="Fallback">The fallback text to use if the localization key is not found.</param>
|
||||
internal readonly record struct LocRef(string Key, string Fallback)
|
||||
{
|
||||
public static implicit operator LocRef((string Key, string Fallback) tuple)
|
||||
=> new(tuple.Key, tuple.Fallback);
|
||||
|
||||
public static implicit operator ImU8String(LocRef locRef)
|
||||
=> new(locRef.ToString());
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return Loc.Localize(this.Key, this.Fallback);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue