views:

26

answers:

2

I'm using the built-in ApplicationCommands to create a menu:

<Menu DockPanel.Dock="Top">
    <MenuItem Header="_Datei">
        <MenuItem Command="ApplicationCommands.New" />
        <MenuItem Command="ApplicationCommands.Open" />
        <MenuItem Command="ApplicationCommands.Save" />
        <MenuItem Command="ApplicationCommands.SaveAs" />
        <Separator />
        <MenuItem Header="Been_den" Command="{StaticResource SchliessenCommand}" />
    </MenuItem>
</Menu>

The text displayed by the ApplicationCommands differs depending on the system language: Running on an English Windows 7, ApplicationCommands.New displays as "New", whereas it displays as "Neu" on a German Windows 7.

Since the rest of the application is not localized, I want the application commands to always display in German language. Is there a way to do that without manually setting the Header of each MenuItem?

A: 

You should use bindings and manipulate your commands as bind objects (RelayCommands) to avoid the hardcoding of the headers of your different commands.

Matthieu
Please elaborate: How will that change the behaviour of the built-in ApplicationCommands?
Heinzi
+1  A: 

Since the application isn't localized, you can try to always set the language to german; that is, CultureInfo.CurrentUICulture, which is normally inherited from the OS (set it in application startup or something like that, before any windows are opened).

Alex Paven
Nice idea. Unfortunatly, Changing `CurrentUICulture` for the UI thread did not make a difference.
Heinzi
+1. I just found this thread, which seems to imply that your approach is correct, but on an English Windows, the satellite assemblies for German are just not installed: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/9d3f9534-4a10-4860-90b5-d2ea5c967fca
Heinzi