diff --git a/PInvoke/Shared/WinNT/LANGID.cs b/PInvoke/Shared/WinNT/LANGID.cs new file mode 100644 index 00000000..ddd6a077 --- /dev/null +++ b/PInvoke/Shared/WinNT/LANGID.cs @@ -0,0 +1,1067 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.InteropServices; + +namespace Vanara.PInvoke +{ + /// + /// Managed instance of the 16 bit LANGID type. + /// + /// A language identifier is a standard international numeric abbreviation for the language in a country or geographical region. Each + /// language has a unique language identifier (data type LANGID), a 16-bit value that consists of a primary language identifier and a + /// sublanguage identifier. + /// + /// + [StructLayout(LayoutKind.Sequential), Serializable] + [TypeConverter(typeof(LANGIDTypeConverter))] + public struct LANGID : IEquatable, IEquatable, IConvertible, IComparable + { + /// Primary language identifier. + public enum LANG : ushort + { + LANG_NEUTRAL = 0x00, + LANG_INVARIANT = 0x7f, + LANG_AFRIKAANS = 0x36, + LANG_ALBANIAN = 0x1c, + LANG_ALSATIAN = 0x84, + LANG_AMHARIC = 0x5e, + LANG_ARABIC = 0x01, + LANG_ARMENIAN = 0x2b, + LANG_ASSAMESE = 0x4d, + LANG_AZERI = 0x2c, // for Azerbaijani, LANG_AZERBAIJANI is preferred + LANG_AZERBAIJANI = 0x2c, + LANG_BANGLA = 0x45, + LANG_BASHKIR = 0x6d, + LANG_BASQUE = 0x2d, + LANG_BELARUSIAN = 0x23, + LANG_BENGALI = 0x45, // Some prefer to use LANG_BANGLA + LANG_BRETON = 0x7e, + LANG_BOSNIAN = 0x1a, // Use with SUBLANG_BOSNIAN_* Sublanguage IDs + LANG_BOSNIAN_NEUTRAL = 0x781a, // Use with the ConvertDefaultLocale function + LANG_BULGARIAN = 0x02, + LANG_CATALAN = 0x03, + LANG_CENTRAL_KURDISH = 0x92, + LANG_CHEROKEE = 0x5c, + LANG_CHINESE = 0x04, // Use with SUBLANG_CHINESE_* Sublanguage IDs + LANG_CHINESE_SIMPLIFIED = 0x04, // Use with the ConvertDefaultLocale function + LANG_CHINESE_TRADITIONAL = 0x7c04, // Use with the ConvertDefaultLocale function + LANG_CORSICAN = 0x83, + LANG_CROATIAN = 0x1a, + LANG_CZECH = 0x05, + LANG_DANISH = 0x06, + LANG_DARI = 0x8c, + LANG_DIVEHI = 0x65, + LANG_DUTCH = 0x13, + LANG_ENGLISH = 0x09, + LANG_ESTONIAN = 0x25, + LANG_FAEROESE = 0x38, + LANG_FARSI = 0x29, // Deprecated: use LANG_PERSIAN instead + LANG_FILIPINO = 0x64, + LANG_FINNISH = 0x0b, + LANG_FRENCH = 0x0c, + LANG_FRISIAN = 0x62, + LANG_FULAH = 0x67, + LANG_GALICIAN = 0x56, + LANG_GEORGIAN = 0x37, + LANG_GERMAN = 0x07, + LANG_GREEK = 0x08, + LANG_GREENLANDIC = 0x6f, + LANG_GUJARATI = 0x47, + LANG_HAUSA = 0x68, + LANG_HAWAIIAN = 0x75, + LANG_HEBREW = 0x0d, + LANG_HINDI = 0x39, + LANG_HUNGARIAN = 0x0e, + LANG_ICELANDIC = 0x0f, + LANG_IGBO = 0x70, + LANG_INDONESIAN = 0x21, + LANG_INUKTITUT = 0x5d, + LANG_IRISH = 0x3c, // Use with the SUBLANG_IRISH_IRELAND Sublanguage ID + LANG_ITALIAN = 0x10, + LANG_JAPANESE = 0x11, + LANG_KANNADA = 0x4b, + LANG_KASHMIRI = 0x60, + LANG_KAZAK = 0x3f, + LANG_KHMER = 0x53, + LANG_KICHE = 0x86, + LANG_KINYARWANDA = 0x87, + LANG_KONKANI = 0x57, + LANG_KOREAN = 0x12, + LANG_KYRGYZ = 0x40, + LANG_LAO = 0x54, + LANG_LATVIAN = 0x26, + LANG_LITHUANIAN = 0x27, + LANG_LOWER_SORBIAN = 0x2e, + LANG_LUXEMBOURGISH = 0x6e, + LANG_MACEDONIAN = 0x2f, // the Former Yugoslav Republic of Macedonia + LANG_MALAY = 0x3e, + LANG_MALAYALAM = 0x4c, + LANG_MALTESE = 0x3a, + LANG_MANIPURI = 0x58, + LANG_MAORI = 0x81, + LANG_MAPUDUNGUN = 0x7a, + LANG_MARATHI = 0x4e, + LANG_MOHAWK = 0x7c, + LANG_MONGOLIAN = 0x50, + LANG_NEPALI = 0x61, + LANG_NORWEGIAN = 0x14, + LANG_OCCITAN = 0x82, + LANG_ODIA = 0x48, + LANG_ORIYA = 0x48, // Deprecated: use LANG_ODIA, instead. + LANG_PASHTO = 0x63, + LANG_PERSIAN = 0x29, + LANG_POLISH = 0x15, + LANG_PORTUGUESE = 0x16, + LANG_PULAR = 0x67, // Deprecated: use LANG_FULAH instead + LANG_PUNJABI = 0x46, + LANG_QUECHUA = 0x6b, + LANG_ROMANIAN = 0x18, + LANG_ROMANSH = 0x17, + LANG_RUSSIAN = 0x19, + LANG_SAKHA = 0x85, + LANG_SAMI = 0x3b, + LANG_SANSKRIT = 0x4f, + LANG_SCOTTISH_GAELIC = 0x91, + LANG_SERBIAN = 0x1a, // Use with the SUBLANG_SERBIAN_* Sublanguage IDs + LANG_SERBIAN_NEUTRAL = 0x7c1a, // Use with the ConvertDefaultLocale function + LANG_SINDHI = 0x59, + LANG_SINHALESE = 0x5b, + LANG_SLOVAK = 0x1b, + LANG_SLOVENIAN = 0x24, + LANG_SOTHO = 0x6c, + LANG_SPANISH = 0x0a, + LANG_SWAHILI = 0x41, + LANG_SWEDISH = 0x1d, + LANG_SYRIAC = 0x5a, + LANG_TAJIK = 0x28, + LANG_TAMAZIGHT = 0x5f, + LANG_TAMIL = 0x49, + LANG_TATAR = 0x44, + LANG_TELUGU = 0x4a, + LANG_THAI = 0x1e, + LANG_TIBETAN = 0x51, + LANG_TIGRIGNA = 0x73, + LANG_TIGRINYA = 0x73, // Preferred spelling in locale + LANG_TSWANA = 0x32, + LANG_TURKISH = 0x1f, + LANG_TURKMEN = 0x42, + LANG_UIGHUR = 0x80, + LANG_UKRAINIAN = 0x22, + LANG_UPPER_SORBIAN = 0x2e, + LANG_URDU = 0x20, + LANG_UZBEK = 0x43, + LANG_VALENCIAN = 0x03, + LANG_VIETNAMESE = 0x2a, + LANG_WELSH = 0x52, + LANG_WOLOF = 0x88, + LANG_XHOSA = 0x34, + LANG_YAKUT = 0x85, // Deprecated: use LANG_SAKHA,instead + LANG_YI = 0x78, + LANG_YORUBA = 0x6a, + LANG_ZULU = 0x35, + } + + /// Sublanguage identifier. + public enum SUBLANG : byte + { + /// language neutral + SUBLANG_NEUTRAL = 0x00, + + /// user default + SUBLANG_DEFAULT = 0x01, + + /// system default + SUBLANG_SYS_DEFAULT = 0x02, + + /// default custom language/locale + SUBLANG_CUSTOM_DEFAULT = 0x03, + + /// custom language/locale + SUBLANG_CUSTOM_UNSPECIFIED = 0x04, + + /// Default custom MUI language/locale + SUBLANG_UI_CUSTOM_DEFAULT = 0x05, + + /// Afrikaans (South Africa) 0x0436 af-ZA + SUBLANG_AFRIKAANS_SOUTH_AFRICA = 0x01, + + /// Albanian (Albania) 0x041c sq-AL + SUBLANG_ALBANIAN_ALBANIA = 0x01, + + /// Alsatian (France) 0x0484 + SUBLANG_ALSATIAN_FRANCE = 0x01, + + /// Amharic (Ethiopia) 0x045e + SUBLANG_AMHARIC_ETHIOPIA = 0x01, + + /// Arabic (Saudi Arabia) + SUBLANG_ARABIC_SAUDI_ARABIA = 0x01, + + /// Arabic (Iraq) + SUBLANG_ARABIC_IRAQ = 0x02, + + /// Arabic (Egypt) + SUBLANG_ARABIC_EGYPT = 0x03, + + /// Arabic (Libya) + SUBLANG_ARABIC_LIBYA = 0x04, + + /// Arabic (Algeria) + SUBLANG_ARABIC_ALGERIA = 0x05, + + /// Arabic (Morocco) + SUBLANG_ARABIC_MOROCCO = 0x06, + + /// Arabic (Tunisia) + SUBLANG_ARABIC_TUNISIA = 0x07, + + /// Arabic (Oman) + SUBLANG_ARABIC_OMAN = 0x08, + + /// Arabic (Yemen) + SUBLANG_ARABIC_YEMEN = 0x09, + + /// Arabic (Syria) + SUBLANG_ARABIC_SYRIA = 0x0a, + + /// Arabic (Jordan) + SUBLANG_ARABIC_JORDAN = 0x0b, + + /// Arabic (Lebanon) + SUBLANG_ARABIC_LEBANON = 0x0c, + + /// Arabic (Kuwait) + SUBLANG_ARABIC_KUWAIT = 0x0d, + + /// Arabic (U.A.E) + SUBLANG_ARABIC_UAE = 0x0e, + + /// Arabic (Bahrain) + SUBLANG_ARABIC_BAHRAIN = 0x0f, + + /// Arabic (Qatar) + SUBLANG_ARABIC_QATAR = 0x10, + + /// Armenian (Armenia) 0x042b hy-AM + SUBLANG_ARMENIAN_ARMENIA = 0x01, + + /// Assamese (India) 0x044d + SUBLANG_ASSAMESE_INDIA = 0x01, + + /// Azeri (Latin) - for Azerbaijani, SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN preferred + SUBLANG_AZERI_LATIN = 0x01, + + /// Azeri (Cyrillic) - for Azerbaijani, SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC preferred + SUBLANG_AZERI_CYRILLIC = 0x02, + + /// Azerbaijani (Azerbaijan, Latin) + SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN = 0x01, + + /// Azerbaijani (Azerbaijan, Cyrillic) + SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC = 0x02, + + /// Bangla (India) + SUBLANG_BANGLA_INDIA = 0x01, + + /// Bangla (Bangladesh) + SUBLANG_BANGLA_BANGLADESH = 0x02, + + /// Bashkir (Russia) 0x046d ba-RU + SUBLANG_BASHKIR_RUSSIA = 0x01, + + /// Basque (Basque) 0x042d eu-ES + SUBLANG_BASQUE_BASQUE = 0x01, + + /// Belarusian (Belarus) 0x0423 be-BY + SUBLANG_BELARUSIAN_BELARUS = 0x01, + + /// Bengali (India) - Note some prefer SUBLANG_BANGLA_INDIA + SUBLANG_BENGALI_INDIA = 0x01, + + /// Bengali (Bangladesh) - Note some prefer SUBLANG_BANGLA_BANGLADESH + SUBLANG_BENGALI_BANGLADESH = 0x02, + + /// Bosnian (Bosnia and Herzegovina - Latin) 0x141a bs-BA-Latn + SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN = 0x05, + + /// Bosnian (Bosnia and Herzegovina - Cyrillic) 0x201a bs-BA-Cyrl + SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC = 0x08, + + /// Breton (France) 0x047e + SUBLANG_BRETON_FRANCE = 0x01, + + /// Bulgarian (Bulgaria) 0x0402 + SUBLANG_BULGARIAN_BULGARIA = 0x01, + + /// Catalan (Catalan) 0x0403 + SUBLANG_CATALAN_CATALAN = 0x01, + + /// Central Kurdish (Iraq) 0x0492 ku-Arab-IQ + SUBLANG_CENTRAL_KURDISH_IRAQ = 0x01, + + /// Cherokee (Cherokee) 0x045c chr-Cher-US + SUBLANG_CHEROKEE_CHEROKEE = 0x01, + + /// Chinese (Taiwan) 0x0404 zh-TW + SUBLANG_CHINESE_TRADITIONAL = 0x01, + + /// Chinese (PR China) 0x0804 zh-CN + SUBLANG_CHINESE_SIMPLIFIED = 0x02, + + /// Chinese (Hong Kong S.A.R., P.R.C.) 0x0c04 zh-HK + SUBLANG_CHINESE_HONGKONG = 0x03, + + /// Chinese (Singapore) 0x1004 zh-SG + SUBLANG_CHINESE_SINGAPORE = 0x04, + + /// Chinese (Macau S.A.R.) 0x1404 zh-MO + SUBLANG_CHINESE_MACAU = 0x05, + + /// Corsican (France) 0x0483 + SUBLANG_CORSICAN_FRANCE = 0x01, + + /// Czech (Czech Republic) 0x0405 + SUBLANG_CZECH_CZECH_REPUBLIC = 0x01, + + /// Croatian (Croatia) + SUBLANG_CROATIAN_CROATIA = 0x01, + + /// Croatian (Bosnia and Herzegovina - Latin) 0x101a hr-BA + SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN = 0x04, + + /// Danish (Denmark) 0x0406 + SUBLANG_DANISH_DENMARK = 0x01, + + /// Dari (Afghanistan) + SUBLANG_DARI_AFGHANISTAN = 0x01, + + /// Divehi (Maldives) 0x0465 div-MV + SUBLANG_DIVEHI_MALDIVES = 0x01, + + /// Dutch + SUBLANG_DUTCH = 0x01, + + /// Dutch (Belgian) + SUBLANG_DUTCH_BELGIAN = 0x02, + + /// English (USA) + SUBLANG_ENGLISH_US = 0x01, + + /// English (UK) + SUBLANG_ENGLISH_UK = 0x02, + + /// English (Australian) + SUBLANG_ENGLISH_AUS = 0x03, + + /// English (Canadian) + SUBLANG_ENGLISH_CAN = 0x04, + + /// English (New Zealand) + SUBLANG_ENGLISH_NZ = 0x05, + + /// English (Irish) + SUBLANG_ENGLISH_EIRE = 0x06, + + /// English (South Africa) + SUBLANG_ENGLISH_SOUTH_AFRICA = 0x07, + + /// English (Jamaica) + SUBLANG_ENGLISH_JAMAICA = 0x08, + + /// English (Caribbean) + SUBLANG_ENGLISH_CARIBBEAN = 0x09, + + /// English (Belize) + SUBLANG_ENGLISH_BELIZE = 0x0a, + + /// English (Trinidad) + SUBLANG_ENGLISH_TRINIDAD = 0x0b, + + /// English (Zimbabwe) + SUBLANG_ENGLISH_ZIMBABWE = 0x0c, + + /// English (Philippines) + SUBLANG_ENGLISH_PHILIPPINES = 0x0d, + + /// English (India) + SUBLANG_ENGLISH_INDIA = 0x10, + + /// English (Malaysia) + SUBLANG_ENGLISH_MALAYSIA = 0x11, + + /// English (Singapore) + SUBLANG_ENGLISH_SINGAPORE = 0x12, + + /// Estonian (Estonia) 0x0425 et-EE + SUBLANG_ESTONIAN_ESTONIA = 0x01, + + /// Faroese (Faroe Islands) 0x0438 fo-FO + SUBLANG_FAEROESE_FAROE_ISLANDS = 0x01, + + /// Filipino (Philippines) 0x0464 fil-PH + SUBLANG_FILIPINO_PHILIPPINES = 0x01, + + /// Finnish (Finland) 0x040b + SUBLANG_FINNISH_FINLAND = 0x01, + + /// French + SUBLANG_FRENCH = 0x01, + + /// French (Belgian) + SUBLANG_FRENCH_BELGIAN = 0x02, + + /// French (Canadian) + SUBLANG_FRENCH_CANADIAN = 0x03, + + /// French (Swiss) + SUBLANG_FRENCH_SWISS = 0x04, + + /// French (Luxembourg) + SUBLANG_FRENCH_LUXEMBOURG = 0x05, + + /// French (Monaco) + SUBLANG_FRENCH_MONACO = 0x06, + + /// Frisian (Netherlands) 0x0462 fy-NL + SUBLANG_FRISIAN_NETHERLANDS = 0x01, + + /// Fulah (Senegal) 0x0867 ff-Latn-SN + SUBLANG_FULAH_SENEGAL = 0x02, + + /// Galician (Galician) 0x0456 gl-ES + SUBLANG_GALICIAN_GALICIAN = 0x01, + + /// Georgian (Georgia) 0x0437 ka-GE + SUBLANG_GEORGIAN_GEORGIA = 0x01, + + /// German + SUBLANG_GERMAN = 0x01, + + /// German (Swiss) + SUBLANG_GERMAN_SWISS = 0x02, + + /// German (Austrian) + SUBLANG_GERMAN_AUSTRIAN = 0x03, + + /// German (Luxembourg) + SUBLANG_GERMAN_LUXEMBOURG = 0x04, + + /// German (Liechtenstein) + SUBLANG_GERMAN_LIECHTENSTEIN = 0x05, + + /// Greek (Greece) + SUBLANG_GREEK_GREECE = 0x01, + + /// Greenlandic (Greenland) 0x046f kl-GL + SUBLANG_GREENLANDIC_GREENLAND = 0x01, + + /// Gujarati (India (Gujarati Script)) 0x0447 gu-IN + SUBLANG_GUJARATI_INDIA = 0x01, + + /// Hausa (Latin, Nigeria) 0x0468 ha-NG-Latn + SUBLANG_HAUSA_NIGERIA_LATIN = 0x01, + + /// Hawiian (US) 0x0475 haw-US + SUBLANG_HAWAIIAN_US = 0x01, + + /// Hebrew (Israel) 0x040d + SUBLANG_HEBREW_ISRAEL = 0x01, + + /// Hindi (India) 0x0439 hi-IN + SUBLANG_HINDI_INDIA = 0x01, + + /// Hungarian (Hungary) 0x040e + SUBLANG_HUNGARIAN_HUNGARY = 0x01, + + /// Icelandic (Iceland) 0x040f + SUBLANG_ICELANDIC_ICELAND = 0x01, + + /// Igbo (Nigeria) 0x0470 ig-NG + SUBLANG_IGBO_NIGERIA = 0x01, + + /// Indonesian (Indonesia) 0x0421 id-ID + SUBLANG_INDONESIAN_INDONESIA = 0x01, + + /// Inuktitut (Syllabics) (Canada) 0x045d iu-CA-Cans + SUBLANG_INUKTITUT_CANADA = 0x01, + + /// Inuktitut (Canada - Latin) + SUBLANG_INUKTITUT_CANADA_LATIN = 0x02, + + /// Irish (Ireland) + SUBLANG_IRISH_IRELAND = 0x02, + + /// Italian + SUBLANG_ITALIAN = 0x01, + + /// Italian (Swiss) + SUBLANG_ITALIAN_SWISS = 0x02, + + /// Japanese (Japan) 0x0411 + SUBLANG_JAPANESE_JAPAN = 0x01, + + /// Kannada (India (Kannada Script)) 0x044b kn-IN + SUBLANG_KANNADA_INDIA = 0x01, + + /// Kashmiri (South Asia) + SUBLANG_KASHMIRI_SASIA = 0x02, + + /// For app compatibility only + SUBLANG_KASHMIRI_INDIA = 0x02, + + /// Kazakh (Kazakhstan) 0x043f kk-KZ + SUBLANG_KAZAK_KAZAKHSTAN = 0x01, + + /// Khmer (Cambodia) 0x0453 kh-KH + SUBLANG_KHMER_CAMBODIA = 0x01, + + /// K'iche (Guatemala) + SUBLANG_KICHE_GUATEMALA = 0x01, + + /// Kinyarwanda (Rwanda) 0x0487 rw-RW + SUBLANG_KINYARWANDA_RWANDA = 0x01, + + /// Konkani (India) 0x0457 kok-IN + SUBLANG_KONKANI_INDIA = 0x01, + + /// Korean (Extended Wansung) + SUBLANG_KOREAN = 0x01, + + /// Kyrgyz (Kyrgyzstan) 0x0440 ky-KG + SUBLANG_KYRGYZ_KYRGYZSTAN = 0x01, + + /// Lao (Lao PDR) 0x0454 lo-LA + SUBLANG_LAO_LAO = 0x01, + + /// Latvian (Latvia) 0x0426 lv-LV + SUBLANG_LATVIAN_LATVIA = 0x01, + + /// Lithuanian + SUBLANG_LITHUANIAN = 0x01, + + /// Lower Sorbian (Germany) 0x082e wee-DE + SUBLANG_LOWER_SORBIAN_GERMANY = 0x02, + + /// Luxembourgish (Luxembourg) 0x046e lb-LU + SUBLANG_LUXEMBOURGISH_LUXEMBOURG = 0x01, + + /// Macedonian (Macedonia (FYROM)) 0x042f mk-MK + SUBLANG_MACEDONIAN_MACEDONIA = 0x01, + + /// Malay (Malaysia) + SUBLANG_MALAY_MALAYSIA = 0x01, + + /// Malay (Brunei Darussalam) + SUBLANG_MALAY_BRUNEI_DARUSSALAM = 0x02, + + /// Malayalam (India (Malayalam Script) ) 0x044c ml-IN + SUBLANG_MALAYALAM_INDIA = 0x01, + + /// Maltese (Malta) 0x043a mt-MT + SUBLANG_MALTESE_MALTA = 0x01, + + /// Maori (New Zealand) 0x0481 mi-NZ + SUBLANG_MAORI_NEW_ZEALAND = 0x01, + + /// Mapudungun (Chile) 0x047a arn-CL + SUBLANG_MAPUDUNGUN_CHILE = 0x01, + + /// Marathi (India) 0x044e mr-IN + SUBLANG_MARATHI_INDIA = 0x01, + + /// Mohawk (Mohawk) 0x047c moh-CA + SUBLANG_MOHAWK_MOHAWK = 0x01, + + /// Mongolian (Cyrillic, Mongolia) + SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA = 0x01, + + /// Mongolian (PRC) + SUBLANG_MONGOLIAN_PRC = 0x02, + + /// Nepali (India) + SUBLANG_NEPALI_INDIA = 0x02, + + /// Nepali (Nepal) 0x0461 ne-NP + SUBLANG_NEPALI_NEPAL = 0x01, + + /// Norwegian (Bokmal) + SUBLANG_NORWEGIAN_BOKMAL = 0x01, + + /// Norwegian (Nynorsk) + SUBLANG_NORWEGIAN_NYNORSK = 0x02, + + /// Occitan (France) 0x0482 oc-FR + SUBLANG_OCCITAN_FRANCE = 0x01, + + /// Odia (India (Odia Script)) 0x0448 or-IN + SUBLANG_ODIA_INDIA = 0x01, + + /// Deprecated: use SUBLANG_ODIA_INDIA instead + SUBLANG_ORIYA_INDIA = 0x01, + + /// Pashto (Afghanistan) + SUBLANG_PASHTO_AFGHANISTAN = 0x01, + + /// Persian (Iran) 0x0429 fa-IR + SUBLANG_PERSIAN_IRAN = 0x01, + + /// Polish (Poland) 0x0415 + SUBLANG_POLISH_POLAND = 0x01, + + /// Portuguese + SUBLANG_PORTUGUESE = 0x02, + + /// Portuguese (Brazil) + SUBLANG_PORTUGUESE_BRAZILIAN = 0x01, + + /// Deprecated: Use SUBLANG_FULAH_SENEGAL instead + SUBLANG_PULAR_SENEGAL = 0x02, + + /// Punjabi (India (Gurmukhi Script)) 0x0446 pa-IN + SUBLANG_PUNJABI_INDIA = 0x01, + + /// Punjabi (Pakistan (Arabic Script)) 0x0846 pa-Arab-PK + SUBLANG_PUNJABI_PAKISTAN = 0x02, + + /// Quechua (Bolivia) + SUBLANG_QUECHUA_BOLIVIA = 0x01, + + /// Quechua (Ecuador) + SUBLANG_QUECHUA_ECUADOR = 0x02, + + /// Quechua (Peru) + SUBLANG_QUECHUA_PERU = 0x03, + + /// Romanian (Romania) 0x0418 + SUBLANG_ROMANIAN_ROMANIA = 0x01, + + /// Romansh (Switzerland) 0x0417 rm-CH + SUBLANG_ROMANSH_SWITZERLAND = 0x01, + + /// Russian (Russia) 0x0419 + SUBLANG_RUSSIAN_RUSSIA = 0x01, + + /// Sakha (Russia) 0x0485 sah-RU + SUBLANG_SAKHA_RUSSIA = 0x01, + + /// Northern Sami (Norway) + SUBLANG_SAMI_NORTHERN_NORWAY = 0x01, + + /// Northern Sami (Sweden) + SUBLANG_SAMI_NORTHERN_SWEDEN = 0x02, + + /// Northern Sami (Finland) + SUBLANG_SAMI_NORTHERN_FINLAND = 0x03, + + /// Lule Sami (Norway) + SUBLANG_SAMI_LULE_NORWAY = 0x04, + + /// Lule Sami (Sweden) + SUBLANG_SAMI_LULE_SWEDEN = 0x05, + + /// Southern Sami (Norway) + SUBLANG_SAMI_SOUTHERN_NORWAY = 0x06, + + /// Southern Sami (Sweden) + SUBLANG_SAMI_SOUTHERN_SWEDEN = 0x07, + + /// Skolt Sami (Finland) + SUBLANG_SAMI_SKOLT_FINLAND = 0x08, + + /// Inari Sami (Finland) + SUBLANG_SAMI_INARI_FINLAND = 0x09, + + /// Sanskrit (India) 0x044f sa-IN + SUBLANG_SANSKRIT_INDIA = 0x01, + + /// Scottish Gaelic (United Kingdom) 0x0491 gd-GB + SUBLANG_SCOTTISH_GAELIC = 0x01, + + /// Serbian (Bosnia and Herzegovina - Latin) + SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN = 0x06, + + /// Serbian (Bosnia and Herzegovina - Cyrillic) + SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC = 0x07, + + /// Serbian (Montenegro - Latn) + SUBLANG_SERBIAN_MONTENEGRO_LATIN = 0x0b, + + /// Serbian (Montenegro - Cyrillic) + SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC = 0x0c, + + /// Serbian (Serbia - Latin) + SUBLANG_SERBIAN_SERBIA_LATIN = 0x09, + + /// Serbian (Serbia - Cyrillic) + SUBLANG_SERBIAN_SERBIA_CYRILLIC = 0x0a, + + /// Croatian (Croatia) 0x041a hr-HR + SUBLANG_SERBIAN_CROATIA = 0x01, + + /// Serbian (Latin) + SUBLANG_SERBIAN_LATIN = 0x02, + + /// Serbian (Cyrillic) + SUBLANG_SERBIAN_CYRILLIC = 0x03, + + /// Sindhi (India) reserved 0x0459 + SUBLANG_SINDHI_INDIA = 0x01, + + /// Sindhi (Pakistan) 0x0859 sd-Arab-PK + SUBLANG_SINDHI_PAKISTAN = 0x02, + + /// For app compatibility only + SUBLANG_SINDHI_AFGHANISTAN = 0x02, + + /// Sinhalese (Sri Lanka) + SUBLANG_SINHALESE_SRI_LANKA = 0x01, + + /// Northern Sotho (South Africa) + SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA = 0x01, + + /// Slovak (Slovakia) 0x041b sk-SK + SUBLANG_SLOVAK_SLOVAKIA = 0x01, + + /// Slovenian (Slovenia) 0x0424 sl-SI + SUBLANG_SLOVENIAN_SLOVENIA = 0x01, + + /// Spanish (Castilian) + SUBLANG_SPANISH = 0x01, + + /// Spanish (Mexico) + SUBLANG_SPANISH_MEXICAN = 0x02, + + /// Spanish (Modern) + SUBLANG_SPANISH_MODERN = 0x03, + + /// Spanish (Guatemala) + SUBLANG_SPANISH_GUATEMALA = 0x04, + + /// Spanish (Costa Rica) + SUBLANG_SPANISH_COSTA_RICA = 0x05, + + /// Spanish (Panama) + SUBLANG_SPANISH_PANAMA = 0x06, + + /// Spanish (Dominican Republic) + SUBLANG_SPANISH_DOMINICAN_REPUBLIC = 0x07, + + /// Spanish (Venezuela) + SUBLANG_SPANISH_VENEZUELA = 0x08, + + /// Spanish (Colombia) + SUBLANG_SPANISH_COLOMBIA = 0x09, + + /// Spanish (Peru) + SUBLANG_SPANISH_PERU = 0x0a, + + /// Spanish (Argentina) + SUBLANG_SPANISH_ARGENTINA = 0x0b, + + /// Spanish (Ecuador) + SUBLANG_SPANISH_ECUADOR = 0x0c, + + /// Spanish (Chile) + SUBLANG_SPANISH_CHILE = 0x0d, + + /// Spanish (Uruguay) + SUBLANG_SPANISH_URUGUAY = 0x0e, + + /// Spanish (Paraguay) + SUBLANG_SPANISH_PARAGUAY = 0x0f, + + /// Spanish (Bolivia) + SUBLANG_SPANISH_BOLIVIA = 0x10, + + /// Spanish (El Salvador) + SUBLANG_SPANISH_EL_SALVADOR = 0x11, + + /// Spanish (Honduras) + SUBLANG_SPANISH_HONDURAS = 0x12, + + /// Spanish (Nicaragua) + SUBLANG_SPANISH_NICARAGUA = 0x13, + + /// Spanish (Puerto Rico) + SUBLANG_SPANISH_PUERTO_RICO = 0x14, + + /// Spanish (United States) + SUBLANG_SPANISH_US = 0x15, + + /// Swahili (Kenya) 0x0441 sw-KE + SUBLANG_SWAHILI_KENYA = 0x01, + + /// Swedish + SUBLANG_SWEDISH = 0x01, + + /// Swedish (Finland) + SUBLANG_SWEDISH_FINLAND = 0x02, + + /// Syriac (Syria) 0x045a syr-SY + SUBLANG_SYRIAC_SYRIA = 0x01, + + /// Tajik (Tajikistan) 0x0428 tg-TJ-Cyrl + SUBLANG_TAJIK_TAJIKISTAN = 0x01, + + /// Tamazight (Latin, Algeria) 0x085f tzm-Latn-DZ + SUBLANG_TAMAZIGHT_ALGERIA_LATIN = 0x02, + + /// Tamazight (Tifinagh) 0x105f tzm-Tfng-MA + SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH = 0x04, + + /// Tamil (India) + SUBLANG_TAMIL_INDIA = 0x01, + + /// Tamil (Sri Lanka) 0x0849 ta-LK + SUBLANG_TAMIL_SRI_LANKA = 0x02, + + /// Tatar (Russia) 0x0444 tt-RU + SUBLANG_TATAR_RUSSIA = 0x01, + + /// Telugu (India (Telugu Script)) 0x044a te-IN + SUBLANG_TELUGU_INDIA = 0x01, + + /// Thai (Thailand) 0x041e th-TH + SUBLANG_THAI_THAILAND = 0x01, + + /// Tibetan (PRC) + SUBLANG_TIBETAN_PRC = 0x01, + + /// Tigrigna (Eritrea) + SUBLANG_TIGRIGNA_ERITREA = 0x02, + + /// Tigrinya (Eritrea) 0x0873 ti-ER (preferred spelling) + SUBLANG_TIGRINYA_ERITREA = 0x02, + + /// Tigrinya (Ethiopia) 0x0473 ti-ET + SUBLANG_TIGRINYA_ETHIOPIA = 0x01, + + /// Setswana / Tswana (Botswana) 0x0832 tn-BW + SUBLANG_TSWANA_BOTSWANA = 0x02, + + /// Setswana / Tswana (South Africa) 0x0432 tn-ZA + SUBLANG_TSWANA_SOUTH_AFRICA = 0x01, + + /// Turkish (Turkey) 0x041f tr-TR + SUBLANG_TURKISH_TURKEY = 0x01, + + /// Turkmen (Turkmenistan) 0x0442 tk-TM + SUBLANG_TURKMEN_TURKMENISTAN = 0x01, + + /// Uighur (PRC) 0x0480 ug-CN + SUBLANG_UIGHUR_PRC = 0x01, + + /// Ukrainian (Ukraine) 0x0422 uk-UA + SUBLANG_UKRAINIAN_UKRAINE = 0x01, + + /// Upper Sorbian (Germany) 0x042e wen-DE + SUBLANG_UPPER_SORBIAN_GERMANY = 0x01, + + /// Urdu (Pakistan) + SUBLANG_URDU_PAKISTAN = 0x01, + + /// Urdu (India) + SUBLANG_URDU_INDIA = 0x02, + + /// Uzbek (Latin) + SUBLANG_UZBEK_LATIN = 0x01, + + /// Uzbek (Cyrillic) + SUBLANG_UZBEK_CYRILLIC = 0x02, + + /// Valencian (Valencia) 0x0803 ca-ES-Valencia + SUBLANG_VALENCIAN_VALENCIA = 0x02, + + /// Vietnamese (Vietnam) 0x042a vi-VN + SUBLANG_VIETNAMESE_VIETNAM = 0x01, + + /// Welsh (United Kingdom) 0x0452 cy-GB + SUBLANG_WELSH_UNITED_KINGDOM = 0x01, + + /// Wolof (Senegal) + SUBLANG_WOLOF_SENEGAL = 0x01, + + /// isiXhosa / Xhosa (South Africa) 0x0434 xh-ZA + SUBLANG_XHOSA_SOUTH_AFRICA = 0x01, + + /// Deprecated: use SUBLANG_SAKHA_RUSSIA instead + SUBLANG_YAKUT_RUSSIA = 0x01, + + /// Yi (PRC)) 0x0478 + SUBLANG_YI_PRC = 0x01, + + /// Yoruba (Nigeria) 046a yo-NG + SUBLANG_YORUBA_NIGERIA = 0x01, + + /// isiZulu / Zulu (South Africa) 0x0435 zu-ZA + SUBLANG_ZULU_SOUTH_AFRICA = 0x01, + } + + private ushort val; + + /// Initializes a new instance of the struct. + /// The value. + public LANGID(ushort value) => val = value; + + /// Creates a language identifier from a primary language identifier and a sublanguage identifier. See MAKELANGID. + /// + /// Primary language identifier. This identifier can be a predefined value or a value for a user-defined primary language. For a + /// user-defined language, the identifier is a value in the range 0x0200 to 0x03FF. All other values are reserved for operating + /// system use. For more information, see Language Identifier Constants and Strings. + /// + /// + /// Sublanguage identifier. This parameter can be a predefined sublanguage identifier or a user-defined sublanguage. For a + /// user-defined sublanguage, the identifier is a value in the range 0x20 to 0x3F. All other values are reserved for operating + /// system use. For more information, see Language Identifier Constants and Strings. + /// + public LANGID(ushort p, byte s) => val = (ushort)((s << 10) | p); + + /// Creates a language identifier from a primary language identifier and a sublanguage identifier. See MAKELANGID. + /// + /// Primary language identifier. This identifier can be a predefined value or a value for a user-defined primary language. For a + /// user-defined language, the identifier is a value in the range 0x0200 to 0x03FF. All other values are reserved for operating + /// system use. For more information, see Language Identifier Constants and Strings. + /// + /// + /// Sublanguage identifier. This parameter can be a predefined sublanguage identifier or a user-defined sublanguage. For a + /// user-defined sublanguage, the identifier is a value in the range 0x20 to 0x3F. All other values are reserved for operating + /// system use. For more information, see Language Identifier Constants and Strings. + /// + public LANGID(LANG p, SUBLANG s) : this((ushort)p, (byte)s) { } + + /// Initializes a new instance of the struct from an instance. See LANGIDFROMLCID. + /// The LCID value. + public LANGID(LCID lcid) => val = (ushort)(uint)lcid; + + /// Extracts a primary language identifier from a language identifier. + public LANG PRIMARYLANGID => (LANG)(val & 0x3ff); + + /// Extracts a Sublanguage identifier from a language identifier. + public SUBLANG SUBLANGID => (SUBLANG)(val >> 10); + + /// Gets the value. + /// The value. + public ushort Value { get => val; private set => val = value; } + + /// Performs an implicit conversion from to . + /// The value. + /// The result of the conversion. + public static implicit operator LANGID(ushort value) => new LANGID(value); + + /// Performs an implicit conversion from to . + /// The value. + /// The result of the conversion. + public static implicit operator LANGID(LCID value) => new LANGID(value); + + /// Performs an explicit conversion from to . + /// The value. + /// The result of the conversion. + public static explicit operator LANGID(System.Globalization.CultureInfo value) => new((ushort)value.LCID); + + /// The operating system default language. + public static LANGID LANG_SYSTEM_DEFAULT => new(LANG.LANG_NEUTRAL, SUBLANG.SUBLANG_SYS_DEFAULT); + + /// The language of the current user. + public static LANGID LANG_USER_DEFAULT => new(LANG.LANG_NEUTRAL, SUBLANG.SUBLANG_DEFAULT); + + /// Performs an implicit conversion from to . + /// The value. + /// The result of the conversion. + public static implicit operator ushort(LANGID value) => value.Value; + + /// Indicates whether two instances are not equal. + /// The first integral size to compare. + /// The second integral size to compare. + /// + /// if the value of is not equal to the value of ; otherwise, . + /// + public static bool operator !=(LANGID s1, LANGID s2) => !s1.Equals(s2); + + /// Indicates whether two instances are equal. + /// The first integral size to compare. + /// The second integral size to compare. + /// + /// if the value of is equal to the value of ; otherwise, . + /// + public static bool operator ==(LANGID s1, LANGID s2) => s1.Equals(s2); + + /// + public override bool Equals(object obj) => obj is LANGID s ? Equals(s) : (obj is ushort b ? Value.Equals(b) : Value.Equals(obj)); + + /// + public bool Equals(LANGID other) => Value.Equals(other.Value); + + /// + public bool Equals(ushort other) => Value.Equals(other); + + /// + public override int GetHashCode() => val; + + /// + public TypeCode GetTypeCode() => Value.GetTypeCode(); + + /// + public override string ToString() => Value.ToString(); + + /// + public string ToString(IFormatProvider provider) => Value.ToString(provider); + + /// + int IComparable.CompareTo(object obj) => Value.CompareTo(Convert.ChangeType(obj, typeof(ulong))); + + /// + bool IConvertible.ToBoolean(IFormatProvider provider) => ((IConvertible)Value).ToBoolean(provider); + + /// + byte IConvertible.ToByte(IFormatProvider provider) => ((IConvertible)Value).ToByte(provider); + + /// + char IConvertible.ToChar(IFormatProvider provider) => ((IConvertible)Value).ToChar(provider); + + /// + DateTime IConvertible.ToDateTime(IFormatProvider provider) => ((IConvertible)Value).ToDateTime(provider); + + /// + decimal IConvertible.ToDecimal(IFormatProvider provider) => ((IConvertible)Value).ToDecimal(provider); + + /// + double IConvertible.ToDouble(IFormatProvider provider) => ((IConvertible)Value).ToDouble(provider); + + /// + short IConvertible.ToInt16(IFormatProvider provider) => ((IConvertible)Value).ToInt16(provider); + + /// + int IConvertible.ToInt32(IFormatProvider provider) => ((IConvertible)Value).ToInt32(provider); + + /// + long IConvertible.ToInt64(IFormatProvider provider) => ((IConvertible)Value).ToInt64(provider); + + /// + sbyte IConvertible.ToSByte(IFormatProvider provider) => ((IConvertible)Value).ToSByte(provider); + + /// + float IConvertible.ToSingle(IFormatProvider provider) => ((IConvertible)Value).ToSingle(provider); + + /// + object IConvertible.ToType(Type conversionType, IFormatProvider provider) => ((IConvertible)Value).ToBoolean(provider); + + /// + ushort IConvertible.ToUInt16(IFormatProvider provider) => ((IConvertible)Value).ToUInt16(provider); + + /// + uint IConvertible.ToUInt32(IFormatProvider provider) => ((IConvertible)Value).ToUInt32(provider); + + /// + ulong IConvertible.ToUInt64(IFormatProvider provider) => ((IConvertible)Value).ToUInt64(provider); + + internal class LANGIDTypeConverter : UInt16Converter + { + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) => + value is LANGID b ? base.ConvertTo(context, culture, b.Value, destinationType) : throw new ArgumentException(null, nameof(value)); + + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) => + new LANGID((ushort)base.ConvertFrom(context, culture, value)); + } + } +} \ No newline at end of file