views:

214

answers:

2

What steps are required to localise a WPF application so that right to left languages are displayed correctly?

A: 

I have tried setting the FlowDirection attribute and changing the culture but the GUI does not seem to flip.

Thomas Bratt
A: 

I realize its an old question but I am stuck with this as well so am adding what I've done (which works partially) in the hope that someone will add more to it

In your app.cs you can do something like this

    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        FrameworkElement.LanguageProperty.OverrideMetadata(
          typeof(FrameworkElement),
          new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

        FrameworkElement.FlowDirectionProperty.OverrideMetadata(
        typeof(FrameworkElement),
        new FrameworkPropertyMetadata(CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft
                                      ? FlowDirection.RightToLeft : FlowDirection.LeftToRight));

    }

Now this flips everything all right but it also happens to flip all images which is not what you really want.

NVM