wizzardz
wizzardz

Reputation: 5874

How to get keyboard layout name from a keyboard layout identifier?

My application has to display all the installed input languages in the system and the keyboard layouts against each input languages.

For example:

   [InputLaguage]
    Tamil
      [Keyboard layouts]
        US
        Murasu Anjal
        Tamil
    English
        US

We can get installed language identifiers and keyboard layout identifiers from the

  GetKeyboardLayoutList(User32.dll) 

API function by splitting LWORD and HWORD.

But I didn’t find a way to get a keyboard layout name from the keyboard layout identifier. From the above example, I have to get the US, Murasu Anjal and Tamil against Tamil language.

Please help…

Thanks

Upvotes: 3

Views: 5596

Answers (5)

DJm00n
DJm00n

Reputation: 1411

Getting KLID from HKL is a bit tricky and answered here.

Current layout KLID (do not confuse with LCID) may be found by a GetKeyboardLayoutName ("name" is misleading here) call. Having the KLID string, you can get localized keyboard layout name (for example "Ukrainian (Enhanced)" string from "00020422").

To do this, according to Create Resources for Keyboard Layout Strings:

If your application implements a keyboard layout, it requires a localizable string resource for the name of the layout for screen display, for example, in lists of keyboard layouts. Each keyboard layout has a registry key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts.

Among the values for that key are Layout Text, a human-readable name for backward compatibility, and Layout Display Name. The data supplied for Layout Display Name should be a string reference of the form @<path>,-resID, referring to a localizable string resource associated with the keyboard layout.

You can use RegLoadMUIString API to load a language-neutral registry value in @<path>,-resID format. Alternatively, you can use SHLoadIndirectString that works with already loaded strings in this format.

You can look at System.Windows.Forms.InputLanguage.LayoutName implementation for example code with fallback string:

private const string KeyboardLayoutsRegistryPath = @"SYSTEM\CurrentControlSet\Control\Keyboard Layouts";


/// <summary>
///  Returns the name of the current keyboard layout as it appears in the Windows
///  Regional Settings on the computer.
/// </summary>
public string LayoutName
{
    get
    {
        // https://learn.microsoft.com/windows/win32/intl/using-registry-string-redirection#create-resources-for-keyboard-layout-strings
        using RegistryKey? key = Registry.LocalMachine.OpenSubKey($@"{KeyboardLayoutsRegistryPath}\{LayoutId}");
        return key.GetMUIString("Layout Display Name", "Layout Text") ?? SR.UnknownInputLanguageLayout;
    }
}

public static string? GetMUIString(this RegistryKey? key, string keyName, string fallbackKeyName)
{
    return key is not null
        ? PInvoke.RegLoadMUIString(key, keyName, out var localizedValue)
            ? localizedValue
            : key.GetValue(fallbackKeyName) is string value
                ? value
                : null
        : null;
}

[SkipLocalsInit]
public static unsafe bool RegLoadMUIString(RegistryKey key, string keyName, out string localizedValue)
{
    using BufferScope<char> buffer = new(stackalloc char[128]);

    while (true)
    {
        fixed (char* pszOutBuf = buffer)
        {
            uint bytes = 0;
            var errorCode = RegLoadMUIString(
                (System.Registry.HKEY)key.Handle.DangerousGetHandle(),
                keyName,
                pszOutBuf,
                (uint)(buffer.Length * sizeof(char)),
                &bytes,
                0,
                null);

            // The buffer is too small. Try again with a larger buffer.
            if (errorCode == WIN32_ERROR.ERROR_MORE_DATA)
            {
                buffer.EnsureCapacity((int)(bytes / sizeof(char)));
                continue;
            }

            localizedValue = errorCode == WIN32_ERROR.ERROR_SUCCESS
                ? buffer[..Math.Max((int)(bytes / sizeof(char)) - 1, 0)].ToString()
                : string.Empty;

            return errorCode == WIN32_ERROR.ERROR_SUCCESS;
        }
    }
}

Upvotes: 1

winwin
winwin

Reputation: 1777

An even better way to do this is here.

There is a list of all language codes from Microsoft. The link. Here is the script which you can use to parse all the values from there by yourself, if you want:

function getLanguages() {
    const rows = document.querySelectorAll("tr");

    const res = {};

    let i = 0;

    for (const row of rows) {
        try {
            let [ int_code, desc, bcp_47_code ] = row.querySelectorAll("td>p");
            int_code = parseInt(int_code.textContent.trim());
            if (isNaN(int_code)) {
                throw new Error("int code is NaN");
            }
            desc = desc.textContent.trim();
            bcp_47_code = bcp_47_code.textContent.trim();
            const obj = { int_code, desc, bcp_47_code };
            res[int_code] = obj;
        } catch (err) {
            console.error(`ROW #${i} ERROR:`, err);
        } finally {
            i++;
        }
    }
    
    return res;
}

Just paste it into your devtools console and call the function. I will also provide the result of execution in JSON format for readers' convenience:

