Repository navigation
Follow the language the OS prefers for apps - #200
Merged
Merged
Conversation
The "system" language option took CultureInfo.CurrentUICulture. Avalonia 12.2 reports the language the operating system prefers for applications, which on Windows comes from the Windows 11 preferred languages list and on macOS from the native preferred language, so use it and keep the .NET UI culture as the fallback when the platform reports nothing or an unknown tag. LocalizationService now takes the system culture in its constructor, so tests don't depend on what the headless platform reports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "System" language option resolved to
CultureInfo.CurrentUICulture. Avalonia 12.2 addsIPlatformSettings.PreferredApplicationLanguage, so the app now takes that and keeps the .NET UI culture as the fallback.GlobalizationPreferences.Languages, which follows the Windows 11 preferred languages list (its own comment saysGetUserPreferredUILanguagesdoes not).CultureInfo.InstalledUICulture, so in practice nothing changes there.LanguageCatalog.ResolveSystemCultureturns the tag into a culture and falls back on an empty or unknown tag.LocalizationServicetakes the system culture in its constructor, so tests no longer depend on what the headless platform reports.The resolved culture also becomes
CurrentCulture(as before), so if the OS reports a neutral tag such ascs, date and number formats come from the neutral culture rather thancs-CZ. The language is read once at startup; a change in the OS applies after a restart, as before.Build and all 1554 tests pass locally. Not tried on a real Windows 11 or macOS machine with differing language settings.