Tutorial :Localized System.Windows.Media.Color name



Question:

The standard color names are english names, ok. But my Application is german so I would like to have the color names in my ComboBox as german names. Instead of "Blue", "Yellow", etc. I would like to have "Blau", "Gelb", etc.

Is there a function that returns all localized names? Or is it that easy that I change the culture in this call?

<ObjectDataProvider MethodName="GetType"                      ObjectType="{x:Type sys:Type}"                      x:Key="colorsTypeOdp">      <ObjectDataProvider.MethodParameters>          <sys:String>System.Windows.Media.Colors, PresentationCore,      Version=3.0.0.0, Culture=neutral,       PublicKeyToken=31bf3856ad364e35</sys:String>      </ObjectDataProvider.MethodParameters>  </ObjectDataProvider>  


Solution:1

I have found a useful table that gives me some Translations (english names and german ones) The table can be found at: http://farbe-computer.de/kapitel33.html

I will use the texts and a Converter to display the german color names.

At Brandon .. I'll delete my answer as soon as I have RTFM :)


Solution:2

As a follow-up to peetee's question and link to this German page about Netscape color names, I've built a small C# wrapper class that you can drop-into your project.

To use, simply call it something similar to:

string germanName = ColorNameGermanTranslator.GetGermanName(Color.Green);  

and you get the German name back. It uses the English name as a fallback.


Solution:3

No, these are property names -- as much part of the code / class definition as the String.Length property -- not resources. Property names aren't localised.


Solution:4

Sorry, the code snippet was gone ... so here it is:

<ObjectDataProvider MethodName="GetType"                      ObjectType="{x:Type sys:Type}"                      x:Key="colorsTypeOdp">      <ObjectDataProvider.MethodParameters>          <sys:String>System.Windows.Media.Colors, PresentationCore,      Version=3.0.0.0, Culture=neutral,       PublicKeyToken=31bf3856ad364e35</sys:String>      </ObjectDataProvider.MethodParameters>  </ObjectDataProvider>  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »