Update README.md
This commit is contained in:
@@ -34,6 +34,19 @@ public partial class App : Application
|
||||
.Build();
|
||||
|
||||
host.Start();
|
||||
|
||||
// Apply persisted language before any UI is created so bindings resolve to the saved culture.
|
||||
try
|
||||
{
|
||||
var settings = host.Services.GetRequiredService<SettingsService>().GetSettingsAsync().GetAwaiter().GetResult();
|
||||
if (!string.IsNullOrWhiteSpace(settings.Lang))
|
||||
Localization.TranslationSource.Instance.CurrentCulture = new System.Globalization.CultureInfo(settings.Lang);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning(ex, "Failed to apply persisted language at startup");
|
||||
}
|
||||
|
||||
App app = new();
|
||||
app.InitializeComponent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user