Describe the bug
After setting ApplicationLanguages.PrimaryLanguageOverride, the new pages use old x:Uid. Restart only refresh it. The code below updates x:Uid in UWP but doesn't in WinUI.
The following sub-links also don't solve the problem:
UWP - Change of Languages
Are in WinUI the way to update x:Uid in runtime without manually updating strings in response to qualifier value change events?
Steps to reproduce the bug
Steps to reproduce the behavior:
- Add "Hello.Text" to
Strings/en/Resources.resw and to Strings/ru/Resources.resw
- Assign
x:Uid to TextBlock
- Copy templated UWP code from
OnLaunched and eliminate the errors (base.Frame is null by default in WinUI)
- Add handler to button:
private void myButton_Click(object sender, RoutedEventArgs e)
{
string lang = ApplicationLanguages.PrimaryLanguageOverride is "en" ? "ru" : "en";
ApplicationLanguages.PrimaryLanguageOverride = lang;
ResourceContext.GetForViewIndependentUse().Reset();
Frame.Navigate(typeof(MainPage)); //old
new Window { Content = new MainPage() }.Activate(); //old
//it works, but not in XAML
string newLanguage = ResourceLoader.GetForViewIndependentUse().GetString("Hello/Text");
}
Expected behavior
The newly created Page/Window has the desired localizated x:Uid.
Version Info
[WinUI 3 - Windows App SDK 0.8: 0.8.0]
[WinUI 3 - Windows App SDK 1.0.0-preview1]
Windows app type:
| Windows version |
Saw the problem? |
| Insider Build (22000) |
Yes |
| May 2021 Update (19043) |
|
| October 2020 Update (19042) |
|
| May 2020 Update (19041) |
|
| November 2019 Update (18363) |
|
| May 2019 Update (18362) |
|
| October 2018 Update (17763) |
|
| April 2018 Update (17134) |
|
| Fall Creators Update (16299) |
|
| Creators Update (15063) |
|
| Device form factor |
Saw the problem? |
| Desktop |
Yes |
| Xbox |
|
| Surface Hub |
|
| IoT |
|
Describe the bug
After setting
ApplicationLanguages.PrimaryLanguageOverride, the new pages use oldx:Uid. Restart only refresh it. The code below updatesx:Uidin UWP but doesn't in WinUI.The following sub-links also don't solve the problem:
UWP - Change of Languages
Are in WinUI the way to update x:Uid in runtime without manually updating strings in response to qualifier value change events?
Steps to reproduce the bug
Steps to reproduce the behavior:
Strings/en/Resources.reswand toStrings/ru/Resources.reswx:UidtoTextBlockOnLaunchedand eliminate the errors (base.Frameis null by default in WinUI)Expected behavior
The newly created
Page/Windowhas the desired localizatedx:Uid.Version Info
[WinUI 3 - Windows App SDK 0.8: 0.8.0]
[WinUI 3 - Windows App SDK 1.0.0-preview1]
Windows app type: