ISO 639-2 to Windows LCID mapping

If you’ve ever had the misfortune to have to map three character ISO language codes to windows LCID’s then you’ll know it’s a bit of a pain.

The ISO codes can be found here and the LCID’s can be found here. Creating a mapping between the two is largely a manual process and you’d think that having these two lists is enough but sadly it isn’t. Although there are culture-neutral LCID’s in the list, pretty much nothing will work with those – if you intend to use the LCID’s for any UI type stuff ( in my case I’m mapping to language pack codes for SharePoint), you’ll need default specific cultures. For example, the default culture for English is US English – so the language pack has the LCID of 1033 as opposed to 0009 for the culture neutral LCID.

Anyways, to save fellow travellers some time here’s code for a dictionary object that contains the mappings you need.

internal static Dictionary<string, int> IsoCodeMappings = new Dictionary<string, int>
{
    {"afr", 1076},
    {"ara", 1118},
    {"aze", 1068},
    {"bel", 1059},
    {"bul", 1026},
    {"cat", 1027},
    {"zho", 2052},
    {"hrv", 1050},
    {"ces", 1029},
    {"dan", 1030},
    {"div", 1125},
    {"nld", 1043},
    {"eng", 1033},
    {"est", 1061},
    {"fao", 1080},
    {"fin", 1035},
    {"fra", 1036},
    {"glg", 1110},
    {"kat", 1079},
    {"deu", 1031},
    {"ell", 1032},
    {"guj", 1095},
    {"heb", 1037},
    {"hin", 1081},
    {"hun", 1038},
    {"isl", 1039},
    {"ind", 1057},
    {"ita", 1040},
    {"jpn", 1041},
    {"kan", 1099},
    {"kaz", 1087},
    {"swa", 1089},
    {"kor", 1042},
    {"kir", 1088},
    {"lav", 1062},
    {"lit", 1063},
    {"mkd", 1071},
    {"msa", 1086},
    {"mar", 1102},
    {"mon", 1104},
    {"nor", 1044},
    {"pol", 1045},
    {"por", 1046},
    {"pan", 1094},
    {"ron", 1048},
    {"rus", 1049},
    {"san", 1103},
    {"srp", 2074},
    {"slk", 1051},
    {"slv", 1060},
    {"spa", 1034},
    {"swe", 1053},
    {"tam", 1097},
    {"tat", 1092},
    {"tel", 1098},
    {"tha", 1054},
    {"tur", 1055},
    {"ukr", 1058},
    {"urd", 1056},
    {"uzb", 1091},
    {"vie", 1066}
};

This entry was posted in Deployment, SharePoint. Bookmark the permalink.