1

i am trying to globalization in my wpf application but i am confused about Culture, Language and flowdirection issue. I am trying to switch between english and arabic language in my application. I search about this issue but i am really confused.

I write simple code in wpf

   <StackPanel>
        <TextBlock 
            Background="Lavender" 
            FontSize="32" 
            Text="1+2=3"/>
    </StackPanel>

and my codebehind

var culture = new CultureInfo("ar-EA");
culture.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;

CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;

i expect show numericals in arabic because i set DigitSubstitution to nativenational but does not show. And i said okey, let set language.. and i set language to ar-EA" in wpf. Like the following code

   <StackPanel>
        <TextBlock 
            Background="Lavender" 
            FontSize="32" 
            Text="1+2=3"
            Language="ar-EA"/>
    </StackPanel>

and nothing change.. After this, i try change flowdirection like following code

   <StackPanel>
        <TextBlock 
            Background="Lavender" 
            FontSize="32" 
            Text="1+2=3"
            Language="ar-EA"
            FlowDirection="RightToLeft"/>
    </StackPanel>

And finally change Europian numericals to Western numericals. I do not let it go and try harder and remove language line in code and again Europian sytle numbers shown.

I am really curious what is relation between Culture, FlowDirection and Language..

bluebird
  • 41
  • 3
  • First of all - welcome to StackOverflow! You can set default culture using `CultureInfo.DefaultThreadCurrentCulture = ...` like shown in [this answer](https://stackoverflow.com/a/24135792/8065832). Also, you can globally set a default value for property for all framework elements. An example of that is in the same link I gave you (look at the question code). I'm not posting a whole answer because there is much more to talk about to fully answer your question. These are only tips. – Prolog Apr 11 '19 at 09:02
  • I am work only one thread. So i think i do not need set default thread current culture. Its okey set curretculture. (as i understand from this article https://github.com/jbe2277/waf/wiki/CurrentCulture-vs.-CurrentUICulture) – bluebird Apr 11 '19 at 09:19

0 Answers0