{
  "1025": {
    "int_code": 1025,
    "desc": "Arabic - Saudi Arabia",
    "bcp_47_code": "ar-SA"
  },
  "1026": {
    "int_code": 1026,
    "desc": "Bulgarian",
    "bcp_47_code": "bg-BG"
  },
  "1027": {
    "int_code": 1027,
    "desc": "Catalan",
    "bcp_47_code": "ca-ES"
  },
  "1028": {
    "int_code": 1028,
    "desc": "Chinese - Taiwan",
    "bcp_47_code": "zh-TW"
  },
  "1029": {
    "int_code": 1029,
    "desc": "Czech",
    "bcp_47_code": "cs-CZ"
  },
  "1030": {
    "int_code": 1030,
    "desc": "Danish",
    "bcp_47_code": "da-DK"
  },
  "1031": {
    "int_code": 1031,
    "desc": "German - Germany",
    "bcp_47_code": "de-DE"
  },
  "1032": {
    "int_code": 1032,
    "desc": "Greek",
    "bcp_47_code": "el-GR"
  },
  "1033": {
    "int_code": 1033,
    "desc": "English - United States",
    "bcp_47_code": "en-US"
  },
  "1034": {
    "int_code": 1034,
    "desc": "Spanish - Spain (Traditional Sort)",
    "bcp_47_code": "es-ES"
  },
  "1035": {
    "int_code": 1035,
    "desc": "Finnish",
    "bcp_47_code": "fi-FI"
  },
  "1036": {
    "int_code": 1036,
    "desc": "French - France",
    "bcp_47_code": "fr-FR"
  },
  "1037": {
    "int_code": 1037,
    "desc": "Hebrew",
    "bcp_47_code": "he-IL"
  },
  "1038": {
    "int_code": 1038,
    "desc": "Hungarian",
    "bcp_47_code": "hu-HU"
  },
  "1039": {
    "int_code": 1039,
    "desc": "Icelandic",
    "bcp_47_code": "is-IS"
  },
  "1040": {
    "int_code": 1040,
    "desc": "Italian - Italy",
    "bcp_47_code": "it-IT"
  },
  "1041": {
    "int_code": 1041,
    "desc": "Japanese",
    "bcp_47_code": "ja-JP"
  },
  "1042": {
    "int_code": 1042,
    "desc": "Korean",
    "bcp_47_code": "ko-KR"
  },
  "1043": {
    "int_code": 1043,
    "desc": "Dutch - Netherlands",
    "bcp_47_code": "nl-NL"
  },
  "1044": {
    "int_code": 1044,
    "desc": "Norwegian (Bokmål)",
    "bcp_47_code": "nb-NO"
  },
  "1045": {
    "int_code": 1045,
    "desc": "Polish",
    "bcp_47_code": "pl-PL"
  },
  "1046": {
    "int_code": 1046,
    "desc": "Portuguese - Brazil",
    "bcp_47_code": "pt-BR"
  },
  "1047": {
    "int_code": 1047,
    "desc": "Rhaeto-Romanic",
    "bcp_47_code": "rm-CH"
  },
  "1048": {
    "int_code": 1048,
    "desc": "Romanian",
    "bcp_47_code": "ro-RO"
  },
  "1049": {
    "int_code": 1049,
    "desc": "Russian",
    "bcp_47_code": "ru-RU"
  },
  "1050": {
    "int_code": 1050,
    "desc": "Croatian",
    "bcp_47_code": "hr-HR"
  },
  "1051": {
    "int_code": 1051,
    "desc": "Slovak",
    "bcp_47_code": "sk-SK"
  },
  "1052": {
    "int_code": 1052,
    "desc": "Albanian - Albania",
    "bcp_47_code": "sq-AL"
  },
  "1053": {
    "int_code": 1053,
    "desc": "Swedish",
    "bcp_47_code": "sv-SE"
  },
  "1054": {
    "int_code": 1054,
    "desc": "Thai",
    "bcp_47_code": "th-TH"
  },
  "1055": {
    "int_code": 1055,
    "desc": "Turkish",
    "bcp_47_code": "tr-TR"
  },
  "1056": {
    "int_code": 1056,
    "desc": "Urdu - Pakistan",
    "bcp_47_code": "ur-PK"
  },
  "1057": {
    "int_code": 1057,
    "desc": "Indonesian",
    "bcp_47_code": "id-ID"
  },
  "1058": {
    "int_code": 1058,
    "desc": "Ukrainian",
    "bcp_47_code": "uk-UA"
  },
  "1059": {
    "int_code": 1059,
    "desc": "Belarusian",
    "bcp_47_code": "be-BY"
  },
  "1060": {
    "int_code": 1060,
    "desc": "Slovenian",
    "bcp_47_code": "sl-SI"
  },
  "1061": {
    "int_code": 1061,
    "desc": "Estonian",
    "bcp_47_code": "et-EE"
  },
  "1062": {
    "int_code": 1062,
    "desc": "Latvian",
    "bcp_47_code": "lv-LV"
  },
  "1063": {
    "int_code": 1063,
    "desc": "Lithuanian",
    "bcp_47_code": "lt-LT"
  },
  "1064": {
    "int_code": 1064,
    "desc": "Tajik",
    "bcp_47_code": "tg-Cyrl-TJ"
  },
  "1065": {
    "int_code": 1065,
    "desc": "Persian",
    "bcp_47_code": "fa-IR"
  },
  "1066": {
    "int_code": 1066,
    "desc": "Vietnamese",
    "bcp_47_code": "vi-VN"
  },
  "1067": {
    "int_code": 1067,
    "desc": "Armenian - Armenia",
    "bcp_47_code": "hy-AM"
  },
  "1068": {
    "int_code": 1068,
    "desc": "Azeri (Latin)",
    "bcp_47_code": "az-Latn-AZ"
  },
  "1069": {
    "int_code": 1069,
    "desc": "Basque",
    "bcp_47_code": "eu-ES"
  },
  "1070": {
    "int_code": 1070,
    "desc": "Sorbian",
    "bcp_47_code": "wen-DE"
  },
  "1071": {
    "int_code": 1071,
    "desc": "F.Y.R.O. Macedonian",
    "bcp_47_code": "mk-MK"
  },
  "1072": {
    "int_code": 1072,
    "desc": "Sutu",
    "bcp_47_code": "st-ZA"
  },
  "1073": {
    "int_code": 1073,
    "desc": "Tsonga",
    "bcp_47_code": "ts-ZA"
  },
  "1074": {
    "int_code": 1074,
    "desc": "Tswana",
    "bcp_47_code": "tn-ZA"
  },
  "1075": {
    "int_code": 1075,
    "desc": "Venda",
    "bcp_47_code": "ven-ZA"
  },
  "1076": {
    "int_code": 1076,
    "desc": "Xhosa",
    "bcp_47_code": "xh-ZA"
  },
  "1077": {
    "int_code": 1077,
    "desc": "Zulu",
    "bcp_47_code": "zu-ZA"
  },
  "1078": {
    "int_code": 1078,
    "desc": "Afrikaans - South Africa",
    "bcp_47_code": "af-ZA"
  },
  "1079": {
    "int_code": 1079,
    "desc": "Georgian",
    "bcp_47_code": "ka-GE"
  },
  "1080": {
    "int_code": 1080,
    "desc": "Faroese",
    "bcp_47_code": "fo-FO"
  },
  "1081": {
    "int_code": 1081,
    "desc": "Hindi",
    "bcp_47_code": "hi-IN"
  },
  "1082": {
    "int_code": 1082,
    "desc": "Maltese",
    "bcp_47_code": "mt-MT"
  },
  "1083": {
    "int_code": 1083,
    "desc": "Sami",
    "bcp_47_code": "se-NO"
  },
  "1084": {
    "int_code": 1084,
    "desc": "Gaelic (Scotland)",
    "bcp_47_code": "gd-GB"
  },
  "1085": {
    "int_code": 1085,
    "desc": "Yiddish",
    "bcp_47_code": "yi"
  },
  "1086": {
    "int_code": 1086,
    "desc": "Malay - Malaysia",
    "bcp_47_code": "ms-MY"
  },
  "1087": {
    "int_code": 1087,
    "desc": "Kazakh",
    "bcp_47_code": "kk-KZ"
  },
  "1088": {
    "int_code": 1088,
    "desc": "Kyrgyz (Cyrillic)",
    "bcp_47_code": "ky-KG"
  },
  "1089": {
    "int_code": 1089,
    "desc": "Swahili",
    "bcp_47_code": "sw-KE"
  },
  "1090": {
    "int_code": 1090,
    "desc": "Turkmen",
    "bcp_47_code": "tk-TM"
  },
  "1091": {
    "int_code": 1091,
    "desc": "Uzbek (Latin)",
    "bcp_47_code": "uz-Latn-UZ"
  },
  "1092": {
    "int_code": 1092,
    "desc": "Tatar",
    "bcp_47_code": "tt-RU"
  },
  "1093": {
    "int_code": 1093,
    "desc": "Bengali (India)",
    "bcp_47_code": "bn-IN"
  },
  "1094": {
    "int_code": 1094,
    "desc": "Punjabi",
    "bcp_47_code": "pa-IN"
  },
  "1095": {
    "int_code": 1095,
    "desc": "Gujarati",
    "bcp_47_code": "gu-IN"
  },
  "1096": {
    "int_code": 1096,
    "desc": "Oriya",
    "bcp_47_code": "or-IN"
  },
  "1097": {
    "int_code": 1097,
    "desc": "Tamil",
    "bcp_47_code": "ta-IN"
  },
  "1098": {
    "int_code": 1098,
    "desc": "Telugu",
    "bcp_47_code": "te-IN"
  },
  "1099": {
    "int_code": 1099,
    "desc": "Kannada",
    "bcp_47_code": "kn-IN"
  },
  "1100": {
    "int_code": 1100,
    "desc": "Malayalam",
    "bcp_47_code": "ml-IN"
  },
  "1101": {
    "int_code": 1101,
    "desc": "Assamese",
    "bcp_47_code": "as-IN"
  },
  "1102": {
    "int_code": 1102,
    "desc": "Marathi",
    "bcp_47_code": "mr-IN"
  },
  "1103": {
    "int_code": 1103,
    "desc": "Sanskrit",
    "bcp_47_code": "sa-IN"
  },
  "1104": {
    "int_code": 1104,
    "desc": "Mongolian (Cyrillic)",
    "bcp_47_code": "mn-MN"
  },
  "1105": {
    "int_code": 1105,
    "desc": "Tibetan - People's Republic of China",
    "bcp_47_code": "bo-CN"
  },
  "1106": {
    "int_code": 1106,
    "desc": "Welsh",
    "bcp_47_code": "cy-GB"
  },
  "1107": {
    "int_code": 1107,
    "desc": "Khmer",
    "bcp_47_code": "km-KH"
  },
  "1108": {
    "int_code": 1108,
    "desc": "Lao",
    "bcp_47_code": "lo-LA"
  },
  "1109": {
    "int_code": 1109,
    "desc": "Burmese",
    "bcp_47_code": "my-MM"
  },
  "1110": {
    "int_code": 1110,
    "desc": "Galician",
    "bcp_47_code": "gl-ES"
  },
  "1111": {
    "int_code": 1111,
    "desc": "Konkani",
    "bcp_47_code": "kok-IN"
  },
  "1112": {
    "int_code": 1112,
    "desc": "Manipuri",
    "bcp_47_code": "mni"
  },
  "1113": {
    "int_code": 1113,
    "desc": "Sindhi - India",
    "bcp_47_code": "sd-IN"
  },
  "1114": {
    "int_code": 1114,
    "desc": "Syriac",
    "bcp_47_code": "syr-SY"
  },
  "1115": {
    "int_code": 1115,
    "desc": "Sinhalese - Sri Lanka",
    "bcp_47_code": "si-LK"
  },
  "1116": {
    "int_code": 1116,
    "desc": "Cherokee - United States",
    "bcp_47_code": "chr-US"
  },
  "1117": {
    "int_code": 1117,
    "desc": "Inuktitut",
    "bcp_47_code": "iu-Cans-CA"
  },
  "1118": {
    "int_code": 1118,
    "desc": "Amharic - Ethiopia",
    "bcp_47_code": "am-ET"
  },
  "1119": {
    "int_code": 1119,
    "desc": "Tamazight (Arabic)",
    "bcp_47_code": "tmz"
  },
  "1120": {
    "int_code": 1120,
    "desc": "Kashmiri (Arabic)",
    "bcp_47_code": "ks-Arab-IN"
  },
  "1121": {
    "int_code": 1121,
    "desc": "Nepali",
    "bcp_47_code": "ne-NP"
  },
  "1122": {
    "int_code": 1122,
    "desc": "Frisian - Netherlands",
    "bcp_47_code": "fy-NL"
  },
  "1123": {
    "int_code": 1123,
    "desc": "Pashto",
    "bcp_47_code": "ps-AF"
  },
  "1124": {
    "int_code": 1124,
    "desc": "Filipino",
    "bcp_47_code": "fil-PH"
  },
  "1125": {
    "int_code": 1125,
    "desc": "Divehi",
    "bcp_47_code": "dv-MV"
  },
  "1126": {
    "int_code": 1126,
    "desc": "Edo",
    "bcp_47_code": "bin-NG"
  },
  "1127": {
    "int_code": 1127,
    "desc": "Fulfulde - Nigeria",
    "bcp_47_code": "fuv-NG"
  },
  "1128": {
    "int_code": 1128,
    "desc": "Hausa - Nigeria",
    "bcp_47_code": "ha-Latn-NG"
  },
  "1129": {
    "int_code": 1129,
    "desc": "Ibibio - Nigeria",
    "bcp_47_code": "ibb-NG"
  },
  "1130": {
    "int_code": 1130,
    "desc": "Yoruba",
    "bcp_47_code": "yo-NG"
  },
  "1131": {
    "int_code": 1131,
    "desc": "Quecha - Bolivia",
    "bcp_47_code": "quz-BO"
  },
  "1132": {
    "int_code": 1132,
    "desc": "Sepedi",
    "bcp_47_code": "nso-ZA"
  },
  "1136": {
    "int_code": 1136,
    "desc": "Igbo - Nigeria",
    "bcp_47_code": "ig-NG"
  },
  "1137": {
    "int_code": 1137,
    "desc": "Kanuri - Nigeria",
    "bcp_47_code": "kr-NG"
  },
  "1138": {
    "int_code": 1138,
    "desc": "Oromo",
    "bcp_47_code": "gaz-ET"
  },
  "1139": {
    "int_code": 1139,
    "desc": "Tigrigna - Ethiopia",
    "bcp_47_code": "ti-ER"
  },
  "1140": {
    "int_code": 1140,
    "desc": "Guarani - Paraguay",
    "bcp_47_code": "gn-PY"
  },
  "1141": {
    "int_code": 1141,
    "desc": "Hawaiian - United States",
    "bcp_47_code": "haw-US"
  },
  "1142": {
    "int_code": 1142,
    "desc": "Latin",
    "bcp_47_code": "la"
  },
  "1143": {
    "int_code": 1143,
    "desc": "Somali",
    "bcp_47_code": "so-SO"
  },
  "1144": {
    "int_code": 1144,
    "desc": "Yi",
    "bcp_47_code": "ii-CN"
  },
  "1145": {
    "int_code": 1145,
    "desc": "Papiamentu",
    "bcp_47_code": "pap-AN"
  },
  "1152": {
    "int_code": 1152,
    "desc": "Uighur - China",
    "bcp_47_code": "ug-Arab-CN"
  },
  "1153": {
    "int_code": 1153,
    "desc": "Maori - New Zealand",
    "bcp_47_code": "mi-NZ"
  },
  "2049": {
    "int_code": 2049,
    "desc": "Arabic - Iraq",
    "bcp_47_code": "ar-IQ"
  },
  "2052": {
    "int_code": 2052,
    "desc": "Chinese - People's Republic of China",
    "bcp_47_code": "zh-CN"
  },
  "2055": {
    "int_code": 2055,
    "desc": "German - Switzerland",
    "bcp_47_code": "de-CH"
  },
  "2057": {
    "int_code": 2057,
    "desc": "English - United Kingdom",
    "bcp_47_code": "en-GB"
  },
  "2058": {
    "int_code": 2058,
    "desc": "Spanish - Mexico",
    "bcp_47_code": "es-MX"
  },
  "2060": {
    "int_code": 2060,
    "desc": "French - Belgium",
    "bcp_47_code": "fr-BE"
  },
  "2064": {
    "int_code": 2064,
    "desc": "Italian - Switzerland",
    "bcp_47_code": "it-CH"
  },
  "2067": {
    "int_code": 2067,
    "desc": "Dutch - Belgium",
    "bcp_47_code": "nl-BE"
  },
  "2068": {
    "int_code": 2068,
    "desc": "Norwegian (Nynorsk)",
    "bcp_47_code": "nn-NO"
  },
  "2070": {
    "int_code": 2070,
    "desc": "Portuguese - Portugal",
    "bcp_47_code": "pt-PT"
  },
  "2072": {
    "int_code": 2072,
    "desc": "Romanian - Moldava",
    "bcp_47_code": "ro-MD"
  },
  "2073": {
    "int_code": 2073,
    "desc": "Russian - Moldava",
    "bcp_47_code": "ru-MD"
  },
  "2074": {
    "int_code": 2074,
    "desc": "Serbian (Latin)",
    "bcp_47_code": "sr-Latn-CS"
  },
  "2077": {
    "int_code": 2077,
    "desc": "Swedish - Finland",
    "bcp_47_code": "sv-FI"
  },
  "2080": {
    "int_code": 2080,
    "desc": "Urdu - India",
    "bcp_47_code": "ur-IN"
  },
  "2092": {
    "int_code": 2092,
    "desc": "Azeri (Cyrillic)",
    "bcp_47_code": "az-Cyrl-AZ"
  },
  "2108": {
    "int_code": 2108,
    "desc": "Gaelic (Ireland)",
    "bcp_47_code": "ga-IE"
  },
  "2110": {
    "int_code": 2110,
    "desc": "Malay - Brunei Darussalam",
    "bcp_47_code": "ms-BN"
  },
  "2115": {
    "int_code": 2115,
    "desc": "Uzbek (Cyrillic)",
    "bcp_47_code": "uz-Cyrl-UZ"
  },
  "2117": {
    "int_code": 2117,
    "desc": "Bengali (Bangladesh)",
    "bcp_47_code": "bn-BD"
  },
  "2118": {
    "int_code": 2118,
    "desc": "Punjabi (Pakistan)",
    "bcp_47_code": "pa-PK"
  },
  "2128": {
    "int_code": 2128,
    "desc": "Mongolian (Mongolian)",
    "bcp_47_code": "mn-Mong-CN"
  },
  "2129": {
    "int_code": 2129,
    "desc": "Tibetan - Bhutan",
    "bcp_47_code": "bo-BT"
  },
  "2137": {
    "int_code": 2137,
    "desc": "Sindhi - Pakistan",
    "bcp_47_code": "sd-PK"
  },
  "2143": {
    "int_code": 2143,
    "desc": "Tamazight (Latin)",
    "bcp_47_code": "tzm-Latn-DZ"
  },
  "2144": {
    "int_code": 2144,
    "desc": "Kashmiri (Devanagari)",
    "bcp_47_code": "ks-Deva-IN"
  },
  "2145": {
    "int_code": 2145,
    "desc": "Nepali - India",
    "bcp_47_code": "ne-IN"
  },
  "2155": {
    "int_code": 2155,
    "desc": "Quecha - Ecuador",
    "bcp_47_code": "quz-EC"
  },
  "2163": {
    "int_code": 2163,
    "desc": "Tigrigna - Eritrea",
    "bcp_47_code": "ti-ET"
  },
  "3073": {
    "int_code": 3073,
    "desc": "Arabic - Egypt",
    "bcp_47_code": "ar-EG"
  },
  "3076": {
    "int_code": 3076,
    "desc": "Chinese - Hong Kong SAR",
    "bcp_47_code": "zh-HK"
  },
  "3079": {
    "int_code": 3079,
    "desc": "German - Austria",
    "bcp_47_code": "de-AT"
  },
  "3081": {
    "int_code": 3081,
    "desc": "English - Australia",
    "bcp_47_code": "en-AU"
  },
  "3082": {
    "int_code": 3082,
    "desc": "Spanish - Spain (Modern Sort)",
    "bcp_47_code": "es-ES"
  },
  "3084": {
    "int_code": 3084,
    "desc": "French - Canada",
    "bcp_47_code": "fr-CA"
  },
  "3098": {
    "int_code": 3098,
    "desc": "Serbian (Cyrillic)",
    "bcp_47_code": "sr-Cyrl-CS"
  },
  "3179": {
    "int_code": 3179,
    "desc": "Quecha - Peru",
    "bcp_47_code": "quz-PE"
  },
  "4097": {
    "int_code": 4097,
    "desc": "Arabic - Libya",
    "bcp_47_code": "ar-LY"
  },
  "4100": {
    "int_code": 4100,
    "desc": "Chinese - Singapore",
    "bcp_47_code": "zh-SG"
  },
  "4103": {
    "int_code": 4103,
    "desc": "German - Luxembourg",
    "bcp_47_code": "de-LU"
  },
  "4105": {
    "int_code": 4105,
    "desc": "English - Canada",
    "bcp_47_code": "en-CA"
  },
  "4106": {
    "int_code": 4106,
    "desc": "Spanish - Guatemala",
    "bcp_47_code": "es-GT"
  },
  "4108": {
    "int_code": 4108,
    "desc": "French - Switzerland",
    "bcp_47_code": "fr-CH"
  },
  "4122": {
    "int_code": 4122,
    "desc": "Croatian (Bosnia/Herzegovina)",
    "bcp_47_code": "hr-BA"
  },
  "5121": {
    "int_code": 5121,
    "desc": "Arabic - Algeria",
    "bcp_47_code": "ar-DZ"
  },
  "5124": {
    "int_code": 5124,
    "desc": "Chinese - Macao SAR",
    "bcp_47_code": "zh-MO"
  },
  "5127": {
    "int_code": 5127,
    "desc": "German - Liechtenstein",
    "bcp_47_code": "de-LI"
  },
  "5129": {
    "int_code": 5129,
    "desc": "English - New Zealand",
    "bcp_47_code": "en-NZ"
  },
  "5130": {
    "int_code": 5130,
    "desc": "Spanish - Costa Rica",
    "bcp_47_code": "es-CR"
  },
  "5132": {
    "int_code": 5132,
    "desc": "French - Luxembourg",
    "bcp_47_code": "fr-LU"
  },
  "5146": {
    "int_code": 5146,
    "desc": "Bosnian (Bosnia/Herzegovina)",
    "bcp_47_code": "bs-Latn-BA"
  },
  "6145": {
    "int_code": 6145,
    "desc": "Arabic - Morocco",
    "bcp_47_code": "ar-MO"
  },
  "6153": {
    "int_code": 6153,
    "desc": "English - Ireland",
    "bcp_47_code": "en-IE"
  },
  "6154": {
    "int_code": 6154,
    "desc": "Spanish - Panama",
    "bcp_47_code": "es-PA"
  },
  "6156": {
    "int_code": 6156,
    "desc": "French - Monaco",
    "bcp_47_code": "fr-MC"
  },
  "7169": {
    "int_code": 7169,
    "desc": "Arabic - Tunisia",
    "bcp_47_code": "ar-TN"
  },
  "7177": {
    "int_code": 7177,
    "desc": "English - South Africa",
    "bcp_47_code": "en-ZA"
  },
  "7178": {
    "int_code": 7178,
    "desc": "Spanish - Dominican Republic",
    "bcp_47_code": "es-DO"
  },
  "7180": {
    "int_code": 7180,
    "desc": "French - West Indies",
    "bcp_47_code": "fr-029"
  },
  "8193": {
    "int_code": 8193,
    "desc": "Arabic - Oman",
    "bcp_47_code": "ar-OM"
  },
  "8201": {
    "int_code": 8201,
    "desc": "English - Jamaica",
    "bcp_47_code": "en-JM"
  },
  "8202": {
    "int_code": 8202,
    "desc": "Spanish - Venezuela",
    "bcp_47_code": "es-VE"
  },
  "8204": {
    "int_code": 8204,
    "desc": "French - Reunion",
    "bcp_47_code": "fr-RE"
  },
  "9217": {
    "int_code": 9217,
    "desc": "Arabic - Yemen",
    "bcp_47_code": "ar-YE"
  },
  "9225": {
    "int_code": 9225,
    "desc": "English - Caribbean",
    "bcp_47_code": "en-029"
  },
  "9226": {
    "int_code": 9226,
    "desc": "Spanish - Colombia",
    "bcp_47_code": "es-CO"
  },
  "9228": {
    "int_code": 9228,
    "desc": "French - Democratic Rep. of Congo",
    "bcp_47_code": "fr-CG"
  },
  "10241": {
    "int_code": 10241,
    "desc": "Arabic - Syria",
    "bcp_47_code": "ar-SY"
  },
  "10249": {
    "int_code": 10249,
    "desc": "English - Belize",
    "bcp_47_code": "en-BZ"
  },
  "10250": {
    "int_code": 10250,
    "desc": "Spanish - Peru",
    "bcp_47_code": "es-PE"
  },
  "10252": {
    "int_code": 10252,
    "desc": "French - Senegal",
    "bcp_47_code": "fr-SN"
  },
  "11265": {
    "int_code": 11265,
    "desc": "Arabic - Jordan",
    "bcp_47_code": "ar-JO"
  },
  "11273": {
    "int_code": 11273,
    "desc": "English - Trinidad",
    "bcp_47_code": "en-TT"
  },
  "11274": {
    "int_code": 11274,
    "desc": "Spanish - Argentina",
    "bcp_47_code": "es-AR"
  },
  "11276": {
    "int_code": 11276,
    "desc": "French - Cameroon",
    "bcp_47_code": "fr-CM"
  },
  "12289": {
    "int_code": 12289,
    "desc": "Arabic - Lebanon",
    "bcp_47_code": "ar-LB"
  },
  "12297": {
    "int_code": 12297,
    "desc": "English - Zimbabwe",
    "bcp_47_code": "en-ZW"
  },
  "12298": {
    "int_code": 12298,
    "desc": "Spanish - Ecuador",
    "bcp_47_code": "es-EC"
  },
  "12300": {
    "int_code": 12300,
    "desc": "French - Cote d'Ivoire",
    "bcp_47_code": "fr-CI"
  },
  "13313": {
    "int_code": 13313,
    "desc": "Arabic - Kuwait",
    "bcp_47_code": "ar-KW"
  },
  "13321": {
    "int_code": 13321,
    "desc": "English - Philippines",
    "bcp_47_code": "en-PH"
  },
  "13322": {
    "int_code": 13322,
    "desc": "Spanish - Chile",
    "bcp_47_code": "es-CL"
  },
  "13324": {
    "int_code": 13324,
    "desc": "French - Mali",
    "bcp_47_code": "fr-ML"
  },
  "14337": {
    "int_code": 14337,
    "desc": "Arabic - U.A.E.",
    "bcp_47_code": "ar-AE"
  },
  "14345": {
    "int_code": 14345,
    "desc": "English - Indonesia",
    "bcp_47_code": "en-ID"
  },
  "14346": {
    "int_code": 14346,
    "desc": "Spanish - Uruguay",
    "bcp_47_code": "es-UY"
  },
  "14348": {
    "int_code": 14348,
    "desc": "French - Morocco",
    "bcp_47_code": "fr-MA"
  },
  "15361": {
    "int_code": 15361,
    "desc": "Arabic - Bahrain",
    "bcp_47_code": "ar-BH"
  },
  "15369": {
    "int_code": 15369,
    "desc": "English - Hong Kong SAR",
    "bcp_47_code": "en-HK"
  },
  "15370": {
    "int_code": 15370,
    "desc": "Spanish - Paraguay",
    "bcp_47_code": "es-PY"
  },
  "15372": {
    "int_code": 15372,
    "desc": "French - Haiti",
    "bcp_47_code": "fr-HT"
  },
  "16385": {
    "int_code": 16385,
    "desc": "Arabic - Qatar",
    "bcp_47_code": "ar-QA"
  },
  "16393": {
    "int_code": 16393,
    "desc": "English - India",
    "bcp_47_code": "en-IN"
  },
  "16394": {
    "int_code": 16394,
    "desc": "Spanish - Bolivia",
    "bcp_47_code": "es-BO"
  },
  "17417": {
    "int_code": 17417,
    "desc": "English - Malaysia",
    "bcp_47_code": "en-MY"
  },
  "17418": {
    "int_code": 17418,
    "desc": "Spanish - El Salvador",
    "bcp_47_code": "es-SV"
  },
  "18441": {
    "int_code": 18441,
    "desc": "English - Singapore",
    "bcp_47_code": "en-SG"
  },
  "18442": {
    "int_code": 18442,
    "desc": "Spanish - Honduras",
    "bcp_47_code": "es-HN"
  },
  "19466": {
    "int_code": 19466,
    "desc": "Spanish - Nicaragua",
    "bcp_47_code": "es-NI"
  },
  "20490": {
    "int_code": 20490,
    "desc": "Spanish - Puerto Rico",
    "bcp_47_code": "es-PR"
  },
  "21514": {
    "int_code": 21514,
    "desc": "Spanish - United States",
    "bcp_47_code": "es-US"
  },
  "58378": {
    "int_code": 58378,
    "desc": "Spanish - Latin America",
    "bcp_47_code": "es-419"
  },
  "58380": {
    "int_code": 58380,
    "desc": "French - North Africa",
    "bcp_47_code": "fr-015"
  }
}

