0

We are developing a localized English/Arabic application, and I need to set the System.Threading.Thread.CurrentThread.CurrentUiCulture to either of both cultures during design time to a different value than the value set at run time.

How can I accomplish this?

Thanks in advance.

Mohammed A. Fadil
  • 9,205
  • 7
  • 50
  • 67
  • Are you sure you're going about this the right way? Normally you would set the form's "Localizable" property to true and then select a language for the form from the "Language" property droplist. Then you get a separate form for that language to customize. – Matthew Watson Apr 26 '12 at 07:44
  • @MatthewWatson, but I am using WPF, there is no property like that in the Window class. – Mohammed A. Fadil Apr 26 '12 at 08:18

4 Answers4

1

Set the xml:lang attribute.

This attribute describes the culture of a specific element and its child elements. The value of this property changes the behavior of several features in WPF. For example, it changes the behavior of hyphenation, spell checking, number substitution, complex script shaping, and font fallback. See Globalization for WPF for more information about setting the xml:lang Handling in XAML.

http://msdn.microsoft.com/en-us/library/ms788718.aspx

Ralf de Kleine
  • 11,464
  • 5
  • 45
  • 87
1

Check this out http://geekswithblogs.net/lbugnion/archive/2009/09/05/detecting-design-time-mode-in-wpf-and-silverlight.aspx, you can then set the Language accordingly with something like

FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name)));
Dtex
  • 2,593
  • 1
  • 16
  • 17
1

The WPF Localization Extension allows you to set design time language (and it has other features, like allowing you to change languages at runtime through WPF with no code-behind etc.).

Check it out here: http://wpflocalizeextension.codeplex.com/

Amadeus Hein
  • 706
  • 1
  • 4
  • 12
0

The designer uses the current culture of your Windows session. Change the culture in your Windows setting.

Regis St-Gelais
  • 3,156
  • 5
  • 27
  • 40