mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Update Settings Window (#2400)
* Load new localization before firing change event * Update texts in SettingsWindow when locale changes * Localize settings search * Update settings search input - Disable when Credits are scrolling, so Search Results aren't shown instead - Select all on single click, as usual for a search bar * Remove unused IsVisible property * Fix General tab being unselected on language change * Fix search results throwing, oops * Missed using LocRef in EnumSettingsEntry * Set CultureInfo before loading locs * Change it to LazyLoc instead So CheapLoc can export localizations...
This commit is contained in:
parent
efaff769b5
commit
d61a35b81f
20 changed files with 341 additions and 283 deletions
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue