-
Notifications
You must be signed in to change notification settings - Fork 774
Closed
Labels
area-MRTThis area only covers the usage of MRT inside of a WinUI 3 appThis area only covers the usage of MRT inside of a WinUI 3 appbugSomething isn't workingSomething isn't workingfix-releasedThe fix has been in a release (experimental, preview, stable, or servicing).The fix has been in a release (experimental, preview, stable, or servicing).group-languageproduct-winui3WinUI 3 issuesWinUI 3 issuesteam-MarkupIssue for the Markup teamIssue for the Markup teamv1.0.0-preview1
Milestone
Description
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.reswand toStrings/ru/Resources.resw - Assign
x:UidtoTextBlock - Copy templated UWP code from
OnLaunchedand eliminate the errors (base.Frameis 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:
| UWP | Win32 |
|---|---|
| Yes |
| 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 |
ghost1372, quangtrang1111, HavenDV, holecekp, wizcas and 1 more
Metadata
Metadata
Assignees
Labels
area-MRTThis area only covers the usage of MRT inside of a WinUI 3 appThis area only covers the usage of MRT inside of a WinUI 3 appbugSomething isn't workingSomething isn't workingfix-releasedThe fix has been in a release (experimental, preview, stable, or servicing).The fix has been in a release (experimental, preview, stable, or servicing).group-languageproduct-winui3WinUI 3 issuesWinUI 3 issuesteam-MarkupIssue for the Markup teamIssue for the Markup teamv1.0.0-preview1