Next, you should call the GetKeyboardLayoutName() function, which will return a hexadecimal number like this: "00000423". The keys in our dictionary are integer, so you should convert it into decimal (just the plain old regular integer). I don't know how you do it in C#, but in python it is: i = int("<hex number goes here>", 16).

And then you simply query our dictionary by the key we've calculated and get the full information, including description and BCP 47 code.

Note: the keys are string, because JSON doesn't support integer keys.

Upvotes: 0

winwin
winwin

Reputation: 1777

JSONinfied version of @BillTarbell 's answer:

{
  "0000041C": "Albanian",
  "00000401": "Arabic (101)",
  "00010401": "Arabic (102)",
  "00020401": "Arabic (102) Azerty",
  "0000042B": "Armenian eastern",
  "0001042B": "Armenian Western",
  "0000044D": "Assamese - inscript",
  "0000082C": "Azeri Cyrillic",
  "0000042C": "Azeri Latin",
  "0000046D": "Bashkir",
  "00000423": "Belarusian",
  "0000080C": "Belgian French",
  "00000813": "Belgian (period)",
  "0001080C": "Belgian (comma)",
  "00000445": "Bengali",
  "00010445": "Bengali - inscript (legacy)",
  "00020445": "Bengali - inscript",
  "0000201A": "Bosnian (cyrillic)",
  "00030402": "Bulgarian",
  "00000402": "Bulgarian(typewriter)",
  "00010402": "Bulgarian (latin)",
  "00020402": "Bulgarian (phonetic)",
  "00040402": "Bulgarian (phonetic traditional)",
  "00011009": "Canada Multilingual",
  "00001009": "Canada French",
  "00000C0C": "Canada French (legacy)",
  "00000404": "Chinese (traditional) - us keyboard",
  "00000804": "Chinese (simplified) -us keyboard",
  "00000C04": "Chinese (traditional, hong kong s.a.r.) - us keyboard",
  "00001004": "Chinese (simplified, singapore) - us keyboard",
  "00001404": "Chinese (traditional, macao s.a.r.) - us keyboard",
  "00000405": "Czech",
  "00020405": "Czech programmers",
  "00010405": "Czech (qwerty)",
  "0000041A": "Croatian",
  "00000439": "Deanagari - inscript",
  "00000406": "Danish",
  "00000465": "Divehi phonetic",
  "00010465": "Divehi typewriter",
  "00000413": "Dutch",
  "00000425": "Estonian",
  "00000438": "Faeroese",
  "0000040B": "Finnish",
  "0001083B": "Finnish with sami",
  "0000040C": "French",
  "00011809": "Gaelic",
  "00000437": "Georgian",
  "00020437": "Georgian (ergonomic)",
  "00010437": "Georgian (qwerty)",
  "00000407": "German",
  "00010407": "German (ibm)",
  "0000046F": "Greenlandic",
  "00000468": "Hausa",
  "0000040D": "Hebrew",
  "00010439": "Hindi traditional",
  "00000408": "Greek",
  "00010408": "Greek (220)",
  "00030408": "Greek (220) latin",
  "00020408": "Greek (319)",
  "00040408": "Greek (319) latin",
  "00050408": "Greek latin",
  "00060408": "Greek polyonic",
  "00000447": "Gujarati",
  "0000040E": "Hungarian",
  "0001040E": "Hungarian 101 key",
  "0000040F": "Icelandic",
  "00000470": "Igbo",
  "0000085D": "Inuktitut - latin",
  "0001045D": "Inuktitut - naqittaut",
  "00001809": "Irish",
  "00000410": "Italian",
  "00010410": "Italian (142)",
  "00000411": "Japanese",
  "0000044B": "Kannada",
  "0000043F": "Kazakh",
  "00000453": "Khmer",
  "00000412": "Korean",
  "00000440": "Kyrgyz cyrillic",
  "00000454": "Lao",
  "0000080A": "Latin america",
  "00000426": "Latvian",
  "00010426": "Latvian (qwerty)",
  "00010427": "Lithuanian",
  "00000427": "Lithuanian ibm",
  "00020427": "Lithuanian standard",
  "0000046E": "Luxembourgish",
  "0000042F": "Macedonian (fyrom)",
  "0001042F": "Macedonian (fyrom) - standard",
  "0000044C": "Malayalam",
  "0000043A": "Maltese 47-key",
  "0001043A": "Maltese 48-key",
  "0000044E": "Marathi",
  "00000481": "Maroi",
  "00000450": "Mongolian cyrillic",
  "00000850": "Mongolian (mongolian script)",
  "00000461": "Nepali",
  "00000414": "Norwegian",
  "0000043B": "Norwegian with sami",
  "00000448": "Oriya",
  "00000463": "Pashto (afghanistan)",
  "00000429": "Persian",
  "00000415": "Polish (programmers)",
  "00010415": "Polish (214)",
  "00000816": "Portuguese",
  "00000416": "Portuguese (brazillian abnt)",
  "00010416": "Portuguese (brazillian abnt2)",
  "00000446": "Punjabi",
  "00010418": "Romanian (standard)",
  "00000418": "Romanian (legacy)",
  "00020418": "Romanian (programmers)",
  "00000419": "Russian",
  "00010419": "Russian (typewriter)",
  "0002083B": "Sami extended finland-sweden",
  "0001043B": "Sami extended norway",
  "00000C1A": "Serbian (cyrillic)",
  "0000081A": "Serbian (latin)",
  "0000046C": "Sesotho sa Leboa",
  "00000432": "Setswana",
  "0000045B": "Sinhala",
  "0001045B": "Sinhala -Wij 9",
  "0000041B": "Slovak",
  "0001041B": "Slovak (qwerty)",
  "00000424": "Slovenian",
  "0001042E": "Sorbian extended",
  "0002042E": "Sorbian standard",
  "0000042E": "Sorbian standard (legacy)",
  "0000040A": "Spanish",
  "0001040A": "Spanish variation",
  "0000041D": "Swedish",
  "0000083B": "Swedish with sami",
  "00000807": "Swiss german",
  "0000100C": "Swiss french",
  "0000045A": "Syriac",
  "0001045A": "Syriac phonetic",
  "00000428": "Tajik",
  "00000449": "Tamil",
  "00000444": "Tatar",
  "0000044A": "Telugu",
  "0000041E": "Thai Kedmanee",
  "0002041E": "Thai Kedmanee (non-shiftlock)",
  "0001041E": "Thai Pattachote",
  "0003041E": "Thai Pattachote (non-shiftlock)",
  "00000451": "Tibetan (prc)",
  "0001041F": "Turkish F",
  "0000041F": "Turkish Q",
  "00000442": "Turkmen",
  "00000422": "Ukrainian",
  "00020422": "Ukrainian (enhanced)",
  "00000809": "United Kingdom",
  "00000452": "United Kingdom Extended",
  "00000409": "United States",
  "00010409": "United States - dvorak",
  "00030409": "United States - dvorak left hand",
  "00050409": "United States - dvorak right hand",
  "00004009": "United States - india",
  "00020409": "United States - international",
  "00000420": "Urdu",
  "00010480": "Uyghur",
  "00000480": "Uyghur (legacy)",
  "00000843": "Uzbek cyrillic",
  "0000042A": "Vietnamese",
  "00000485": "Yakut",
  "0000046A": "Yoruba",
  "00000488": "Wolof"
}

