MenuItem with ApplicationCommand doesn't get localized in self-contained deployment
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: 3.1.9/3.1.403
* Windows version: 1909 10.0.18363
* Does the bug reproduce also in WPF for .NET Framework 4.8?: N/A
**Problem description:**
When you bind a command from `ApplicationCommands` such as `Save` to a `MenuItem`, it is supposed to display a localized label and key shortcut.
**Actual behavior:**
On a machine with de-DE locale and a window with `Window.Language = "fr-FR"`:
If the program is published as framework-dependent or run from the build directory, the menu item is "Speichern Strg+S" (i.e in German).
If the program is published as self-contained, the menu item is "Save Ctrl+S". Note that `CultureInfo.CurrentCulture` and `CultureInfo.CurrentUICulture` both return de-DE. Date and number formatting also follow de-DE culture.
**Expected behavior:**
In both cases the `MenuItem`should be localized to de-DE or fr-FR (not sure about the semantics of `Window.Language`).
**Minimal repro:**
Start with "WPF App (.Net Core)" template.
MainWindow.xaml:
```XAML
```
MainWindow.xaml.cs (default except command handler with optional test output):
```C#
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Input;
namespace ReproPublish
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void CommandSave_Executed(object sender, ExecutedRoutedEventArgs e)
{
MessageBox.Show(this, $"CC: {CultureInfo.CurrentCulture.Name}\nCUIC: {CultureInfo.CurrentUICulture.Name}\nTime: {DateTime.Today}\nNumber: {1.5}");
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.