How to translate CultureInfo language names

I know of three ways to get a full language name of a CultureInfo object.

CultureInfo.DisplayName   
CultureInfo.NativeName  
CultureInfo.EnglishName

DisplayName gives the name in the installed .net language.
NativeName gives the name in 'CultureInfos' language.
EnglishName gives the name in English (surprisingly...)

So for CultureInfo de-DE this gives (on an English .net installation)
German
Deutsch
German

Now my question: Is there a way to ask for the language name of de-DE in another language? E.g. I want the language name of de-DE in Dutch (which would be 'Duits').


Solution 1:

This functionality isn't built into the .NET Framework

Maybe look at Google Translate API

Solution 2:

Example for CultureInfo.EnglishName:

    public CultureInfo GetCultureInfo(string EnglishName)
    {
        foreach (CultureInfo info in CultureInfo.GetCultures(CultureTypes.AllCultures))
        {
            if (info.EnglishName == EnglishName)
                return new CultureInfo(info.Name);
        }

        return null;
    }

Solution 3:

In principle the following code works:

private static ResourceManager resourceManager = new ResourceManager("mscorlib", typeof(int).Assembly);

public static string CultureName(CultureInfo culture, CultureInfo displayCulture)
{
    return resourceManager.GetString("Globalization.ci_" + culture.Name, displayCulture);
}

However there are important limitations:

  • It relies on undocumented behaviour, so it can break with updates of Windows or .NET
  • The display language needs to be installed on the Computer you run it on. You can install additional languages, depending on the edition of Windows you're using.

    On most computers there is only one installed language, making this a pointless exercise in most cases.