Upvotes: 0

Bill Tarbell
Bill Tarbell

Reputation: 5234

It's not a complete answer for your question, but here's a good chunk of it that took me a couple of hours to compile by hand. It's a mapping of every layout code to the layout name that my version of Windows 7 had available. I had to type the names by hand, so excuse any typos there. The codes were gathered programatically.

using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Input;

namespace DesktopDictation.DeviceButtonMappings
{
  public class KeyboardLayout
  {
    const int KL_NAMELENGTH = 9;

    [DllImport("user32.dll")]
    private static extern long GetKeyboardLayoutName(StringBuilder pwszKLID); 

    //each keyboard layout is defined in Windows as a hex code
    public static string GetLayoutCode()
    {
      var name = new StringBuilder(KL_NAMELENGTH);
      GetKeyboardLayoutName(name);

      return name.ToString();
    }

    //This is a mapping table from hex to descriptive name
    public static String MapLayoutName(string code = null)
    {
      if (code == null)
        code = GetLayoutCode();

      switch (code)
      {
        case "0000041C":
          return "Albanian";
        case "00000401":
          return "Arabic (101)";
        case "00010401":
          return "Arabic (102)";
        case "00020401":
          return "Arabic (102) Azerty";
        case "0000042B":
          return "Armenian eastern";
        case "0001042B":
          return "Armenian Western";
        case "0000044D":
          return "Assamese - inscript";
        case "0000082C":
          return "Azeri Cyrillic";
        case "0000042C":
          return "Azeri Latin";
        case "0000046D":
          return "Bashkir";
        case "00000423":
          return "Belarusian";
        case "0000080C":
          return "Belgian French";
        case "00000813":
          return "Belgian (period)";
        case "0001080C":
          return "Belgian (comma)";
        case "00000445":
          return "Bengali";
        case "00010445":
          return "Bengali - inscript (legacy)";
        case "00020445":
          return "Bengali - inscript";
        case "0000201A":
          return "Bosnian (cyrillic)";
        case "00030402":
          return "Bulgarian";
        case "00000402":
          return "Bulgarian(typewriter)";
        case "00010402":
          return "Bulgarian (latin)";
        case "00020402":
          return "Bulgarian (phonetic)";
        case "00040402":
          return "Bulgarian (phonetic traditional)";
        case "00011009":
          return "Canada Multilingual";
        case "00001009":
          return "Canada French";
        case "00000C0C":
          return "Canada French (legacy)";
        case "00000404":
          return "Chinese (traditional) - us keyboard";
        case "00000804":
          return "Chinese (simplified) -us keyboard";
        case "00000C04":
          return "Chinese (traditional, hong kong s.a.r.) - us keyboard";
        case "00001004":
          return "Chinese (simplified, singapore) - us keyboard";
        case "00001404":
          return "Chinese (traditional, macao s.a.r.) - us keyboard";
        case "00000405":
          return "Czech";
        case "00020405":
          return "Czech programmers";
        case "00010405":
          return "Czech (qwerty)";
        case "0000041A":
          return "Croatian";
        case "00000439":
          return "Deanagari - inscript";
        case "00000406":
          return "Danish";
        case "00000465":
          return "Divehi phonetic";
        case "00010465":
          return "Divehi typewriter";
        case "00000413":
          return "Dutch";
        case "00000425":
          return "Estonian";
        case "00000438":
          return "Faeroese";
        case "0000040B":
          return "Finnish";
        case "0001083B":
          return "Finnish with sami";
        case "0000040C":
          return "French";
        case "00011809":
          return "Gaelic";
        case "00000437":
          return "Georgian";
        case "00020437":
          return "Georgian (ergonomic)";
        case "00010437":
          return "Georgian (qwerty)";
        case "00000407":
          return "German";
        case "00010407":
          return "German (ibm)";
        case "0000046F":
          return "Greenlandic";
        case "00000468":
          return "Hausa";
        case "0000040D":
          return "Hebrew";
        case "00010439":
          return "Hindi traditional";
        case "00000408":
          return "Greek";
        case "00010408":
          return "Greek (220)";
        case "00030408":
          return "Greek (220) latin";
        case "00020408":
          return "Greek (319)";
        case "00040408":
          return "Greek (319) latin";
        case "00050408":
          return "Greek latin";
        case "00060408":
          return "Greek polyonic";
        case "00000447":
          return "Gujarati";
        case "0000040E":
          return "Hungarian";
        case "0001040E":
          return "Hungarian 101 key";
        case "0000040F":
          return "Icelandic";
        case "00000470":
          return "Igbo";
        case "0000085D":
          return "Inuktitut - latin";
        case "0001045D":
          return "Inuktitut - naqittaut";
        case "00001809":
          return "Irish";
        case "00000410":
          return "Italian";
        case "00010410":
          return "Italian (142)";
        case "00000411":
          return "Japanese";
        case "0000044B":
          return "Kannada";
        case "0000043F":
          return "Kazakh";
        case "00000453":
          return "Khmer";
        case "00000412":
          return "Korean";
        case "00000440":
          return "Kyrgyz cyrillic";
        case "00000454":
          return "Lao";
        case "0000080A":
          return "Latin america";
        case "00000426":
          return "Latvian";
        case "00010426":
          return "Latvian (qwerty)";
        case "00010427":
          return "Lithuanian";
        case "00000427":
          return "Lithuanian ibm";
        case "00020427":
          return "Lithuanian standard";
        case "0000046E":
          return "Luxembourgish";
        case "0000042F":
          return "Macedonian (fyrom)";
        case "0001042F":
          return "Macedonian (fyrom) - standard";
        case "0000044C":
          return "Malayalam";
        case "0000043A":
          return "Maltese 47-key";
        case "0001043A":
          return "Maltese 48-key";
        case "0000044E":
          return "Marathi";
        case "00000481":
          return "Maroi";
        case "00000450":
          return "Mongolian cyrillic";
        case "00000850":
          return "Mongolian (mongolian script)";
        case "00000461":
          return "Nepali";
        case "00000414":
          return "Norwegian";
        case "0000043B":
          return "Norwegian with sami";
        case "00000448":
          return "Oriya";
        case "00000463":
          return "Pashto (afghanistan)";
        case "00000429":
          return "Persian";
        case "00000415":
          return "Polish (programmers)";
        case "00010415":
          return "Polish (214)";
        case "00000816":
          return "Portuguese";
        case "00000416":
          return "Portuguese (brazillian abnt)";
        case "00010416":
          return "Portuguese (brazillian abnt2)";
        case "00000446":
          return "Punjabi";
        case "00010418":
          return "Romanian (standard)";
        case "00000418":
          return "Romanian (legacy)";
        case "00020418":
          return "Romanian (programmers)";
        case "00000419":
          return "Russian";
        case "00010419":
          return "Russian (typewriter)";
        case "0002083B":
          return "Sami extended finland-sweden";
        case "0001043B":
          return "Sami extended norway";
        case "00000C1A":
          return "Serbian (cyrillic)";
        case "0000081A":
          return "Serbian (latin)";
        case "0000046C":
          return "Sesotho sa Leboa";
        case "00000432":
          return "Setswana";
        case "0000045B":
          return "Sinhala";
        case "0001045B":
          return "Sinhala -Wij 9";
        case "0000041B":
          return "Slovak";
        case "0001041B":
          return "Slovak (qwerty)";
        case "00000424":
          return "Slovenian";
        case "0001042E":
          return "Sorbian extended";
        case "0002042E":
          return "Sorbian standard";
        case "0000042E":
          return "Sorbian standard (legacy)";
        case "0000040A":
          return "Spanish";
        case "0001040A":
          return "Spanish variation";
        case "0000041D":
          return "Swedish";
        case "0000083B":
          return "Swedish with sami";
        case "00000807":
          return "Swiss german";
        case "0000100C":
          return "Swiss french";
        case "0000045A":
          return "Syriac";
        case "0001045A":
          return "Syriac phonetic";
        case "00000428":
          return "Tajik";
        case "00000449":
          return "Tamil";
        case "00000444":
          return "Tatar";
        case "0000044A":
          return "Telugu";
        case "0000041E":
          return "Thai Kedmanee";
        case "0002041E":
          return "Thai Kedmanee (non-shiftlock)";
        case "0001041E":
          return "Thai Pattachote";
        case "0003041E":
          return "Thai Pattachote (non-shiftlock)";
        case "00000451":
          return "Tibetan (prc)";
        case "0001041F":
          return "Turkish F";
        case "0000041F":
          return "Turkish Q";
        case "00000442":
          return "Turkmen";
        case "00000422":
          return "Ukrainian";
        case "00020422":
          return "Ukrainian (enhanced)";
        case "00000809":
          return "United Kingdom";
        case "00000452":
          return "United Kingdom Extended";
        case "00000409":
          return "United States";
        case "00010409":
          return "United States - dvorak";
        case "00030409":
          return "United States - dvorak left hand";
        case "00050409":
          return "United States - dvorak right hand";
        case "00004009":
          return "United States - india";
        case "00020409":
          return "United States - international";
        case "00000420":
          return "Urdu";
        case "00010480":
          return "Uyghur";
        case "00000480":
          return "Uyghur (legacy)";
        case "00000843":
          return "Uzbek cyrillic";
        case "0000042A":
          return "Vietnamese";
        case "00000485":
          return "Yakut";
        case "0000046A":
          return "Yoruba";
        case "00000488":
          return "Wolof";

        default:
          return "unknown";
      }
    }
  }
}

Upvotes: 4

digitguy
digitguy

Reputation: 1060

There is no in-built function to do this. You may have to use the solution posted here: How to convert Microsoft Locale ID (LCID) into language code

Upvotes: 0

Related Questions