diff options
author | Underground78 <underground78@users.sourceforge.net> | 2016-03-27 17:49:49 +0300 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2016-04-12 00:31:05 +0300 |
commit | 4a9d59259f646fc971b4248526c395da26fcb306 (patch) | |
tree | bff0433b1d8599f42565ac96e5c323a12755fdb2 | |
parent | 2ff1b3776d0915dd03ef32e866696212fadd26c6 (diff) |
Move ISO languages related code to its own files.
-rw-r--r-- | src/DSUtil/DSUtil.cpp | 692 | ||||
-rw-r--r-- | src/DSUtil/DSUtil.h | 9 | ||||
-rw-r--r-- | src/DSUtil/DSUtil.vcxproj | 2 | ||||
-rw-r--r-- | src/DSUtil/DSUtil.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/DSUtil/HdmvClipInfo.cpp | 8 | ||||
-rw-r--r-- | src/DSUtil/ISOLang.cpp | 717 | ||||
-rw-r--r-- | src/DSUtil/ISOLang.h | 38 | ||||
-rw-r--r-- | src/DeCSS/VobFile.cpp | 5 | ||||
-rw-r--r-- | src/Subtitles/RTS.cpp | 5 | ||||
-rw-r--r-- | src/Subtitles/SubtitleHelpers.cpp | 19 | ||||
-rw-r--r-- | src/Subtitles/SubtitleInputPin.cpp | 5 | ||||
-rw-r--r-- | src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp | 5 | ||||
-rw-r--r-- | src/filters/parser/DSMSplitter/DSMSplitter.cpp | 5 | ||||
-rw-r--r-- | src/mpc-hc/DVBChannel.cpp | 8 | ||||
-rw-r--r-- | src/mpc-hc/DVBChannel.h | 2 | ||||
-rw-r--r-- | src/mpc-hc/FGManagerBDA.cpp | 5 | ||||
-rw-r--r-- | src/mpc-hc/MainFrm.cpp | 9 | ||||
-rw-r--r-- | src/mpc-hc/SubtitleDlDlg.cpp | 3 | ||||
-rw-r--r-- | src/mpc-hc/SubtitlesProvider.cpp | 11 | ||||
-rw-r--r-- | src/mpc-hc/SubtitlesProvidersUtils.cpp | 5 |
20 files changed, 819 insertions, 740 deletions
diff --git a/src/DSUtil/DSUtil.cpp b/src/DSUtil/DSUtil.cpp index 99be447e4..fbc1baca1 100644 --- a/src/DSUtil/DSUtil.cpp +++ b/src/DSUtil/DSUtil.cpp @@ -1483,698 +1483,6 @@ CStringW LocalToStringW(const char* S) return str;
}
-static struct {
- LPCSTR name, iso6392, iso6391;
- LCID lcid;
-} s_isolangs[] = { // TODO : fill LCID !!!
- // {"Auxiliary Language Association)", "", ""},
- // {"English-based (Other)", "", ""},
- // {"French-based (Other)", "", ""},
- // {"Portuguese-based (Other)", "", ""},
- {"Abkhazian", "abk", "ab"},
- {"Achinese", "ace", ""},
- {"Acoli", "ach", ""},
- {"Adangme", "ada", ""},
- {"Adyghe", "ady", ""},
- {"Afar", "aar", "aa"},
- {"Afrihili", "afh", ""},
- {"Afrikaans", "afr", "af", MAKELCID(MAKELANGID(LANG_AFRIKAANS, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Afro-Asiatic (Other)", "afa", ""},
- {"Akan", "aka", "ak"},
- {"Akkadian", "akk", ""},
- {"Albanian", "alb", "sq"},
- {"Albanian", "sqi", "sq", MAKELCID(MAKELANGID(LANG_ALBANIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Aleut", "ale", ""},
- {"Algonquian languages", "alg", ""},
- {"Altaic (Other)", "tut", ""},
- {"Amharic", "amh", "am"},
- {"Apache languages", "apa", ""},
- {"Arabic", "ara", "ar", MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Aragonese", "arg", "an"},
- {"Aramaic", "arc", ""},
- {"Arapaho", "arp", ""},
- {"Araucanian", "arn", ""},
- {"Arawak", "arw", ""},
- {"Armenian", "arm", "hy", MAKELCID(MAKELANGID(LANG_ARMENIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Armenian", "hye", "hy", MAKELCID(MAKELANGID(LANG_ARMENIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Artificial (Other)", "art", ""},
- {"Assamese", "asm", "as", MAKELCID(MAKELANGID(LANG_ASSAMESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Asturian; Bable", "ast", ""},
- {"Athapascan languages", "ath", ""},
- {"Australian languages", "aus", ""},
- {"Austronesian (Other)", "map", ""},
- {"Avaric", "ava", "av"},
- {"Avestan", "ave", "ae"},
- {"Awadhi", "awa", ""},
- {"Aymara", "aym", "ay"},
- {"Azerbaijani", "aze", "az", MAKELCID(MAKELANGID(LANG_AZERI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Bable; Asturian", "ast", ""},
- {"Balinese", "ban", ""},
- {"Baltic (Other)", "bat", ""},
- {"Baluchi", "bal", ""},
- {"Bambara", "bam", "bm"},
- {"Bamileke languages", "bai", ""},
- {"Banda", "bad", ""},
- {"Bantu (Other)", "bnt", ""},
- {"Basa", "bas", ""},
- {"Bashkir", "bak", "ba", MAKELCID(MAKELANGID(LANG_BASHKIR, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Basque", "baq", "eu", MAKELCID(MAKELANGID(LANG_BASQUE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Basque", "eus", "eu", MAKELCID(MAKELANGID(LANG_BASQUE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Batak (Indonesia)", "btk", ""},
- {"Beja", "bej", ""},
- {"Belarusian", "bel", "be", MAKELCID(MAKELANGID(LANG_BELARUSIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Bemba", "bem", ""},
- {"Bengali", "ben", "bn", MAKELCID(MAKELANGID(LANG_BENGALI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Berber (Other)", "ber", ""},
- {"Bhojpuri", "bho", ""},
- {"Bihari", "bih", "bh"},
- {"Bikol", "bik", ""},
- {"Bini", "bin", ""},
- {"Bislama", "bis", "bi"},
- {"Blin", "byn", ""},
- {"Bokmål, Norwegian; Norwegian Bokmål", "nob", "nb"},
- {"Bosnian", "bos", "bs"},
- {"Braj", "bra", ""},
- {"Portuguese (BR)", "pob", "pb"}, // unofficial codes for Brazilian Portuguese language
- {"Breton", "bre", "br", MAKELCID(MAKELANGID(LANG_BRETON, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Buginese", "bug", ""},
- {"Bulgarian", "bul", "bg", MAKELCID(MAKELANGID(LANG_BULGARIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Buriat", "bua", ""},
- {"Burmese", "bur", "my"},
- {"Burmese", "mya", "my"},
- {"Caddo", "cad", ""},
- {"Carib", "car", ""},
- {"Catalan", "cat", "ca", MAKELCID(MAKELANGID(LANG_CATALAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Caucasian (Other)", "cau", ""},
- {"Cebuano", "ceb", ""},
- {"Celtic (Other)", "cel", ""},
- {"Central American Indian (Other)", "cai", ""},
- {"Chagatai", "chg", ""},
- {"Chamic languages", "cmc", ""},
- {"Chamorro", "cha", "ch"},
- {"Chechen", "che", "ce"},
- {"Cherokee", "chr", ""},
- {"Chewa; Chichewa; Nyanja", "nya", "ny"},
- {"Cheyenne", "chy", ""},
- {"Chibcha", "chb", ""},
- {"Chichewa; Chewa; Nyanja", "nya", "ny"},
- {"Chinese (traditional)", "zht", "zt"},
- {"Chinese bilingual", "zhe", "ze"},
- {"Chinese (simplified)", "chi", "zh", MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Chinese", "zho", "zh"},
- {"Chinook jargon", "chn", ""},
- {"Chipewyan", "chp", ""},
- {"Choctaw", "cho", ""},
- {"Chuang; Zhuang", "zha", "za"},
- {"Church Slavic; Old Church Slavonic", "chu", "cu"},
- {"Church Slavic; Old Church Slavonic", "chu", "cu"},
- {"Church Slavonic; Old Bulgarian; Church Slavic;", "chu", "cu"},
- {"Chuukese", "chk", ""},
- {"Chuvash", "chv", "cv"},
- {"Classical Newari", "nwc", ""},
- {"Coptic", "cop", ""},
- {"Cornish", "cor", "kw"},
- {"Corsican", "cos", "co", MAKELCID(MAKELANGID(LANG_CORSICAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Cree", "cre", "cr"},
- {"Creek", "mus", ""},
- {"Creoles and pidgins (Other)", "crp", ""},
- {"Creoles and pidgins,", "cpe", ""},
- {"Creoles and pidgins,", "cpf", ""},
- {"Creoles and pidgins,", "cpp", ""},
- {"Crimean Turkish", "crh", ""},
- {"Croatian", "hrv", "hr", MAKELCID(MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Croatian", "scr", "hr", MAKELCID(MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Cushitic (Other)", "cus", ""},
- {"Czech", "cze", "cs", MAKELCID(MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Czech", "ces", "cs", MAKELCID(MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Dakota", "dak", ""},
- {"Danish", "dan", "da", MAKELCID(MAKELANGID(LANG_DANISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Dargwa", "dar", ""},
- {"Dayak", "day", ""},
- {"Delaware", "del", ""},
- {"Dinka", "din", ""},
- {"Divehi", "div", "dv", MAKELCID(MAKELANGID(LANG_DIVEHI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Dogri", "doi", ""},
- {"Dogrib", "dgr", ""},
- {"Dravidian (Other)", "dra", ""},
- {"Duala", "dua", ""},
- {"Dutch, Middle (ca. 1050-1350)", "dum", ""},
- {"Dutch; Flemish", "dut", "nl", MAKELCID(MAKELANGID(LANG_DUTCH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Dutch; Flemish", "nld", "nl", MAKELCID(MAKELANGID(LANG_DUTCH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Dyula", "dyu", ""},
- {"Dzongkha", "dzo", "dz"},
- {"Efik", "efi", ""},
- {"Egyptian (Ancient)", "egy", ""},
- {"Ekajuk", "eka", ""},
- {"Elamite", "elx", ""},
- {"English", "eng", "en", MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"English, Middle (1100-1500)", "enm", ""},
- {"English, Old (ca.450-1100)", "ang", ""},
- {"Erzya", "myv", ""},
- {"Esperanto", "epo", "eo"},
- {"Estonian", "est", "et", MAKELCID(MAKELANGID(LANG_ESTONIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Ewe", "ewe", "ee"},
- {"Ewondo", "ewo", ""},
- {"Fang", "fan", ""},
- {"Fanti", "fat", ""},
- {"Faroese", "fao", "fo", MAKELCID(MAKELANGID(LANG_FAEROESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Fijian", "fij", "fj"},
- {"Finnish", "fin", "fi", MAKELCID(MAKELANGID(LANG_FINNISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Finno-Ugrian (Other)", "fiu", ""},
- {"Flemish; Dutch", "dut", "nl"},
- {"Flemish; Dutch", "nld", "nl"},
- {"Fon", "fon", ""},
- {"French", "fre", "fr", MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"French", "fra*", "fr", MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"French", "fra", "fr", MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"French, Middle (ca.1400-1600)", "frm", ""},
- {"French, Old (842-ca.1400)", "fro", ""},
- {"Frisian", "fry", "fy", MAKELCID(MAKELANGID(LANG_FRISIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Friulian", "fur", ""},
- {"Fulah", "ful", "ff"},
- {"Ga", "gaa", ""},
- {"Gaelic; Scottish Gaelic", "gla", "gd", MAKELCID(MAKELANGID(LANG_GALICIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Galician", "glg", "gl"},
- {"Ganda", "lug", "lg"},
- {"Gayo", "gay", ""},
- {"Gbaya", "gba", ""},
- {"Geez", "gez", ""},
- {"Georgian", "geo", "ka", MAKELCID(MAKELANGID(LANG_GEORGIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Georgian", "kat", "ka", MAKELCID(MAKELANGID(LANG_GEORGIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"German", "ger", "de", MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"German", "deu", "de", MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"German, Low; Saxon, Low; Low German; Low Saxon", "nds", ""},
- {"German, Middle High (ca.1050-1500)", "gmh", ""},
- {"German, Old High (ca.750-1050)", "goh", ""},
- {"Germanic (Other)", "gem", ""},
- {"Gikuyu; Kikuyu", "kik", "ki"},
- {"Gilbertese", "gil", ""},
- {"Gondi", "gon", ""},
- {"Gorontalo", "gor", ""},
- {"Gothic", "got", ""},
- {"Grebo", "grb", ""},
- {"Greek", "ell", "el", MAKELCID(MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Greek", "gre", "el", MAKELCID(MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Greek, Ancient (to 1453)", "grc", "", MAKELCID(MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Greenlandic; Kalaallisut", "kal", "kl", MAKELCID(MAKELANGID(LANG_GREENLANDIC, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Guarani", "grn", "gn"},
- {"Gujarati", "guj", "gu", MAKELCID(MAKELANGID(LANG_GUJARATI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Gwich’in", "gwi", ""},
- {"Haida", "hai", ""},
- {"Haitian", "hat", "ht"},
- {"Hausa", "hau", "ha", MAKELCID(MAKELANGID(LANG_HAUSA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Hawaiian", "haw", ""},
- {"Hebrew", "heb", "he", MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Herero", "her", "hz"},
- {"Hiligaynon", "hil", ""},
- {"Himachali", "him", ""},
- {"Hindi", "hin", "hi", MAKELCID(MAKELANGID(LANG_HINDI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Hiri Motu", "hmo", "ho"},
- {"Hittite", "hit", ""},
- {"Hmong", "hmn", ""},
- {"Hungarian", "hun", "hu", MAKELCID(MAKELANGID(LANG_HUNGARIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Hupa", "hup", ""},
- {"Iban", "iba", ""},
- {"Icelandic", "ice", "is", MAKELCID(MAKELANGID(LANG_ICELANDIC, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Icelandic", "isl", "is", MAKELCID(MAKELANGID(LANG_ICELANDIC, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Ido", "ido", "io"},
- {"Igbo", "ibo", "ig", MAKELCID(MAKELANGID(LANG_IGBO, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Ijo", "ijo", ""},
- {"Iloko", "ilo", ""},
- {"Inari Sami", "smn", ""},
- {"Indic (Other)", "inc", ""},
- {"Indo-European (Other)", "ine", ""},
- {"Indonesian", "ind", "id", MAKELCID(MAKELANGID(LANG_INDONESIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Ingush", "inh", ""},
- {"Interlingua (International", "ina", "ia"},
- {"Interlingue", "ile", "ie"},
- {"Inuktitut", "iku", "iu", MAKELCID(MAKELANGID(LANG_INUKTITUT, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Inupiaq", "ipk", "ik"},
- {"Iranian (Other)", "ira", ""},
- {"Irish", "gle", "ga", MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Irish, Middle (900-1200)", "mga", "", MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Irish, Old (to 900)", "sga", "", MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Iroquoian languages", "iro", ""},
- {"Italian", "ita", "it", MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Japanese", "jpn", "ja", MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Javanese", "jav", "jv"},
- {"Judeo-Arabic", "jrb", ""},
- {"Judeo-Persian", "jpr", ""},
- {"Kabardian", "kbd", ""},
- {"Kabyle", "kab", ""},
- {"Kachin", "kac", ""},
- {"Kalaallisut; Greenlandic", "kal", "kl"},
- {"Kalmyk", "xal", ""},
- {"Kamba", "kam", ""},
- {"Kannada", "kan", "kn", MAKELCID(MAKELANGID(LANG_KANNADA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Kanuri", "kau", "kr"},
- {"Kara-Kalpak", "kaa", ""},
- {"Karachay-Balkar", "krc", ""},
- {"Karen", "kar", ""},
- {"Kashmiri", "kas", "ks", MAKELCID(MAKELANGID(LANG_KASHMIRI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Kashubian", "csb", ""},
- {"Kawi", "kaw", ""},
- {"Kazakh", "kaz", "kk", MAKELCID(MAKELANGID(LANG_KAZAK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Khasi", "kha", ""},
- {"Khmer", "khm", "km", MAKELCID(MAKELANGID(LANG_KHMER, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Khoisan (Other)", "khi", ""},
- {"Khotanese", "kho", ""},
- {"Kikuyu; Gikuyu", "kik", "ki"},
- {"Kimbundu", "kmb", ""},
- {"Kinyarwanda", "kin", "rw", MAKELCID(MAKELANGID(LANG_KINYARWANDA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Kirghiz", "kir", "ky"},
- {"Klingon", "tlh", ""},
- {"Komi", "kom", "kv"},
- {"Kongo", "kon", "kg"},
- {"Konkani", "kok", "", MAKELCID(MAKELANGID(LANG_KONKANI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Korean", "kor", "ko", MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Kosraean", "kos", ""},
- {"Kpelle", "kpe", ""},
- {"Kru", "kro", ""},
- {"Kuanyama; Kwanyama", "kua", "kj"},
- {"Kumyk", "kum", ""},
- {"Kurdish", "kur", "ku"},
- {"Kurukh", "kru", ""},
- {"Kutenai", "kut", ""},
- {"Kwanyama, Kuanyama", "kua", "kj"},
- {"Ladino", "lad", ""},
- {"Lahnda", "lah", ""},
- {"Lamba", "lam", ""},
- {"Lao", "lao", "lo", MAKELCID(MAKELANGID(LANG_LAO, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Latin", "lat", "la"},
- {"Latvian", "lav", "lv", MAKELCID(MAKELANGID(LANG_LATVIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Lezghian", "lez", ""},
- {"Limburgan; Limburger; Limburgish", "lim", "li"},
- {"Limburger; Limburgan; Limburgish;", "lim", "li"},
- {"Limburgish; Limburger; Limburgan", "lim", "li"},
- {"Lingala", "lin", "ln"},
- {"Lithuanian", "lit", "lt", MAKELCID(MAKELANGID(LANG_LITHUANIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Lojban", "jbo", ""},
- {"Low German; Low Saxon; German, Low; Saxon, Low", "nds", ""},
- {"Low Saxon; Low German; Saxon, Low; German, Low", "nds", ""},
- {"Lower Sorbian", "dsb", ""},
- {"Lozi", "loz", ""},
- {"Luba-Katanga", "lub", "lu"},
- {"Luba-Lulua", "lua", ""},
- {"Luiseno", "lui", ""},
- {"Lule Sami", "smj", ""},
- {"Lunda", "lun", ""},
- {"Luo (Kenya and Tanzania)", "luo", ""},
- {"Lushai", "lus", ""},
- {"Luxembourgish", "ltz", "lb", MAKELCID(MAKELANGID(LANG_LUXEMBOURGISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Macedonian", "mac", "mk", MAKELCID(MAKELANGID(LANG_MACEDONIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Macedonian", "mkd", "mk", MAKELCID(MAKELANGID(LANG_MACEDONIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Madurese", "mad", ""},
- {"Magahi", "mag", ""},
- {"Maithili", "mai", ""},
- {"Makasar", "mak", ""},
- {"Malagasy", "mlg", "mg"},
- {"Malay", "may", "ms", MAKELCID(MAKELANGID(LANG_MALAY, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Malay", "msa", "ms", MAKELCID(MAKELANGID(LANG_MALAY, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Malayalam", "mal", "ml", MAKELCID(MAKELANGID(LANG_MALAYALAM, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Maltese", "mlt", "mt", MAKELCID(MAKELANGID(LANG_MALTESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Manchu", "mnc", ""},
- {"Mandar", "mdr", ""},
- {"Mandingo", "man", ""},
- {"Manipuri", "mni", "ma", MAKELCID(MAKELANGID(LANG_MANIPURI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Manobo languages", "mno", ""},
- {"Manx", "glv", "gv"},
- {"Maori", "mao", "mi", MAKELCID(MAKELANGID(LANG_MAORI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Maori", "mri", "mi", MAKELCID(MAKELANGID(LANG_MAORI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Marathi", "mar", "mr", MAKELCID(MAKELANGID(LANG_MARATHI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Mari", "chm", ""},
- {"Marshallese", "mah", "mh"},
- {"Marwari", "mwr", ""},
- {"Masai", "mas", ""},
- {"Mayan languages", "myn", ""},
- {"Mende", "men", ""},
- {"Micmac", "mic", ""},
- {"Minangkabau", "min", ""},
- {"Miscellaneous languages", "mis", ""},
- {"Mohawk", "moh", "", MAKELCID(MAKELANGID(LANG_MOHAWK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Moksha", "mdf", ""},
- {"Moldavian", "mol", "mo"},
- {"Mon-Khmer (Other)", "mkh", ""},
- {"Mongo", "lol", ""},
- {"Mongolian", "mon", "mn", MAKELCID(MAKELANGID(LANG_MONGOLIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Montenegrin", "mne", "me"},
- {"Mossi", "mos", ""},
- {"Multiple languages", "mul", ""},
- {"Munda languages", "mun", ""},
- {"Nahuatl", "nah", ""},
- {"Nauru", "nau", "na"},
- {"Navaho, Navajo", "nav", "nv"},
- {"Navajo; Navaho", "nav", "nv"},
- {"Ndebele, North", "nde", "nd"},
- {"Ndebele, South", "nbl", "nr"},
- {"Ndonga", "ndo", "ng"},
- {"Neapolitan", "nap", ""},
- {"Nepali", "nep", "ne", MAKELCID(MAKELANGID(LANG_NEPALI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Newari", "new", ""},
- {"Nias", "nia", ""},
- {"Niger-Kordofanian (Other)", "nic", ""},
- {"Nilo-Saharan (Other)", "ssa", ""},
- {"Niuean", "niu", ""},
- {"Nogai", "nog", ""},
- {"Norse, Old", "non", ""},
- {"North American Indian (Other)", "nai", ""},
- {"North Ndebele", "nde", "nd"},
- {"Northern Sami", "sme", "se"},
- {"Norwegian Bokmål; Bokmål, Norwegian", "nob", "nb", MAKELCID(MAKELANGID(LANG_NORWEGIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Norwegian Nynorsk; Nynorsk, Norwegian", "nno", "nn", MAKELCID(MAKELANGID(LANG_NORWEGIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Norwegian", "nor", "no", MAKELCID(MAKELANGID(LANG_NORWEGIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Nubian languages", "nub", ""},
- {"Nyamwezi", "nym", ""},
- {"Nyanja; Chichewa; Chewa", "nya", "ny"},
- {"Nyankole", "nyn", ""},
- {"Nynorsk, Norwegian; Norwegian Nynorsk", "nno", "nn"},
- {"Nyoro", "nyo", ""},
- {"Nzima", "nzi", ""},
- {"Occitan (post 1500},; Provençal", "oci", "oc", MAKELCID(MAKELANGID(LANG_OCCITAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Ojibwa", "oji", "oj"},
- {"Old Bulgarian; Old Slavonic; Church Slavonic;", "chu", "cu"},
- {"Old Church Slavonic; Old Slavonic; ", "chu", "cu"},
- {"Old Slavonic; Church Slavonic; Old Bulgarian;", "chu", "cu"},
- {"Oriya", "ori", "or"},
- {"Oromo", "orm", "om"},
- {"Osage", "osa", ""},
- {"Ossetian; Ossetic", "oss", "os"},
- {"Ossetic; Ossetian", "oss", "os"},
- {"Otomian languages", "oto", ""},
- {"Pahlavi", "pal", ""},
- {"Palauan", "pau", ""},
- {"Pali", "pli", "pi"},
- {"Pampanga", "pam", ""},
- {"Pangasinan", "pag", ""},
- {"Panjabi", "pan", "pa"},
- {"Papiamento", "pap", ""},
- {"Papuan (Other)", "paa", ""},
- {"Persian", "per", "fa", MAKELCID(MAKELANGID(LANG_PERSIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Persian", "fas", "fa", MAKELCID(MAKELANGID(LANG_PERSIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Persian, Old (ca.600-400 B.C.)", "peo", ""},
- {"Philippine (Other)", "phi", ""},
- {"Phoenician", "phn", ""},
- {"Pohnpeian", "pon", ""},
- {"Polish", "pol", "pl", MAKELCID(MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Portuguese", "por", "pt", MAKELCID(MAKELANGID(LANG_PORTUGUESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Prakrit languages", "pra", ""},
- {"Provençal, Old (to 1500)", "pro", ""},
- {"Provençal; Occitan (post 1500)", "oci", "oc"},
- {"Pushto", "pus", "ps"},
- {"Quechua", "que", "qu", MAKELCID(MAKELANGID(LANG_QUECHUA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Raeto-Romance", "roh", "rm"},
- {"Rajasthani", "raj", ""},
- {"Rapanui", "rap", ""},
- {"Rarotongan", "rar", ""},
- {"Reserved for local use", "qaa-qtz", ""},
- {"Romance (Other)", "roa", ""},
- {"Romanian", "rum", "ro", MAKELCID(MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Romanian", "ron", "ro", MAKELCID(MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Romany", "rom", ""},
- {"Rundi", "run", "rn"},
- {"Russian", "rus", "ru", MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Salishan languages", "sal", ""},
- {"Samaritan Aramaic", "sam", ""},
- {"Sami languages (Other)", "smi", ""},
- {"Samoan", "smo", "sm"},
- {"Sandawe", "sad", ""},
- {"Sango", "sag", "sg"},
- {"Sanskrit", "san", "sa", MAKELCID(MAKELANGID(LANG_SANSKRIT, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Santali", "sat", ""},
- {"Sardinian", "srd", "sc"},
- {"Sasak", "sas", ""},
- {"Saxon, Low; German, Low; Low Saxon; Low German", "nds", ""},
- {"Scots", "sco", ""},
- {"Scottish Gaelic; Gaelic", "gla", "gd"},
- {"Selkup", "sel", ""},
- {"Semitic (Other)", "sem", ""},
- {"Serbian", "scc", "sr", MAKELCID(LANG_SERBIAN_NEUTRAL, SORT_DEFAULT)},
- {"Serbian", "srp", "sr", MAKELCID(LANG_SERBIAN_NEUTRAL, SORT_DEFAULT)},
- {"Serer", "srr", ""},
- {"Shan", "shn", ""},
- {"Shona", "sna", "sn"},
- {"Sichuan Yi", "iii", "ii"},
- {"Sidamo", "sid", ""},
- {"Sign languages", "sgn", ""},
- {"Siksika", "bla", ""},
- {"Sindhi", "snd", "sd", MAKELCID(MAKELANGID(LANG_SINDHI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Sinhalese", "sin", "si", MAKELCID(MAKELANGID(LANG_SINHALESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Sino-Tibetan (Other)", "sit", ""},
- {"Siouan languages", "sio", ""},
- {"Skolt Sami", "sms", ""},
- {"Slave (Athapascan)", "den", ""},
- {"Slavic (Other)", "sla", ""},
- {"Slovak", "slo", "sk", MAKELCID(MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Slovak", "slk", "sk", MAKELCID(MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Slovenian", "slv", "sl", MAKELCID(MAKELANGID(LANG_SLOVENIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Sogdian", "sog", ""},
- {"Somali", "som", "so"},
- {"Songhai", "son", ""},
- {"Soninke", "snk", ""},
- {"Sorbian languages", "wen", ""},
- {"Sotho, Northern", "nso", "", MAKELCID(MAKELANGID(LANG_SOTHO, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Sotho, Southern", "sot", "st", MAKELCID(MAKELANGID(LANG_SOTHO, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"South American Indian (Other)", "sai", ""},
- {"South Ndebele", "nbl", "nr"},
- {"Southern Sami", "sma", ""},
- {"Spanish; Castilian", "spa", "es", MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Sukuma", "suk", ""},
- {"Sumerian", "sux", ""},
- {"Sundanese", "sun", "su"},
- {"Susu", "sus", ""},
- {"Swahili", "swa", "sw", MAKELCID(MAKELANGID(LANG_SWAHILI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Swati", "ssw", "ss"},
- {"Swedish", "swe", "sv", MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Syriac", "syr", "sy", MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tagalog", "tgl", "tl"},
- {"Tahitian", "tah", "ty"},
- {"Tai (Other)", "tai", ""},
- {"Tajik", "tgk", "tg", MAKELCID(MAKELANGID(LANG_TAJIK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tamashek", "tmh", ""},
- {"Tamil", "tam", "ta", MAKELCID(MAKELANGID(LANG_TAMIL, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tatar", "tat", "tt", MAKELCID(MAKELANGID(LANG_TATAR, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Telugu", "tel", "te", MAKELCID(MAKELANGID(LANG_TELUGU, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tereno", "ter", ""},
- {"Tetum", "tet", ""},
- {"Thai", "tha", "th", MAKELCID(MAKELANGID(LANG_THAI, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tibetan", "tib", "bo", MAKELCID(MAKELANGID(LANG_TIBETAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tibetan", "bod", "bo", MAKELCID(MAKELANGID(LANG_TIBETAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tigre", "tig", ""},
- {"Tigrinya", "tir", "ti", MAKELCID(MAKELANGID(LANG_TIGRIGNA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Timne", "tem", ""},
- {"Tiv", "tiv", ""},
- {"Tlingit", "tli", ""},
- {"Tok Pisin", "tpi", ""},
- {"Tokelau", "tkl", ""},
- {"Tonga (Nyasa)", "tog", ""},
- {"Tonga (Tonga Islands)", "ton", "to"},
- {"Tsimshian", "tsi", ""},
- {"Tsonga", "tso", "ts"},
- {"Tswana", "tsn", "tn", MAKELCID(MAKELANGID(LANG_TSWANA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tumbuka", "tum", ""},
- {"Tupi languages", "tup", ""},
- {"Turkish", "tur", "tr", MAKELCID(MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Turkish, Ottoman (1500-1928)", "ota", "", MAKELCID(MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Turkmen", "tuk", "tk", MAKELCID(MAKELANGID(LANG_TURKMEN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Tuvalu", "tvl", ""},
- {"Tuvinian", "tyv", ""},
- {"Twi", "twi", "tw"},
- {"Udmurt", "udm", ""},
- {"Ugaritic", "uga", ""},
- {"Uighur", "uig", "ug", MAKELCID(MAKELANGID(LANG_UIGHUR, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Ukrainian", "ukr", "uk", MAKELCID(MAKELANGID(LANG_UKRAINIAN, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Umbundu", "umb", ""},
- {"Undetermined", "und", ""},
- {"Upper Sorbian", "hsb", ""},
- {"Urdu", "urd", "ur", MAKELCID(MAKELANGID(LANG_URDU, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Uzbek", "uzb", "uz", MAKELCID(MAKELANGID(LANG_UZBEK, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Vai", "vai", ""},
- {"Venda", "ven", "ve"},
- {"Vietnamese", "vie", "vi", MAKELCID(MAKELANGID(LANG_VIETNAMESE, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Volapuk", "vol", "vo"},
- {"Votic", "vot", ""},
- {"Wakashan languages", "wak", ""},
- {"Walamo", "wal", ""},
- {"Walloon", "wln", "wa"},
- {"Waray", "war", ""},
- {"Washo", "was", ""},
- {"Welsh", "wel", "cy", MAKELCID(MAKELANGID(LANG_WELSH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Welsh", "cym", "cy", MAKELCID(MAKELANGID(LANG_WELSH, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Wolof", "wol", "wo", MAKELCID(MAKELANGID(LANG_WOLOF, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Xhosa", "xho", "xh", MAKELCID(MAKELANGID(LANG_XHOSA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Yakut", "sah", "", MAKELCID(MAKELANGID(LANG_YAKUT, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Yao", "yao", ""},
- {"Yapese", "yap", ""},
- {"Yiddish", "yid", "yi"},
- {"Yoruba", "yor", "yo", MAKELCID(MAKELANGID(LANG_YORUBA, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Yupik languages", "ypk", ""},
- {"Zande", "znd", ""},
- {"Zapotec", "zap", ""},
- {"Zenaga", "zen", ""},
- {"Zhuang; Chuang", "zha", "za"},
- {"Zulu", "zul", "zu", MAKELCID(MAKELANGID(LANG_ZULU, SUBLANG_DEFAULT), SORT_DEFAULT)},
- {"Zuni", "zun", ""},
- {"", "", ""},
- {"No subtitles", "---", "", (LCID)LCID_NOSUBTITLES},
-};
-
-CString ISO6391ToLanguage(LPCSTR code)
-{
- CHAR tmp[2 + 1];
- strncpy_s(tmp, code, 2);
- tmp[2] = 0;
- _strlwr_s(tmp);
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- if (!strcmp(s_isolangs[i].iso6391, tmp)) {
- CString ret = CString(CStringA(s_isolangs[i].name));
- int k = ret.Find(';');
- if (k > 0) {
- ret = ret.Left(k);
- }
- return ret;
- }
- }
- return _T("");
-}
-
-CString ISO6392ToLanguage(LPCSTR code)
-{
- CHAR tmp[3 + 1];
- strncpy_s(tmp, code, 3);
- tmp[3] = 0;
- _strlwr_s(tmp);
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- if (!strcmp(s_isolangs[i].iso6392, tmp)) {
- CString ret = CString(CStringA(s_isolangs[i].name));
- int k = ret.Find(';');
- if (k > 0) {
- ret = ret.Left(k);
- }
- return ret;
- }
- }
- return CString(code);
-}
-
-bool IsISO639Language(LPCSTR code)
-{
- size_t nLen = strlen(code) + 1;
- LPSTR tmp = DEBUG_NEW CHAR[nLen];
- strncpy_s(tmp, nLen, code, nLen);
- _strlwr_s(tmp, nLen);
- tmp[0] = (CHAR)toupper(tmp[0]);
-
- bool bFound = false;
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- if (!strcmp(s_isolangs[i].name, tmp)) {
- bFound = true;
- break;
- }
- }
-
- delete [] tmp;
-
- return bFound;
-}
-
-CString ISO639XToLanguage(LPCSTR code, bool bCheckForFullLangName /*= false*/)
-{
- CString lang;
-
- switch (size_t nLen = strlen(code)) {
- case 2:
- lang = ISO6391ToLanguage(code);
- break;
- case 3:
- lang = ISO6392ToLanguage(code);
- if (lang == code) { // When it can't find a match, ISO6392ToLanguage returns the input string
- lang.Empty();
- }
- break;
- default:
- if (bCheckForFullLangName && nLen > 3) {
- if (IsISO639Language(code)) {
- lang = code;
- }
- }
- }
-
- return lang;
-}
-
-LCID ISO6391ToLcid(LPCSTR code)
-{
- CHAR tmp[3 + 1];
- strncpy_s(tmp, code, 3);
- tmp[3] = 0;
- _strlwr_s(tmp);
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- if (!strcmp(s_isolangs[i].iso6391, code)) {
- return s_isolangs[i].lcid;
- }
- }
- return 0;
-}
-
-LCID ISO6392ToLcid(LPCSTR code)
-{
- CHAR tmp[3 + 1];
- strncpy_s(tmp, code, 3);
- tmp[3] = 0;
- _strlwr_s(tmp);
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- if (!strcmp(s_isolangs[i].iso6392, tmp)) {
- return s_isolangs[i].lcid;
- }
- }
- return 0;
-}
-
-CStringA ISO6391To6392(LPCSTR code)
-{
- CHAR tmp[2 + 1];
- strncpy_s(tmp, code, 2);
- tmp[2] = 0;
- _strlwr_s(tmp);
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- if (!strcmp(s_isolangs[i].iso6391, tmp)) {
- return CStringA(s_isolangs[i].iso6392);
- }
- }
- return "";
-}
-
-CString ISO6392To6391(LPCSTR code)
-{
- CHAR tmp[3 + 1];
- strncpy_s(tmp, code, 3);
- tmp[3] = 0;
- _strlwr_s(tmp);
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- if (!strcmp(s_isolangs[i].iso6392, tmp)) {
- return CString(s_isolangs[i].iso6391);
- }
- }
- return _T("");
-}
-
-CString LanguageToISO6392(LPCTSTR lang)
-{
- CString str = lang;
- str.MakeLower();
- for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) {
- CAtlList<CString> sl;
- Explode(CString(s_isolangs[i].name), sl, ';');
- POSITION pos = sl.GetHeadPosition();
- while (pos) {
- if (!str.CompareNoCase(sl.GetNext(pos))) {
- return CString(s_isolangs[i].iso6392);
- }
- }
- }
- return _T("");
-}
-
BOOL CFileGetStatus(LPCTSTR lpszFileName, CFileStatus& status)
{
try {
diff --git a/src/DSUtil/DSUtil.h b/src/DSUtil/DSUtil.h index 9e360e7cd..4f90d347d 100644 --- a/src/DSUtil/DSUtil.h +++ b/src/DSUtil/DSUtil.h @@ -105,15 +105,6 @@ extern CStringW UTF8To16(LPCSTR utf8); extern CStringA UTF16To8(LPCWSTR utf16);
extern CStringW UTF8ToStringW(const char* S);
extern CStringW LocalToStringW(const char* S);
-extern CString ISO6391ToLanguage(LPCSTR code);
-extern CString ISO6392ToLanguage(LPCSTR code);
-extern bool IsISO639Language(LPCSTR code);
-extern CString ISO639XToLanguage(LPCSTR code, bool bCheckForFullLangName = false);
-extern LCID ISO6391ToLcid(LPCSTR code);
-extern LCID ISO6392ToLcid(LPCSTR code);
-extern CStringA ISO6391To6392(LPCSTR code);
-extern CString ISO6392To6391(LPCSTR code);
-extern CString LanguageToISO6392(LPCTSTR lang);
extern BOOL CFileGetStatus(LPCTSTR lpszFileName, CFileStatus& status);
extern bool DeleteRegKey(LPCTSTR pszKey, LPCTSTR pszSubkey);
extern bool SetRegKeyValue(LPCTSTR pszKey, LPCTSTR pszSubkey, LPCTSTR pszValueName, LPCTSTR pszValue);
diff --git a/src/DSUtil/DSUtil.vcxproj b/src/DSUtil/DSUtil.vcxproj index 46b8e1457..abe8bcf67 100644 --- a/src/DSUtil/DSUtil.vcxproj +++ b/src/DSUtil/DSUtil.vcxproj @@ -60,6 +60,7 @@ <ClCompile Include="GolombBuffer.cpp" />
<ClCompile Include="H264Nalu.cpp" />
<ClCompile Include="HdmvClipInfo.cpp" />
+ <ClCompile Include="ISOLang.cpp" />
<ClCompile Include="MediaTypeEx.cpp" />
<ClCompile Include="MediaTypes.cpp" />
<ClCompile Include="NullRenderers.cpp" />
@@ -86,6 +87,7 @@ <ClInclude Include="GolombBuffer.h" />
<ClInclude Include="H264Nalu.h" />
<ClInclude Include="HdmvClipInfo.h" />
+ <ClInclude Include="ISOLang.h" />
<ClInclude Include="MediaTypeEx.h" />
<ClInclude Include="MediaTypes.h" />
<ClInclude Include="MhookHelper.h" />
diff --git a/src/DSUtil/DSUtil.vcxproj.filters b/src/DSUtil/DSUtil.vcxproj.filters index 0be464f8e..9c5ad9d01 100644 --- a/src/DSUtil/DSUtil.vcxproj.filters +++ b/src/DSUtil/DSUtil.vcxproj.filters @@ -68,6 +68,9 @@ <ClCompile Include="PathUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="ISOLang.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DSMPropertyBag.h">
@@ -142,5 +145,8 @@ <ClInclude Include="Constexpr.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="ISOLang.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/DSUtil/HdmvClipInfo.cpp b/src/DSUtil/HdmvClipInfo.cpp index c10d4f29b..0c387e3dc 100644 --- a/src/DSUtil/HdmvClipInfo.cpp +++ b/src/DSUtil/HdmvClipInfo.cpp @@ -21,8 +21,8 @@ #include "stdafx.h"
#include "HdmvClipInfo.h"
#include "DSUtil.h"
+#include "ISOLang.h"
-extern LCID ISO6392ToLcid(LPCSTR code);
CHdmvClipInfo::CHdmvClipInfo()
: SequenceInfo_start_address(0)
@@ -133,7 +133,7 @@ HRESULT CHdmvClipInfo::ReadProgramInfo() ReadBuffer((BYTE*)m_Streams[iStream].m_LanguageCode, 3);
m_Streams[iStream].m_LanguageCode[3] = '\0';
- m_Streams[iStream].m_LCID = ISO6392ToLcid(m_Streams[iStream].m_LanguageCode);
+ m_Streams[iStream].m_LCID = ISOLang::ISO6392ToLcid(m_Streams[iStream].m_LanguageCode);
m_Streams[iStream].m_ChannelLayout = ChannelLayout;
m_Streams[iStream].m_SampleRate = SampleRate;
}
@@ -142,14 +142,14 @@ HRESULT CHdmvClipInfo::ReadProgramInfo() case INTERACTIVE_GRAPHICS_STREAM: {
ReadBuffer((BYTE*)m_Streams[iStream].m_LanguageCode, 3);
m_Streams[iStream].m_LanguageCode[3] = '\0';
- m_Streams[iStream].m_LCID = ISO6392ToLcid(m_Streams[iStream].m_LanguageCode);
+ m_Streams[iStream].m_LCID = ISOLang::ISO6392ToLcid(m_Streams[iStream].m_LanguageCode);
}
break;
case SUBTITLE_STREAM: {
ReadByte(); // Should this really be here?
ReadBuffer((BYTE*)m_Streams[iStream].m_LanguageCode, 3);
m_Streams[iStream].m_LanguageCode[3] = '\0';
- m_Streams[iStream].m_LCID = ISO6392ToLcid(m_Streams[iStream].m_LanguageCode);
+ m_Streams[iStream].m_LCID = ISOLang::ISO6392ToLcid(m_Streams[iStream].m_LanguageCode);
}
break;
default:
diff --git a/src/DSUtil/ISOLang.cpp b/src/DSUtil/ISOLang.cpp new file mode 100644 index 000000000..3b183b497 --- /dev/null +++ b/src/DSUtil/ISOLang.cpp @@ -0,0 +1,717 @@ +/* + * (C) 2016 see Authors.txt + * + * This file is part of MPC-HC. + * + * MPC-HC is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * MPC-HC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "stdafx.h" +#include "ISOLang.h" +#include "DSUtil.h" +#include "text.h" + +namespace +{ + ISOLang s_isolangs[] = { // TODO : fill LCID !!! + // {"Auxiliary Language Association)", "", ""}, + // {"English-based (Other)", "", ""}, + // {"French-based (Other)", "", ""}, + // {"Portuguese-based (Other)", "", ""}, + { "Abkhazian", "abk", "ab" }, + { "Achinese", "ace", "" }, + { "Acoli", "ach", "" }, + { "Adangme", "ada", "" }, + { "Adyghe", "ady", "" }, + { "Afar", "aar", "aa" }, + { "Afrihili", "afh", "" }, + { "Afrikaans", "afr", "af", MAKELCID(MAKELANGID(LANG_AFRIKAANS, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Afro-Asiatic (Other)", "afa", "" }, + { "Akan", "aka", "ak" }, + { "Akkadian", "akk", "" }, + { "Albanian", "alb", "sq" }, + { "Albanian", "sqi", "sq", MAKELCID(MAKELANGID(LANG_ALBANIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Aleut", "ale", "" }, + { "Algonquian languages", "alg", "" }, + { "Altaic (Other)", "tut", "" }, + { "Amharic", "amh", "am" }, + { "Apache languages", "apa", "" }, + { "Arabic", "ara", "ar", MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Aragonese", "arg", "an" }, + { "Aramaic", "arc", "" }, + { "Arapaho", "arp", "" }, + { "Araucanian", "arn", "" }, + { "Arawak", "arw", "" }, + { "Armenian", "arm", "hy", MAKELCID(MAKELANGID(LANG_ARMENIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Armenian", "hye", "hy", MAKELCID(MAKELANGID(LANG_ARMENIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Artificial (Other)", "art", "" }, + { "Assamese", "asm", "as", MAKELCID(MAKELANGID(LANG_ASSAMESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Asturian; Bable", "ast", "" }, + { "Athapascan languages", "ath", "" }, + { "Australian languages", "aus", "" }, + { "Austronesian (Other)", "map", "" }, + { "Avaric", "ava", "av" }, + { "Avestan", "ave", "ae" }, + { "Awadhi", "awa", "" }, + { "Aymara", "aym", "ay" }, + { "Azerbaijani", "aze", "az", MAKELCID(MAKELANGID(LANG_AZERI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Bable; Asturian", "ast", "" }, + { "Balinese", "ban", "" }, + { "Baltic (Other)", "bat", "" }, + { "Baluchi", "bal", "" }, + { "Bambara", "bam", "bm" }, + { "Bamileke languages", "bai", "" }, + { "Banda", "bad", "" }, + { "Bantu (Other)", "bnt", "" }, + { "Basa", "bas", "" }, + { "Bashkir", "bak", "ba", MAKELCID(MAKELANGID(LANG_BASHKIR, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Basque", "baq", "eu", MAKELCID(MAKELANGID(LANG_BASQUE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Basque", "eus", "eu", MAKELCID(MAKELANGID(LANG_BASQUE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Batak (Indonesia)", "btk", "" }, + { "Beja", "bej", "" }, + { "Belarusian", "bel", "be", MAKELCID(MAKELANGID(LANG_BELARUSIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Bemba", "bem", "" }, + { "Bengali", "ben", "bn", MAKELCID(MAKELANGID(LANG_BENGALI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Berber (Other)", "ber", "" }, + { "Bhojpuri", "bho", "" }, + { "Bihari", "bih", "bh" }, + { "Bikol", "bik", "" }, + { "Bini", "bin", "" }, + { "Bislama", "bis", "bi" }, + { "Blin", "byn", "" }, + { "Bokmål, Norwegian; Norwegian Bokmål", "nob", "nb" }, + { "Bosnian", "bos", "bs" }, + { "Braj", "bra", "" }, + // unofficial codes for Brazilian Portuguese language + { "Portuguese (BR)", "pob", "pb", MAKELCID(MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN), SORT_DEFAULT) }, + { "Breton", "bre", "br", MAKELCID(MAKELANGID(LANG_BRETON, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Buginese", "bug", "" }, + { "Bulgarian", "bul", "bg", MAKELCID(MAKELANGID(LANG_BULGARIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Buriat", "bua", "" }, + { "Burmese", "bur", "my" }, + { "Burmese", "mya", "my" }, + { "Caddo", "cad", "" }, + { "Carib", "car", "" }, + { "Catalan", "cat", "ca", MAKELCID(MAKELANGID(LANG_CATALAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Caucasian (Other)", "cau", "" }, + { "Cebuano", "ceb", "" }, + { "Celtic (Other)", "cel", "" }, + { "Central American Indian (Other)", "cai", "" }, + { "Chagatai", "chg", "" }, + { "Chamic languages", "cmc", "" }, + { "Chamorro", "cha", "ch" }, + { "Chechen", "che", "ce" }, + { "Cherokee", "chr", "" }, + { "Chewa; Chichewa; Nyanja", "nya", "ny" }, + { "Cheyenne", "chy", "" }, + { "Chibcha", "chb", "" }, + { "Chichewa; Chewa; Nyanja", "nya", "ny" }, + { "Chinese (traditional)", "zht", "zt" }, + { "Chinese bilingual", "zhe", "ze" }, + { "Chinese (simplified)", "chi", "zh", MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Chinese", "zho", "zh" }, + { "Chinook jargon", "chn", "" }, + { "Chipewyan", "chp", "" }, + { "Choctaw", "cho", "" }, + { "Chuang; Zhuang", "zha", "za" }, + { "Church Slavic; Old Church Slavonic", "chu", "cu" }, + { "Church Slavic; Old Church Slavonic", "chu", "cu" }, + { "Church Slavonic; Old Bulgarian; Church Slavic;", "chu", "cu" }, + { "Chuukese", "chk", "" }, + { "Chuvash", "chv", "cv" }, + { "Classical Newari", "nwc", "" }, + { "Coptic", "cop", "" }, + { "Cornish", "cor", "kw" }, + { "Corsican", "cos", "co", MAKELCID(MAKELANGID(LANG_CORSICAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Cree", "cre", "cr" }, + { "Creek", "mus", "" }, + { "Creoles and pidgins (Other)", "crp", "" }, + { "Creoles and pidgins,", "cpe", "" }, + { "Creoles and pidgins,", "cpf", "" }, + { "Creoles and pidgins,", "cpp", "" }, + { "Crimean Turkish", "crh", "" }, + { "Croatian", "hrv", "hr", MAKELCID(MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Croatian", "scr", "hr", MAKELCID(MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Cushitic (Other)", "cus", "" }, + { "Czech", "cze", "cs", MAKELCID(MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Czech", "ces", "cs", MAKELCID(MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Dakota", "dak", "" }, + { "Danish", "dan", "da", MAKELCID(MAKELANGID(LANG_DANISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Dargwa", "dar", "" }, + { "Dayak", "day", "" }, + { "Delaware", "del", "" }, + { "Dinka", "din", "" }, + { "Divehi", "div", "dv", MAKELCID(MAKELANGID(LANG_DIVEHI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Dogri", "doi", "" }, + { "Dogrib", "dgr", "" }, + { "Dravidian (Other)", "dra", "" }, + { "Duala", "dua", "" }, + { "Dutch, Middle (ca. 1050-1350)", "dum", "" }, + { "Dutch; Flemish", "dut", "nl", MAKELCID(MAKELANGID(LANG_DUTCH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Dutch; Flemish", "nld", "nl", MAKELCID(MAKELANGID(LANG_DUTCH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Dyula", "dyu", "" }, + { "Dzongkha", "dzo", "dz" }, + { "Efik", "efi", "" }, + { "Egyptian (Ancient)", "egy", "" }, + { "Ekajuk", "eka", "" }, + { "Elamite", "elx", "" }, + { "English", "eng", "en", MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "English, Middle (1100-1500)", "enm", "" }, + { "English, Old (ca.450-1100)", "ang", "" }, + { "Erzya", "myv", "" }, + { "Esperanto", "epo", "eo" }, + { "Estonian", "est", "et", MAKELCID(MAKELANGID(LANG_ESTONIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Ewe", "ewe", "ee" }, + { "Ewondo", "ewo", "" }, + { "Fang", "fan", "" }, + { "Fanti", "fat", "" }, + { "Faroese", "fao", "fo", MAKELCID(MAKELANGID(LANG_FAEROESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Fijian", "fij", "fj" }, + { "Finnish", "fin", "fi", MAKELCID(MAKELANGID(LANG_FINNISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Finno-Ugrian (Other)", "fiu", "" }, + { "Flemish; Dutch", "dut", "nl" }, + { "Flemish; Dutch", "nld", "nl" }, + { "Fon", "fon", "" }, + { "French", "fre", "fr", MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "French", "fra*", "fr", MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "French", "fra", "fr", MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "French, Middle (ca.1400-1600)", "frm", "" }, + { "French, Old (842-ca.1400)", "fro", "" }, + { "Frisian", "fry", "fy", MAKELCID(MAKELANGID(LANG_FRISIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Friulian", "fur", "" }, + { "Fulah", "ful", "ff" }, + { "Ga", "gaa", "" }, + { "Gaelic; Scottish Gaelic", "gla", "gd", MAKELCID(MAKELANGID(LANG_GALICIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Galician", "glg", "gl" }, + { "Ganda", "lug", "lg" }, + { "Gayo", "gay", "" }, + { "Gbaya", "gba", "" }, + { "Geez", "gez", "" }, + { "Georgian", "geo", "ka", MAKELCID(MAKELANGID(LANG_GEORGIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Georgian", "kat", "ka", MAKELCID(MAKELANGID(LANG_GEORGIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "German", "ger", "de", MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "German", "deu", "de", MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "German, Low; Saxon, Low; Low German; Low Saxon", "nds", "" }, + { "German, Middle High (ca.1050-1500)", "gmh", "" }, + { "German, Old High (ca.750-1050)", "goh", "" }, + { "Germanic (Other)", "gem", "" }, + { "Gikuyu; Kikuyu", "kik", "ki" }, + { "Gilbertese", "gil", "" }, + { "Gondi", "gon", "" }, + { "Gorontalo", "gor", "" }, + { "Gothic", "got", "" }, + { "Grebo", "grb", "" }, + { "Greek", "ell", "el", MAKELCID(MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Greek", "gre", "el", MAKELCID(MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Greek, Ancient (to 1453)", "grc", "", MAKELCID(MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Greenlandic; Kalaallisut", "kal", "kl", MAKELCID(MAKELANGID(LANG_GREENLANDIC, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Guarani", "grn", "gn" }, + { "Gujarati", "guj", "gu", MAKELCID(MAKELANGID(LANG_GUJARATI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Gwich’in", "gwi", "" }, + { "Haida", "hai", "" }, + { "Haitian", "hat", "ht" }, + { "Hausa", "hau", "ha", MAKELCID(MAKELANGID(LANG_HAUSA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Hawaiian", "haw", "" }, + { "Hebrew", "heb", "he", MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Herero", "her", "hz" }, + { "Hiligaynon", "hil", "" }, + { "Himachali", "him", "" }, + { "Hindi", "hin", "hi", MAKELCID(MAKELANGID(LANG_HINDI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Hiri Motu", "hmo", "ho" }, + { "Hittite", "hit", "" }, + { "Hmong", "hmn", "" }, + { "Hungarian", "hun", "hu", MAKELCID(MAKELANGID(LANG_HUNGARIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Hupa", "hup", "" }, + { "Iban", "iba", "" }, + { "Icelandic", "ice", "is", MAKELCID(MAKELANGID(LANG_ICELANDIC, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Icelandic", "isl", "is", MAKELCID(MAKELANGID(LANG_ICELANDIC, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Ido", "ido", "io" }, + { "Igbo", "ibo", "ig", MAKELCID(MAKELANGID(LANG_IGBO, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Ijo", "ijo", "" }, + { "Iloko", "ilo", "" }, + { "Inari Sami", "smn", "" }, + { "Indic (Other)", "inc", "" }, + { "Indo-European (Other)", "ine", "" }, + { "Indonesian", "ind", "id", MAKELCID(MAKELANGID(LANG_INDONESIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Ingush", "inh", "" }, + { "Interlingua (International", "ina", "ia" }, + { "Interlingue", "ile", "ie" }, + { "Inuktitut", "iku", "iu", MAKELCID(MAKELANGID(LANG_INUKTITUT, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Inupiaq", "ipk", "ik" }, + { "Iranian (Other)", "ira", "" }, + { "Irish", "gle", "ga", MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Irish, Middle (900-1200)", "mga", "", MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Irish, Old (to 900)", "sga", "", MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Iroquoian languages", "iro", "" }, + { "Italian", "ita", "it", MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Japanese", "jpn", "ja", MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Javanese", "jav", "jv" }, + { "Judeo-Arabic", "jrb", "" }, + { "Judeo-Persian", "jpr", "" }, + { "Kabardian", "kbd", "" }, + { "Kabyle", "kab", "" }, + { "Kachin", "kac", "" }, + { "Kalaallisut; Greenlandic", "kal", "kl" }, + { "Kalmyk", "xal", "" }, + { "Kamba", "kam", "" }, + { "Kannada", "kan", "kn", MAKELCID(MAKELANGID(LANG_KANNADA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Kanuri", "kau", "kr" }, + { "Kara-Kalpak", "kaa", "" }, + { "Karachay-Balkar", "krc", "" }, + { "Karen", "kar", "" }, + { "Kashmiri", "kas", "ks", MAKELCID(MAKELANGID(LANG_KASHMIRI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Kashubian", "csb", "" }, + { "Kawi", "kaw", "" }, + { "Kazakh", "kaz", "kk", MAKELCID(MAKELANGID(LANG_KAZAK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Khasi", "kha", "" }, + { "Khmer", "khm", "km", MAKELCID(MAKELANGID(LANG_KHMER, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Khoisan (Other)", "khi", "" }, + { "Khotanese", "kho", "" }, + { "Kikuyu; Gikuyu", "kik", "ki" }, + { "Kimbundu", "kmb", "" }, + { "Kinyarwanda", "kin", "rw", MAKELCID(MAKELANGID(LANG_KINYARWANDA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Kirghiz", "kir", "ky" }, + { "Klingon", "tlh", "" }, + { "Komi", "kom", "kv" }, + { "Kongo", "kon", "kg" }, + { "Konkani", "kok", "", MAKELCID(MAKELANGID(LANG_KONKANI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Korean", "kor", "ko", MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Kosraean", "kos", "" }, + { "Kpelle", "kpe", "" }, + { "Kru", "kro", "" }, + { "Kuanyama; Kwanyama", "kua", "kj" }, + { "Kumyk", "kum", "" }, + { "Kurdish", "kur", "ku" }, + { "Kurukh", "kru", "" }, + { "Kutenai", "kut", "" }, + { "Kwanyama, Kuanyama", "kua", "kj" }, + { "Ladino", "lad", "" }, + { "Lahnda", "lah", "" }, + { "Lamba", "lam", "" }, + { "Lao", "lao", "lo", MAKELCID(MAKELANGID(LANG_LAO, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Latin", "lat", "la" }, + { "Latvian", "lav", "lv", MAKELCID(MAKELANGID(LANG_LATVIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Lezghian", "lez", "" }, + { "Limburgan; Limburger; Limburgish", "lim", "li" }, + { "Limburger; Limburgan; Limburgish;", "lim", "li" }, + { "Limburgish; Limburger; Limburgan", "lim", "li" }, + { "Lingala", "lin", "ln" }, + { "Lithuanian", "lit", "lt", MAKELCID(MAKELANGID(LANG_LITHUANIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Lojban", "jbo", "" }, + { "Low German; Low Saxon; German, Low; Saxon, Low", "nds", "" }, + { "Low Saxon; Low German; Saxon, Low; German, Low", "nds", "" }, + { "Lower Sorbian", "dsb", "" }, + { "Lozi", "loz", "" }, + { "Luba-Katanga", "lub", "lu" }, + { "Luba-Lulua", "lua", "" }, + { "Luiseno", "lui", "" }, + { "Lule Sami", "smj", "" }, + { "Lunda", "lun", "" }, + { "Luo (Kenya and Tanzania)", "luo", "" }, + { "Lushai", "lus", "" }, + { "Luxembourgish", "ltz", "lb", MAKELCID(MAKELANGID(LANG_LUXEMBOURGISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Macedonian", "mac", "mk", MAKELCID(MAKELANGID(LANG_MACEDONIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Macedonian", "mkd", "mk", MAKELCID(MAKELANGID(LANG_MACEDONIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Madurese", "mad", "" }, + { "Magahi", "mag", "" }, + { "Maithili", "mai", "" }, + { "Makasar", "mak", "" }, + { "Malagasy", "mlg", "mg" }, + { "Malay", "may", "ms", MAKELCID(MAKELANGID(LANG_MALAY, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Malay", "msa", "ms", MAKELCID(MAKELANGID(LANG_MALAY, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Malayalam", "mal", "ml", MAKELCID(MAKELANGID(LANG_MALAYALAM, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Maltese", "mlt", "mt", MAKELCID(MAKELANGID(LANG_MALTESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Manchu", "mnc", "" }, + { "Mandar", "mdr", "" }, + { "Mandingo", "man", "" }, + { "Manipuri", "mni", "ma", MAKELCID(MAKELANGID(LANG_MANIPURI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Manobo languages", "mno", "" }, + { "Manx", "glv", "gv" }, + { "Maori", "mao", "mi", MAKELCID(MAKELANGID(LANG_MAORI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Maori", "mri", "mi", MAKELCID(MAKELANGID(LANG_MAORI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Marathi", "mar", "mr", MAKELCID(MAKELANGID(LANG_MARATHI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Mari", "chm", "" }, + { "Marshallese", "mah", "mh" }, + { "Marwari", "mwr", "" }, + { "Masai", "mas", "" }, + { "Mayan languages", "myn", "" }, + { "Mende", "men", "" }, + { "Micmac", "mic", "" }, + { "Minangkabau", "min", "" }, + { "Miscellaneous languages", "mis", "" }, + { "Mohawk", "moh", "", MAKELCID(MAKELANGID(LANG_MOHAWK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Moksha", "mdf", "" }, + { "Moldavian", "mol", "mo" }, + { "Mon-Khmer (Other)", "mkh", "" }, + { "Mongo", "lol", "" }, + { "Mongolian", "mon", "mn", MAKELCID(MAKELANGID(LANG_MONGOLIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Montenegrin", "mne", "me" }, + { "Mossi", "mos", "" }, + { "Multiple languages", "mul", "" }, + { "Munda languages", "mun", "" }, + { "Nahuatl", "nah", "" }, + { "Nauru", "nau", "na" }, + { "Navaho, Navajo", "nav", "nv" }, + { "Navajo; Navaho", "nav", "nv" }, + { "Ndebele, North", "nde", "nd" }, + { "Ndebele, South", "nbl", "nr" }, + { "Ndonga", "ndo", "ng" }, + { "Neapolitan", "nap", "" }, + { "Nepali", "nep", "ne", MAKELCID(MAKELANGID(LANG_NEPALI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Newari", "new", "" }, + { "Nias", "nia", "" }, + { "Niger-Kordofanian (Other)", "nic", "" }, + { "Nilo-Saharan (Other)", "ssa", "" }, + { "Niuean", "niu", "" }, + { "Nogai", "nog", "" }, + { "Norse, Old", "non", "" }, + { "North American Indian (Other)", "nai", "" }, + { "North Ndebele", "nde", "nd" }, + { "Northern Sami", "sme", "se" }, + { "Norwegian Bokmål; Bokmål, Norwegian", "nob", "nb", MAKELCID(MAKELANGID(LANG_NORWEGIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Norwegian Nynorsk; Nynorsk, Norwegian", "nno", "nn", MAKELCID(MAKELANGID(LANG_NORWEGIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Norwegian", "nor", "no", MAKELCID(MAKELANGID(LANG_NORWEGIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Nubian languages", "nub", "" }, + { "Nyamwezi", "nym", "" }, + { "Nyanja; Chichewa; Chewa", "nya", "ny" }, + { "Nyankole", "nyn", "" }, + { "Nynorsk, Norwegian; Norwegian Nynorsk", "nno", "nn" }, + { "Nyoro", "nyo", "" }, + { "Nzima", "nzi", "" }, + { "Occitan (post 1500},; Provençal", "oci", "oc", MAKELCID(MAKELANGID(LANG_OCCITAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Ojibwa", "oji", "oj" }, + { "Old Bulgarian; Old Slavonic; Church Slavonic;", "chu", "cu" }, + { "Old Church Slavonic; Old Slavonic; ", "chu", "cu" }, + { "Old Slavonic; Church Slavonic; Old Bulgarian;", "chu", "cu" }, + { "Oriya", "ori", "or" }, + { "Oromo", "orm", "om" }, + { "Osage", "osa", "" }, + { "Ossetian; Ossetic", "oss", "os" }, + { "Ossetic; Ossetian", "oss", "os" }, + { "Otomian languages", "oto", "" }, + { "Pahlavi", "pal", "" }, + { "Palauan", "pau", "" }, + { "Pali", "pli", "pi" }, + { "Pampanga", "pam", "" }, + { "Pangasinan", "pag", "" }, + { "Panjabi", "pan", "pa" }, + { "Papiamento", "pap", "" }, + { "Papuan (Other)", "paa", "" }, + { "Persian", "per", "fa", MAKELCID(MAKELANGID(LANG_PERSIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Persian", "fas", "fa", MAKELCID(MAKELANGID(LANG_PERSIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Persian, Old (ca.600-400 B.C.)", "peo", "" }, + { "Philippine (Other)", "phi", "" }, + { "Phoenician", "phn", "" }, + { "Pohnpeian", "pon", "" }, + { "Polish", "pol", "pl", MAKELCID(MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Portuguese", "por", "pt", MAKELCID(MAKELANGID(LANG_PORTUGUESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Prakrit languages", "pra", "" }, + { "Provençal, Old (to 1500)", "pro", "" }, + { "Provençal; Occitan (post 1500)", "oci", "oc" }, + { "Pushto", "pus", "ps" }, + { "Quechua", "que", "qu", MAKELCID(MAKELANGID(LANG_QUECHUA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Raeto-Romance", "roh", "rm" }, + { "Rajasthani", "raj", "" }, + { "Rapanui", "rap", "" }, + { "Rarotongan", "rar", "" }, + { "Reserved for local use", "qaa-qtz", "" }, + { "Romance (Other)", "roa", "" }, + { "Romanian", "rum", "ro", MAKELCID(MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Romanian", "ron", "ro", MAKELCID(MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Romany", "rom", "" }, + { "Rundi", "run", "rn" }, + { "Russian", "rus", "ru", MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Salishan languages", "sal", "" }, + { "Samaritan Aramaic", "sam", "" }, + { "Sami languages (Other)", "smi", "" }, + { "Samoan", "smo", "sm" }, + { "Sandawe", "sad", "" }, + { "Sango", "sag", "sg" }, + { "Sanskrit", "san", "sa", MAKELCID(MAKELANGID(LANG_SANSKRIT, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Santali", "sat", "" }, + { "Sardinian", "srd", "sc" }, + { "Sasak", "sas", "" }, + { "Saxon, Low; German, Low; Low Saxon; Low German", "nds", "" }, + { "Scots", "sco", "" }, + { "Scottish Gaelic; Gaelic", "gla", "gd" }, + { "Selkup", "sel", "" }, + { "Semitic (Other)", "sem", "" }, + { "Serbian", "scc", "sr", MAKELCID(LANG_SERBIAN_NEUTRAL, SORT_DEFAULT) }, + { "Serbian", "srp", "sr", MAKELCID(LANG_SERBIAN_NEUTRAL, SORT_DEFAULT) }, + { "Serer", "srr", "" }, + { "Shan", "shn", "" }, + { "Shona", "sna", "sn" }, + { "Sichuan Yi", "iii", "ii" }, + { "Sidamo", "sid", "" }, + { "Sign languages", "sgn", "" }, + { "Siksika", "bla", "" }, + { "Sindhi", "snd", "sd", MAKELCID(MAKELANGID(LANG_SINDHI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Sinhalese", "sin", "si", MAKELCID(MAKELANGID(LANG_SINHALESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Sino-Tibetan (Other)", "sit", "" }, + { "Siouan languages", "sio", "" }, + { "Skolt Sami", "sms", "" }, + { "Slave (Athapascan)", "den", "" }, + { "Slavic (Other)", "sla", "" }, + { "Slovak", "slo", "sk", MAKELCID(MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Slovak", "slk", "sk", MAKELCID(MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Slovenian", "slv", "sl", MAKELCID(MAKELANGID(LANG_SLOVENIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Sogdian", "sog", "" }, + { "Somali", "som", "so" }, + { "Songhai", "son", "" }, + { "Soninke", "snk", "" }, + { "Sorbian languages", "wen", "" }, + { "Sotho, Northern", "nso", "", MAKELCID(MAKELANGID(LANG_SOTHO, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Sotho, Southern", "sot", "st", MAKELCID(MAKELANGID(LANG_SOTHO, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "South American Indian (Other)", "sai", "" }, + { "South Ndebele", "nbl", "nr" }, + { "Southern Sami", "sma", "" }, + { "Spanish; Castilian", "spa", "es", MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Sukuma", "suk", "" }, + { "Sumerian", "sux", "" }, + { "Sundanese", "sun", "su" }, + { "Susu", "sus", "" }, + { "Swahili", "swa", "sw", MAKELCID(MAKELANGID(LANG_SWAHILI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Swati", "ssw", "ss" }, + { "Swedish", "swe", "sv", MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Syriac", "syr", "sy", MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tagalog", "tgl", "tl" }, + { "Tahitian", "tah", "ty" }, + { "Tai (Other)", "tai", "" }, + { "Tajik", "tgk", "tg", MAKELCID(MAKELANGID(LANG_TAJIK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tamashek", "tmh", "" }, + { "Tamil", "tam", "ta", MAKELCID(MAKELANGID(LANG_TAMIL, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tatar", "tat", "tt", MAKELCID(MAKELANGID(LANG_TATAR, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Telugu", "tel", "te", MAKELCID(MAKELANGID(LANG_TELUGU, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tereno", "ter", "" }, + { "Tetum", "tet", "" }, + { "Thai", "tha", "th", MAKELCID(MAKELANGID(LANG_THAI, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tibetan", "tib", "bo", MAKELCID(MAKELANGID(LANG_TIBETAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tibetan", "bod", "bo", MAKELCID(MAKELANGID(LANG_TIBETAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tigre", "tig", "" }, + { "Tigrinya", "tir", "ti", MAKELCID(MAKELANGID(LANG_TIGRIGNA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Timne", "tem", "" }, + { "Tiv", "tiv", "" }, + { "Tlingit", "tli", "" }, + { "Tok Pisin", "tpi", "" }, + { "Tokelau", "tkl", "" }, + { "Tonga (Nyasa)", "tog", "" }, + { "Tonga (Tonga Islands)", "ton", "to" }, + { "Tsimshian", "tsi", "" }, + { "Tsonga", "tso", "ts" }, + { "Tswana", "tsn", "tn", MAKELCID(MAKELANGID(LANG_TSWANA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tumbuka", "tum", "" }, + { "Tupi languages", "tup", "" }, + { "Turkish", "tur", "tr", MAKELCID(MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Turkish, Ottoman (1500-1928)", "ota", "", MAKELCID(MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Turkmen", "tuk", "tk", MAKELCID(MAKELANGID(LANG_TURKMEN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Tuvalu", "tvl", "" }, + { "Tuvinian", "tyv", "" }, + { "Twi", "twi", "tw" }, + { "Udmurt", "udm", "" }, + { "Ugaritic", "uga", "" }, + { "Uighur", "uig", "ug", MAKELCID(MAKELANGID(LANG_UIGHUR, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Ukrainian", "ukr", "uk", MAKELCID(MAKELANGID(LANG_UKRAINIAN, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Umbundu", "umb", "" }, + { "Undetermined", "und", "" }, + { "Upper Sorbian", "hsb", "" }, + { "Urdu", "urd", "ur", MAKELCID(MAKELANGID(LANG_URDU, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Uzbek", "uzb", "uz", MAKELCID(MAKELANGID(LANG_UZBEK, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Vai", "vai", "" }, + { "Venda", "ven", "ve" }, + { "Vietnamese", "vie", "vi", MAKELCID(MAKELANGID(LANG_VIETNAMESE, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Volapuk", "vol", "vo" }, + { "Votic", "vot", "" }, + { "Wakashan languages", "wak", "" }, + { "Walamo", "wal", "" }, + { "Walloon", "wln", "wa" }, + { "Waray", "war", "" }, + { "Washo", "was", "" }, + { "Welsh", "wel", "cy", MAKELCID(MAKELANGID(LANG_WELSH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Welsh", "cym", "cy", MAKELCID(MAKELANGID(LANG_WELSH, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Wolof", "wol", "wo", MAKELCID(MAKELANGID(LANG_WOLOF, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Xhosa", "xho", "xh", MAKELCID(MAKELANGID(LANG_XHOSA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Yakut", "sah", "", MAKELCID(MAKELANGID(LANG_YAKUT, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Yao", "yao", "" }, + { "Yapese", "yap", "" }, + { "Yiddish", "yid", "yi" }, + { "Yoruba", "yor", "yo", MAKELCID(MAKELANGID(LANG_YORUBA, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Yupik languages", "ypk", "" }, + { "Zande", "znd", "" }, + { "Zapotec", "zap", "" }, + { "Zenaga", "zen", "" }, + { "Zhuang; Chuang", "zha", "za" }, + { "Zulu", "zul", "zu", MAKELCID(MAKELANGID(LANG_ZULU, SUBLANG_DEFAULT), SORT_DEFAULT) }, + { "Zuni", "zun", "" }, + { "", "", "" }, + { "No subtitles", "---", "", (LCID)LCID_NOSUBTITLES }, + }; +}; + +CString ISOLang::ISO6391ToLanguage(LPCSTR code) +{ + CHAR tmp[2 + 1]; + strncpy_s(tmp, code, 2); + tmp[2] = 0; + _strlwr_s(tmp); + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + if (!strcmp(s_isolangs[i].iso6391, tmp)) { + CString ret = CString(CStringA(s_isolangs[i].name)); + int k = ret.Find(';'); + if (k > 0) { + ret = ret.Left(k); + } + return ret; + } + } + return _T(""); +} + +CString ISOLang::ISO6392ToLanguage(LPCSTR code) +{ + CHAR tmp[3 + 1]; + strncpy_s(tmp, code, 3); + tmp[3] = 0; + _strlwr_s(tmp); + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + if (!strcmp(s_isolangs[i].iso6392, tmp)) { + CString ret = CString(CStringA(s_isolangs[i].name)); + int k = ret.Find(';'); + if (k > 0) { + ret = ret.Left(k); + } + return ret; + } + } + return CString(code); +} + +bool ISOLang::IsISO639Language(LPCSTR code) +{ + size_t nLen = strlen(code) + 1; + LPSTR tmp = DEBUG_NEW CHAR[nLen]; + strncpy_s(tmp, nLen, code, nLen); + _strlwr_s(tmp, nLen); + tmp[0] = (CHAR)toupper(tmp[0]); + + bool bFound = false; + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + if (!strcmp(s_isolangs[i].name, tmp)) { + bFound = true; + break; + } + } + + delete[] tmp; + + return bFound; +} + +CString ISOLang::ISO639XToLanguage(LPCSTR code, bool bCheckForFullLangName /*= false*/) +{ + CString lang; + + switch (size_t nLen = strlen(code)) { + case 2: + lang = ISO6391ToLanguage(code); + break; + case 3: + lang = ISO6392ToLanguage(code); + if (lang == code) { // When it can't find a match, ISO6392ToLanguage returns the input string + lang.Empty(); + } + break; + default: + if (bCheckForFullLangName && nLen > 3) { + if (IsISO639Language(code)) { + lang = code; + } + } + } + + return lang; +} + +LCID ISOLang::ISO6391ToLcid(LPCSTR code) +{ + CHAR tmp[3 + 1]; + strncpy_s(tmp, code, 3); + tmp[3] = 0; + _strlwr_s(tmp); + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + if (!strcmp(s_isolangs[i].iso6391, code)) { + return s_isolangs[i].lcid; + } + } + return 0; +} + +LCID ISOLang::ISO6392ToLcid(LPCSTR code) +{ + CHAR tmp[3 + 1]; + strncpy_s(tmp, code, 3); + tmp[3] = 0; + _strlwr_s(tmp); + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + if (!strcmp(s_isolangs[i].iso6392, tmp)) { + return s_isolangs[i].lcid; + } + } + return 0; +} + +CStringA ISOLang::ISO6391To6392(LPCSTR code) +{ + CHAR tmp[2 + 1]; + strncpy_s(tmp, code, 2); + tmp[2] = 0; + _strlwr_s(tmp); + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + if (!strcmp(s_isolangs[i].iso6391, tmp)) { + return CStringA(s_isolangs[i].iso6392); + } + } + return ""; +} + +CString ISOLang::ISO6392To6391(LPCSTR code) +{ + CHAR tmp[3 + 1]; + strncpy_s(tmp, code, 3); + tmp[3] = 0; + _strlwr_s(tmp); + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + if (!strcmp(s_isolangs[i].iso6392, tmp)) { + return CString(s_isolangs[i].iso6391); + } + } + return _T(""); +} + +CString ISOLang::LanguageToISO6392(LPCTSTR lang) +{ + CString str = lang; + str.MakeLower(); + for (size_t i = 0, cnt = _countof(s_isolangs); i < cnt; i++) { + CAtlList<CString> sl; + Explode(CString(s_isolangs[i].name), sl, ';'); + POSITION pos = sl.GetHeadPosition(); + while (pos) { + if (!str.CompareNoCase(sl.GetNext(pos))) { + return CString(s_isolangs[i].iso6392); + } + } + } + return _T(""); +} diff --git a/src/DSUtil/ISOLang.h b/src/DSUtil/ISOLang.h new file mode 100644 index 000000000..df149afff --- /dev/null +++ b/src/DSUtil/ISOLang.h @@ -0,0 +1,38 @@ +/* + * (C) 2016 see Authors.txt + * + * This file is part of MPC-HC. + * + * MPC-HC is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * MPC-HC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#pragma once + +#include <afxstr.h> + +struct ISOLang { + LPCSTR name = nullptr, iso6392 = nullptr, iso6391 = nullptr; + LCID lcid = 0; + + static CString ISO6391ToLanguage(LPCSTR code); + static CString ISO6392ToLanguage(LPCSTR code); + static bool IsISO639Language(LPCSTR code); + static CString ISO639XToLanguage(LPCSTR code, bool bCheckForFullLangName = false); + static LCID ISO6391ToLcid(LPCSTR code); + static LCID ISO6392ToLcid(LPCSTR code); + static CStringA ISO6391To6392(LPCSTR code); + static CString ISO6392To6391(LPCSTR code); + static CString LanguageToISO6392(LPCTSTR lang); +}; diff --git a/src/DeCSS/VobFile.cpp b/src/DeCSS/VobFile.cpp index 8a8ef473e..98b23dd97 100644 --- a/src/DeCSS/VobFile.cpp +++ b/src/DeCSS/VobFile.cpp @@ -8,6 +8,7 @@ #include "../DSUtil/GolombBuffer.h"
#include "../DSUtil/DSUtil.h"
+#include "../DSUtil/ISOLang.h"
#define AUDIO_BLOCK_SIZE 66
#define SUBTITLE_BLOCK_SIZE 194
@@ -517,7 +518,7 @@ bool CVobFile::Open(CString fn, CAtlList<CString>& vobs, ULONG nProgNum /*= 1*/, gb.ReadBuffer((BYTE*)lang, 2);
gb.ReadDword();// skip
if (ToAdd) {
- m_pStream_Lang[ToAdd + i] = ISO6391ToLanguage(lang);
+ m_pStream_Lang[ToAdd + i] = ISOLang::ISO6391ToLanguage(lang);
}
}
@@ -531,7 +532,7 @@ bool CVobFile::Open(CString fn, CAtlList<CString>& vobs, ULONG nProgNum /*= 1*/, char lang[2];
gb_s.ReadBuffer((BYTE*)lang, 2);
gb_s.ReadShort();
- m_pStream_Lang[0x20 + i] = ISO6391ToLanguage(lang);
+ m_pStream_Lang[0x20 + i] = ISOLang::ISO6391ToLanguage(lang);
}
// Chapters ...
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp index 89f0ed5c6..ead1d5f32 100644 --- a/src/Subtitles/RTS.cpp +++ b/src/Subtitles/RTS.cpp @@ -26,6 +26,7 @@ #include "ColorConvTable.h"
#include "RTS.h"
#include "../DSUtil/PathUtils.h"
+#include "../DSUtil/ISOLang.h"
// WARNING: this isn't very thread safe, use only one RTS a time. We should use TLS in future.
static HDC g_hDC;
@@ -3219,9 +3220,9 @@ STDMETHODIMP CRenderedTextSubtitle::GetStreamInfo(int iStream, WCHAR** ppName, L }
if (pLCID) {
- *pLCID = ISO6391ToLcid(CW2A(m_name));
+ *pLCID = ISOLang::ISO6391ToLcid(CW2A(m_name));
if (*pLCID == 0) {
- *pLCID = ISO6392ToLcid(CW2A(m_name));
+ *pLCID = ISOLang::ISO6392ToLcid(CW2A(m_name));
}
}
diff --git a/src/Subtitles/SubtitleHelpers.cpp b/src/Subtitles/SubtitleHelpers.cpp index f13ec3fda..45fd23fa2 100644 --- a/src/Subtitles/SubtitleHelpers.cpp +++ b/src/Subtitles/SubtitleHelpers.cpp @@ -25,6 +25,7 @@ #include "../DSUtil/ArrayUtils.h" #include "../DSUtil/Constexpr.h" #include "../DSUtil/PathUtils.h" +#include "../DSUtil/ISOLang.h" #include <regex> namespace @@ -211,14 +212,14 @@ CString Subtitle::GuessSubtitleName(const CString& fn, CString videoName, LCID& if (std::regex_search((LPCTSTR)subName, mc, re)) { ASSERT(mc.size() == 3); ASSERT(mc[1].matched); - lang = ISO639XToLanguage(CStringA(mc[1].str().c_str()), true); + lang = ISOLang::ISO639XToLanguage(CStringA(mc[1].str().c_str()), true); if (!lang.IsEmpty()) { size_t len = mc[1].str().size(); if (len == 3) { - lcid = ISO6392ToLcid(CStringA(mc[1].str().c_str())); + lcid = ISOLang::ISO6392ToLcid(CStringA(mc[1].str().c_str())); } else if (len == 2) { - lcid = ISO6391ToLcid(CStringA(mc[1].str().c_str())); + lcid = ISOLang::ISO6391ToLcid(CStringA(mc[1].str().c_str())); } if (mc[2].matched) { if (CString(mc[2].str().c_str()).CompareNoCase(_T("hi")) == 0) { @@ -237,13 +238,13 @@ CString Subtitle::GuessSubtitleName(const CString& fn, CString videoName, LCID& if (std::regex_search((LPCTSTR)subName, mc, re)) { ASSERT(mc.size() == 3); ASSERT(mc[1].matched); - lang = ISO639XToLanguage(CStringA(mc[1].str().c_str()), true); + lang = ISOLang::ISO639XToLanguage(CStringA(mc[1].str().c_str()), true); if (!lang.IsEmpty()) { size_t len = mc[1].str().size(); if (len == 3) { - lcid = ISO6392ToLcid(CStringA(mc[1].str().c_str())); + lcid = ISOLang::ISO6392ToLcid(CStringA(mc[1].str().c_str())); } else if (len == 2) { - lcid = ISO6391ToLcid(CStringA(mc[1].str().c_str())); + lcid = ISOLang::ISO6391ToLcid(CStringA(mc[1].str().c_str())); } } @@ -255,13 +256,13 @@ CString Subtitle::GuessSubtitleName(const CString& fn, CString videoName, LCID& if (!lang.IsEmpty() && str.CompareNoCase("hi") == 0) { hi = HI_YES; } else { - lang = ISO639XToLanguage(str, true); + lang = ISOLang::ISO639XToLanguage(str, true); if (!lang.IsEmpty()) { size_t len = str.GetLength(); if (len == 3) { - lcid = ISO6392ToLcid(str.GetString()); + lcid = ISOLang::ISO6392ToLcid(str.GetString()); } else if (len == 2) { - lcid = ISO6391ToLcid(str.GetString()); + lcid = ISOLang::ISO6391ToLcid(str.GetString()); } } } diff --git a/src/Subtitles/SubtitleInputPin.cpp b/src/Subtitles/SubtitleInputPin.cpp index c5b468b70..6ce9ef7d3 100644 --- a/src/Subtitles/SubtitleInputPin.cpp +++ b/src/Subtitles/SubtitleInputPin.cpp @@ -29,6 +29,7 @@ #include <InitGuid.h>
#include <uuids.h>
#include "moreuuids.h"
+#include "../DSUtil/ISOLang.h"
// our first format id
#define __GAB1__ "GAB1"
@@ -103,8 +104,8 @@ HRESULT CSubtitleInputPin::CompleteConnect(IPin* pReceivePin) if (psi != nullptr) {
dwOffset = psi->dwOffset;
- name = ISO6392ToLanguage(psi->IsoLang);
- lcid = ISO6392ToLcid(psi->IsoLang);
+ name = ISOLang::ISO6392ToLanguage(psi->IsoLang);
+ lcid = ISOLang::ISO6392ToLcid(psi->IsoLang);
CString trackName(psi->TrackName);
trackName.Trim();
diff --git a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp index e4408028c..b464e29e4 100644 --- a/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp +++ b/src/filters/muxer/BaseMuxer/BaseMuxerOutputPin.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2013, 2015 see Authors.txt
+ * (C) 2006-2013, 2015-2016 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -29,6 +29,7 @@ #include <InitGuid.h>
#include "moreuuids.h"
+#include "../DSUtil/ISOLang.h"
//
// CBaseMuxerOutputPin
@@ -459,7 +460,7 @@ void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt) fwrite(mt.Format() + si->dwOffset, mt.FormatLength() - si->dwOffset, 1, f);
- CString iso6391 = ISO6392To6391(si->IsoLang);
+ CString iso6391 = ISOLang::ISO6392To6391(si->IsoLang);
if (iso6391.IsEmpty()) {
iso6391 = _T("--");
}
diff --git a/src/filters/parser/DSMSplitter/DSMSplitter.cpp b/src/filters/parser/DSMSplitter/DSMSplitter.cpp index 8bf7f9363..464ecf0a3 100644 --- a/src/filters/parser/DSMSplitter/DSMSplitter.cpp +++ b/src/filters/parser/DSMSplitter/DSMSplitter.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2013 see Authors.txt
+ * (C) 2006-2013, 2016 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -22,6 +22,7 @@ #include "stdafx.h"
#include "DSMSplitter.h"
#include "../../../DSUtil/DSUtil.h"
+#include "../../../DSUtil/ISOLang.h"
#ifdef STANDALONE_FILTER
#include <InitGuid.h>
@@ -170,7 +171,7 @@ HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader) if (key == "NAME") {
name = value;
}
- if (key == "LANG") if ((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) {
+ if (key == "LANG") if ((lang = ISOLang::ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) {
lang = value;
}
}
diff --git a/src/mpc-hc/DVBChannel.cpp b/src/mpc-hc/DVBChannel.cpp index e4a0b7e41..109cea652 100644 --- a/src/mpc-hc/DVBChannel.cpp +++ b/src/mpc-hc/DVBChannel.cpp @@ -1,5 +1,5 @@ /*
- * (C) 2009-2015 see Authors.txt
+ * (C) 2009-2016 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -21,8 +21,14 @@ #include "stdafx.h"
#include "DVBChannel.h"
+#include "ISOLang.h"
+LCID DVBStreamInfo::GetLCID() const
+{
+ return ISOLang::ISO6392ToLcid(CStringA(sLanguage));
+};
+
CDVBChannel::CDVBChannel(CString strChannel)
{
FromString(strChannel);
diff --git a/src/mpc-hc/DVBChannel.h b/src/mpc-hc/DVBChannel.h index d24a3c749..be91bb53e 100644 --- a/src/mpc-hc/DVBChannel.h +++ b/src/mpc-hc/DVBChannel.h @@ -94,7 +94,7 @@ struct DVBStreamInfo { PES_STREAM_TYPE nPesType = INVALID;
CString sLanguage;
- LCID GetLCID() { return ISO6392ToLcid(CStringA(sLanguage)); };
+ LCID GetLCID() const;
};
class CDVBChannel
diff --git a/src/mpc-hc/FGManagerBDA.cpp b/src/mpc-hc/FGManagerBDA.cpp index da97f4a71..4c6935e33 100644 --- a/src/mpc-hc/FGManagerBDA.cpp +++ b/src/mpc-hc/FGManagerBDA.cpp @@ -1,5 +1,5 @@ /*
- * (C) 2009-2015 see Authors.txt
+ * (C) 2009-2016 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -32,6 +32,7 @@ #include "GolombBuffer.h"
#include "../filters/switcher/AudioSwitcher/AudioSwitcher.h"
#include "moreuuids.h"
+#include "ISOLang.h"
#include "mplayerc.h"
#include "FGManagerBDA.h"
#include "DVBChannel.h"
@@ -921,7 +922,7 @@ STDMETHODIMP CFGManagerBDA::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFl if (!pStreamInfo->sLanguage.IsEmpty() && pStreamInfo->GetLCID() == 0) {
// Try to convert language code even if LCID was not found.
- str += _T(" [") + ISO6392ToLanguage(CStringA(pStreamInfo->sLanguage)) + _T("]");
+ str += _T(" [") + ISOLang::ISO6392ToLanguage(CStringA(pStreamInfo->sLanguage)) + _T("]");
}
*ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength() + 1) * sizeof(WCHAR));
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp index 504238103..2efa5d845 100644 --- a/src/mpc-hc/MainFrm.cpp +++ b/src/mpc-hc/MainFrm.cpp @@ -74,6 +74,7 @@ #include "DSUtil.h"
#include "text.h"
+#include "ISOLang.h"
#include "FGManager.h"
#include "FGManagerBDA.h"
@@ -10598,7 +10599,7 @@ void CMainFrame::SetupChapters() CHAR iso6391[3];
::GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, iso6391, 3);
- CStringA iso6392 = ISO6391To6392(iso6391);
+ CStringA iso6392 = ISOLang::ISO6391To6392(iso6391);
if (iso6392.GetLength() < 3) {
iso6392 = "eng";
}
@@ -11477,7 +11478,7 @@ int CMainFrame::SetupAudioStreams() lang.MakeLower();
langs.Add(lang);
// Try to match the full language if possible
- lang = ISO639XToLanguage(CStringA(lang)).MakeLower();
+ lang = ISOLang::ISO639XToLanguage(CStringA(lang)).MakeLower();
if (!lang.IsEmpty()) {
langs.Add(lang);
}
@@ -11590,7 +11591,7 @@ int CMainFrame::SetupSubtitleStreams() lang.MakeLower();
langs.Add(lang);
// Try to match the full language if possible
- lang = ISO639XToLanguage(CStringA(lang)).MakeLower();
+ lang = ISOLang::ISO639XToLanguage(CStringA(lang)).MakeLower();
if (!lang.IsEmpty()) {
langs.Add(lang);
}
@@ -16820,7 +16821,7 @@ LRESULT CMainFrame::OnLoadSubtitles(WPARAM wParam, LPARAM lParam) if (pRTS && pRTS->Open(CString(data.pSubtitlesInfo->Provider()->Name().c_str()),
(BYTE*)(LPCSTR)data.fileContents.c_str(), (int)data.fileContents.length(), DEFAULT_CHARSET,
UTF8To16(data.fileName.c_str()), Subtitle::HearingImpairedType(data.pSubtitlesInfo->hearingImpaired),
- ISO6391ToLcid(data.pSubtitlesInfo->languageCode.c_str())) && pRTS->GetStreamCount() > 0) {
+ ISOLang::ISO6391ToLcid(data.pSubtitlesInfo->languageCode.c_str())) && pRTS->GetStreamCount() > 0) {
m_wndSubtitlesDownloadDialog.DoDownloaded(*data.pSubtitlesInfo);
SubtitleInput subElement = pRTS.Detach();
diff --git a/src/mpc-hc/SubtitleDlDlg.cpp b/src/mpc-hc/SubtitleDlDlg.cpp index 843dae896..839ed0e81 100644 --- a/src/mpc-hc/SubtitleDlDlg.cpp +++ b/src/mpc-hc/SubtitleDlDlg.cpp @@ -24,6 +24,7 @@ #include "SubtitlesProvider.h"
#include "mplayerc.h"
#include "MainFrm.h"
+#include "ISOLang.h"
// User Defined Window Messages
enum {
@@ -542,7 +543,7 @@ afx_msg LRESULT CSubtitleDlDlg::OnCompleted(WPARAM wParam, LPARAM lParam) for (const auto& subInfo : _subtitlesList) {
int iItem = m_list.InsertItem(0, UTF8To16(subInfo.Provider()->Name().c_str()), subInfo.Provider()->GetIconIndex());
m_list.SetItemText(iItem, COL_FILENAME, UTF8To16(subInfo.fileName.c_str()));
- m_list.SetItemText(iItem, COL_LANGUAGE, ISO639XToLanguage(subInfo.languageCode.c_str()));
+ m_list.SetItemText(iItem, COL_LANGUAGE, ISOLang::ISO639XToLanguage(subInfo.languageCode.c_str()));
CString disc;
disc.Format(_T("%d/%d"), subInfo.discNumber, subInfo.discCount);
m_list.SetItemText(iItem, COL_DISC, disc);
diff --git a/src/mpc-hc/SubtitlesProvider.cpp b/src/mpc-hc/SubtitlesProvider.cpp index 592b1cb8d..afed335e1 100644 --- a/src/mpc-hc/SubtitlesProvider.cpp +++ b/src/mpc-hc/SubtitlesProvider.cpp @@ -22,6 +22,7 @@ #include "SubtitlesProvider.h" #include "SubtitlesProvidersUtils.h" #include "mplayerc.h" +#include "ISOLang.h" #include "MediaInfo/library/Source/ThirdParty/base64/base64.h" #include "tinyxml2/library/tinyxml2.h" #include "rapidjson/include/rapidjson/document.h" @@ -344,8 +345,8 @@ const std::set<std::string>& OpenSubtitles::Languages() const std::string ISO6391 = data[i]["ISO639"]; ASSERT(!ISO6391.empty()); ASSERT(!subLanguageID.empty()); - ASSERT(ISO6391To6392(ISO6391.c_str()) == subLanguageID.c_str()); - ASSERT(ISO6392To6391(subLanguageID.c_str()) == ISO6391.c_str()); + ASSERT(ISOLang::ISO6391To6392(ISO6391.c_str()) == subLanguageID.c_str()); + ASSERT(ISOLang::ISO6392To6391(subLanguageID.c_str()) == ISO6391.c_str()); //std::string languageName = data[i]["LanguageName"]; //ASSERT(ISO639XToLanguage(ISO6391.c_str()) == languageName.c_str()); //ASSERT(ISO639XToLanguage(subLanguageID.c_str()) == languageName.c_str()); @@ -420,7 +421,7 @@ SRESULT SubDB::Search(const SubtitlesInfo& pFileInfo) pSubtitlesInfo.fileExtension = "srt"; pSubtitlesInfo.fileName = pFileInfo.fileName + GUESSED_NAME_POSTFIX; pSubtitlesInfo.languageCode = iter; - pSubtitlesInfo.languageName = UTF16To8(ISO639XToLanguage(iter.c_str())); + pSubtitlesInfo.languageName = UTF16To8(ISOLang::ISO639XToLanguage(iter.c_str())); pSubtitlesInfo.discNumber = 1; pSubtitlesInfo.discCount = 1; pSubtitlesInfo.title = pFileInfo.title; @@ -766,7 +767,7 @@ SRESULT titlovi::Search(const SubtitlesInfo& pFileInfo) pSubtitlesInfo.languageCode = language.name; } } - pSubtitlesInfo.languageName = UTF16To8(ISO639XToLanguage(pSubtitlesInfo.languageCode.c_str())); + pSubtitlesInfo.languageName = UTF16To8(ISOLang::ISO639XToLanguage(pSubtitlesInfo.languageCode.c_str())); pSubtitlesInfo.releaseName = GetChildElementText(pSubtitleElmt, "release"); pSubtitlesInfo.imdbid = GetChildElementText(pSubtitleElmt, "imdbId"); pSubtitlesInfo.frameRate = atof(GetChildElementText(pSubtitleElmt, "fps").c_str()); @@ -892,7 +893,7 @@ SRESULT ysubs::Search(const SubtitlesInfo& pFileInfo) pSubtitlesInfo.title = elem->FindMember("title")->value.GetString(); pSubtitlesInfo.languageCode = lang_code; - pSubtitlesInfo.languageName = UTF16To8(ISO639XToLanguage(pSubtitlesInfo.languageCode.c_str())); + pSubtitlesInfo.languageName = UTF16To8(ISOLang::ISO639XToLanguage(pSubtitlesInfo.languageCode.c_str())); pSubtitlesInfo.releaseName = "YIFY"; pSubtitlesInfo.imdbid = imdb; pSubtitlesInfo.year = elem->FindMember("year")->value.GetInt(); diff --git a/src/mpc-hc/SubtitlesProvidersUtils.cpp b/src/mpc-hc/SubtitlesProvidersUtils.cpp index e6afd93c5..e9268fa66 100644 --- a/src/mpc-hc/SubtitlesProvidersUtils.cpp +++ b/src/mpc-hc/SubtitlesProvidersUtils.cpp @@ -22,6 +22,7 @@ #include "SubtitlesProvidersUtils.h" #include "SubtitlesProviders.h" #include "mplayerc.h" +#include "ISOLang.h" #if !USE_STATIC_UNRAR #include "unrar.h" @@ -766,7 +767,7 @@ std::list<std::string> SubtitlesProvidersUtils::LanguagesISO6391() { std::list<std::string> result; for (const auto& iter : StringTokenize(UTF16To8(AfxGetAppSettings().strSubtitlesLanguageOrder).GetString(), ",; ")) { - result.push_back(iter.length() > 2 ? CStringA(ISO6392To6391(iter.c_str())).GetString() : iter); + result.push_back(iter.length() > 2 ? CStringA(ISOLang::ISO6392To6391(iter.c_str())).GetString() : iter); } return result; } @@ -775,7 +776,7 @@ std::list<std::string> SubtitlesProvidersUtils::LanguagesISO6392() { std::list<std::string> result; for (const auto& iter : StringTokenize(UTF16To8(AfxGetAppSettings().strSubtitlesLanguageOrder).GetString(), ",; ")) { - result.push_back(iter.length() < 3 ? ISO6391To6392(iter.c_str()).GetString() : iter); + result.push_back(iter.length() < 3 ? ISOLang::ISO6391To6392(iter.c_str()).GetString() : iter); } return result; } |