Is your feature request related to a problem? Please describe.
While we are not aiming to ship a single standardized localization solution that fits everybody (at least just yet), we need to provide all the building blocks that might be necessary for the developers.
Next step from now is adding low-level platform API to read current system language used for apps.
PlatformSettings is typically a host for such members.
Following step would be current app language. This language can then be used by different components, third party controls, and built-in controls (like NumericUpDown).
.NET has existing CultureInfo.CurrentUICulture property, but it lacks any culture change notification mechanism.
We can follow API similar to theme variants, that allows app-wide languages.
Describe the solution you'd like
public interface IPlatformSettings
{
+ string SystemLanguage { get; }
+ event EventHandler SystemLanguageChanged;
}
public class Application
{
+ public static DirectProperty<string> ActualLanguageProperty;
+ public static StyledProperty<string?> RequestedLanguageProperty;
+ public string ActualLanguage { get; }
+ public string? RequestedLanguage { get; set; }
}
Describe alternatives you've considered
With these APIs, we are considering implementing an opinionated localization framework, as an optional package and not part of Avalonia Core.
Additional context
BCP-47 is expected to be used.
Is your feature request related to a problem? Please describe.
While we are not aiming to ship a single standardized localization solution that fits everybody (at least just yet), we need to provide all the building blocks that might be necessary for the developers.
Next step from now is adding low-level platform API to read current system language used for apps.
PlatformSettingsis typically a host for such members.Following step would be current app language. This language can then be used by different components, third party controls, and built-in controls (like NumericUpDown).
.NET has existing CultureInfo.CurrentUICulture property, but it lacks any culture change notification mechanism.
We can follow API similar to theme variants, that allows app-wide languages.
Describe the solution you'd like
public interface IPlatformSettings { + string SystemLanguage { get; } + event EventHandler SystemLanguageChanged; } public class Application { + public static DirectProperty<string> ActualLanguageProperty; + public static StyledProperty<string?> RequestedLanguageProperty; + public string ActualLanguage { get; } + public string? RequestedLanguage { get; set; } }Describe alternatives you've considered
With these APIs, we are considering implementing an opinionated localization framework, as an optional package and not part of Avalonia Core.
Additional context
BCP-47is expected to be used.