C# CultureInfo in currently selected language

53 Views Asked by At

I know how to get the native name..

enter image description here

And if I change the website profile language to say fr-FR

enter image description here

The "All Languages" translates (Toutes les langues) and everything stays in "NativeName"

What I would like to do, is for example, if English (en-US) is selected (for the Website language, not the dropdown):

  • English
  • French
  • German
  • Spanish

and if Spanish is selected (for the Website language, not the dropdown)

  • Inglés
  • Francés
  • Alemán
  • Español

and of course if there are 2 Spanish ones (es-MX, es-ES)

  • Español (MX)
  • Español (ES)

(or whatever the default translated language might be)

Watch

Note how the current thread is ja-JP and the CultureInfo has ja-JP for the US English CultureInfo (en-US), but I would expect DisplayName to actually use the locale / current thread setting to get that information.... without having to install language packs that is.

And for PMF who wanted the code sample, it is just a Dictionary<string, string> of Culture.Name and Culture.NativeName and in the dropdown it just uses the KVP for key and value.

0

There are 0 best solutions below