2026-03-31 21:17:24 -05:00
|
|
|
using Avalonia;
|
|
|
|
|
|
2026-06-06 05:49:24 -05:00
|
|
|
namespace LANCommander.Launcher.Helpers;
|
2026-03-31 21:17:24 -05:00
|
|
|
|
|
|
|
|
public static class Localization
|
|
|
|
|
{
|
|
|
|
|
public static string Localize(string key, params object[] args)
|
|
|
|
|
{
|
|
|
|
|
string? s = null;
|
|
|
|
|
|
|
|
|
|
// Pass null for themeVariant so non-theme-specific resources in merged
|
|
|
|
|
// dictionaries are always found, regardless of which thread calls this.
|
|
|
|
|
var app = Application.Current;
|
|
|
|
|
if (app != null)
|
|
|
|
|
{
|
|
|
|
|
app.TryGetResource(key, null, out var resource);
|
|
|
|
|
s = resource as string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s ??= key;
|
|
|
|
|
return args.Length == 0 ? s : string.Format(s, args);
|
|
|
|
|
}
|
|
|
|
|
}
|