From 7d9a654997b6df7d3dc5563032bf76a78881f290 Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:06:19 +0200 Subject: [PATCH 1/6] feat: Add Color resources to ResourcesExtractor --- .../ResourcesExtractor/Magic.cs | 1383 ++++++++++++++++- .../ResourcesExtractor/MainWindow.xaml.cs | 15 + 2 files changed, 1389 insertions(+), 9 deletions(-) diff --git a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs index 3e1ab5229d02..96071742165d 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs +++ b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace ResourcesExtractor; @@ -96,22 +97,23 @@ public enum Languages zh_TW = 0x0404, } - public static unsafe string GetLocalizedResource(int resourceId, int langid) + public static unsafe string GetLocalizedResource(int resourceId, int? langid = null, LANG language = LANG.LANG_ENGLISH, SUBLANG subLanguage = SUBLANG.SUBLANG_ENGLISH_US) { try { - IntPtr block = MAKEINTRESOURCEW(resourceId / 16 + 1); - int offset = resourceId % 16; - IntPtr hModule = NativeMethods.GetModuleHandle("Microsoft.UI.Xaml.dll"); + var block = NativeMethods.MAKEINTRESOURCEW(resourceId / 16 + 1); + var offset = resourceId % 16; + var hModule = NativeMethods.GetModuleHandle("Microsoft.UI.Xaml.dll"); + // Determine language ID + var actualLangId = langid ?? NativeMethods.MAKELANGID((int)language, (int)subLanguage); // Find and load the string resource - //var langid = MAKELANGID(0x09 /* LANG_ENGLISH */, 0x01 /* SUBLANG_ENGLISH_US */); - IntPtr hResource = NativeMethods.FindResourceEx(hModule, (IntPtr)NativeMethods.RT_STRING, block, langid); - IntPtr hStr = NativeMethods.LoadResource(hModule, hResource); + var hResource = NativeMethods.FindResourceEx(hModule, (IntPtr)NativeMethods.RT_STRING, block, actualLangId); + var hStr = NativeMethods.LoadResource(hModule, hResource); - ushort* curr = (ushort*)hStr; - for (int i = 0; i < offset; i++) + var curr = (ushort*)hStr; + for (var i = 0; i < offset; i++) { // Skip to next string curr += (*curr + 1); @@ -136,6 +138,474 @@ private static IntPtr MAKEINTRESOURCEW(int i) return ip; } + private static ReadOnlySpan HueLimitsForSatLevel4 => + [ + 0, + 11, + 26, + 0, + 0, + 38, + 45, + 0, + 0, + 56, + 100, + 121, + 129, + 0, + 140, + 0, + 180, + 0, + 0, + 224, + 241, + 0, + 256 + ]; + + private static ReadOnlySpan HueLimitsForSatLevel5 => + [ + 0, + 13, + 27, + 0, + 0, + 36, + 45, + 0, + 0, + 59, + 118, + 0, + 127, + 136, + 142, + 0, + 185, + 0, + 0, + 216, + 239, + 0, + 256 + ]; + + private static ReadOnlySpan HueLimitsForSatLevel3 => + [ + 0, + 8, + 0, + 0, + 39, + 46, + 0, + 0, + 0, + 71, + 120, + 0, + 131, + 144, + 0, + 0, + 163, + 0, + 177, + 211, + 249, + 0, + 256 + ]; + + private static ReadOnlySpan HueLimitsForSatLevel2 => + [ + 0, + 10, + 0, + 32, + 46, + 0, + 0, + 0, + 61, + 0, + 106, + 0, + 136, + 144, + 0, + 0, + 0, + 158, + 166, + 241, + 0, + 0, + 256 + ]; + + private static ReadOnlySpan HueLimitsForSatLevel1 => + [ + 8, + 0, + 0, + 44, + 0, + 0, + 0, + 63, + 0, + 0, + 122, + 0, + 134, + 0, + 0, + 0, + 0, + 166, + 176, + 241, + 0, + 256, + 0 + ]; + + private static ReadOnlySpan LumLimitsForHueIndexHigh => + [ + 170, + 170, + 170, + 155, + 170, + 170, + 170, + 170, + 170, + 115, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 150, + 150, + 170, + 140, + 165 + ]; + + private static ReadOnlySpan LumLimitsForHueIndexLow => + [ + 130, + 100, + 115, + 100, + 100, + 100, + 110, + 75, + 100, + 90, + 100, + 100, + 100, + 100, + 80, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100 + ]; + + private static ReadOnlySpan ColorNamesMid => + [ + 5119, + 5135, + 5136, + 5137, + 5122, + 5138, + 5139, + 5140, + 5140, + 5141, + 5141, + 5142, + 5143, + 5126, + 5144, + 5129, + 5145, + 5146, + 5147, + 5148, + 5134, + 5137, + 5135 + ]; + + private static ReadOnlySpan ColorNamesDark => + [ + 5137, + 5149, + 5137, + 5137, + 5137, + 5150, + 5150, + 5137, + 5151, + 5151, + 5151, + 5151, + 5152, + 5152, + 5152, + 5153, + 5153, + 5146, + 5147, + 5154, + 5155, + 5137, + 5149 + ]; + + private static ReadOnlySpan ColorNamesLight => + [ + 5119, + 5120, + 5121, + 5122, + 5122, + 5123, + 5123, + 5122, + 5124, + 5125, + 5124, + 5124, + 5126, + 5127, + 5128, + 5129, + 5130, + 5131, + 5132, + 5133, + 5134, + 5122, + 5120 + ]; + + public static unsafe Windows.UI.Color GetColorFromNameResourceId(int resourceId) + { + if (resourceId == 5114) + return FromHsl(0, 0, 241.0 / 255.0); // Approximated high lightness + else if (resourceId == 5118) + return FromHsl(0, 0, 19.0 / 255.0); // Approximated low lightness + else if (resourceId == 5115) + return FromHsl(0, 21.0 / 255.0, 171.0 / 255.0); // Approximated low saturation, mid lightness + else if (resourceId == 5116) + return FromHsl(0, 21.0 / 255.0, 101.0 / 255.0); // Approximated low saturation, low lightness + else if (resourceId == 5117) + return FromHsl(0, 21.0 / 255.0, 99.0 / 255.0); // Approximated low saturation, very low lightness + else + { + // Reverse mapping using hue and lightness/saturation limits + for (int i = 0; i < 24; i++) + { + if (ColorNamesLight[i] == resourceId) + { + // Found in light category, construct color + return FromHsl( + (HueLimitsForSatLevel1[i] + HueLimitsForSatLevel1[i + 1]) / 2.0 / 255.0, + 1.0, // Assuming maximum saturation + (LumLimitsForHueIndexHigh[i] + 1.0) / 255.0 + ); + } + else if (ColorNamesMid[i] == resourceId) + { + // Found in mid category, construct color + return FromHsl( + (HueLimitsForSatLevel1[i] + HueLimitsForSatLevel1[i + 1]) / 2.0 / 255.0, + 1.0, // Assuming maximum saturation + ((LumLimitsForHueIndexHigh[i] + LumLimitsForHueIndexLow[i]) / 2.0) / 255.0 + ); + } + else if (ColorNamesDark[i] == resourceId) + { + // Found in dark category, construct color + return FromHsl( + (HueLimitsForSatLevel1[i] + HueLimitsForSatLevel1[i + 1]) / 2.0 / 255.0, + 1.0, // Assuming maximum saturation + (LumLimitsForHueIndexLow[i] - 1.0) / 255.0 + ); + } + } + } + + // Fallback color (black) if no match found + return Windows.UI.Color.FromArgb(255, 0, 0, 0); + } + + // Helper method to convert HSL to RGB and return as Windows.UI.Color + private static Windows.UI.Color FromHsl(double h, double s, double l) + { + double r = l; + double g = l; + double b = l; + + if (s != 0) + { + double temp2; + if (l < 0.5) + { + temp2 = l * (1.0 + s); + } + else + { + temp2 = (l + s) - (l * s); + } + + double temp1 = 2.0 * l - temp2; + + r = GetColorComponent(temp1, temp2, h + 1.0 / 3.0); + g = GetColorComponent(temp1, temp2, h); + b = GetColorComponent(temp1, temp2, h - 1.0 / 3.0); + } + + return Windows.UI.Color.FromArgb( + 255, // Assuming fully opaque + (byte)(r * 255.0), + (byte)(g * 255.0), + (byte)(b * 255.0) + ); + } + + private static double GetColorComponent(double temp1, double temp2, double tempColor) + { + if (tempColor < 0.0) + tempColor += 1.0; + if (tempColor > 1.0) + tempColor -= 1.0; + + if (6.0 * tempColor < 1.0) + return temp1 + (temp2 - temp1) * 6.0 * tempColor; + if (2.0 * tempColor < 1.0) + return temp2; + if (3.0 * tempColor < 2.0) + return temp1 + (temp2 - temp1) * ((2.0 / 3.0) - tempColor) * 6.0; + + return temp1; + } + + + private unsafe static uint GetColorNameResourceId(Windows.UI.Color color) + { + HSL hsl = ConvertRgbToHsl(color); + double h = hsl.H * 255.0; + double s = hsl.S * 255.0; + double l = hsl.L * 255.0; + + if (l > 240.0) + return 5114; + + if (l < 20.0) + return 5118; + + if (s > 20.0) + { + ReadOnlySpan hueLimits = default; + + if (s > 240.0) + hueLimits = HueLimitsForSatLevel5; + + else if (s > 150.0) + hueLimits = HueLimitsForSatLevel4; + + else if (s > 115.0) + hueLimits = HueLimitsForSatLevel3; + + else if (s > 75.0) + hueLimits = HueLimitsForSatLevel2; + + else + hueLimits = HueLimitsForSatLevel1; + + int hueIndex = 0; + while (hueIndex < 23 && hueLimits[hueIndex] <= h) hueIndex++; + + if (l > LumLimitsForHueIndexHigh[hueIndex]) + return ColorNamesLight[hueIndex]; + else if (l >= LumLimitsForHueIndexLow[hueIndex]) + return ColorNamesMid[hueIndex]; + else + return ColorNamesDark[hueIndex]; + } + else if (l <= 170.0) + { + return (l <= 100.0) ? (uint)5117 : 5116; + } + else + { + return 5115; + } + } + + private struct HSL + { + public double H; + public double S; + public double L; + } + + private static HSL ConvertRgbToHsl(Windows.UI.Color color) + { + double r = color.R / 255.0; + double g = color.G / 255.0; + double b = color.B / 255.0; + + double max = Math.Max(Math.Max(r, g), b); + double min = Math.Min(Math.Min(r, g), b); + + double h = 0, s = 0, l = (max + min) / 2; + double delta = max - min; + + if (Math.Abs(delta) > double.Epsilon) + { + s = delta / (l > 0.5 ? (2.0 - max - min) : (max + min)); + + double deltaR = (((max - r) / 6) + (delta / 2)) / delta; + double deltaG = (((max - g) / 6) + (delta / 2)) / delta; + double deltaB = (((max - b) / 6) + (delta / 2)) / delta; + + if (Math.Abs(r - max) < double.Epsilon) + h = deltaB - deltaG; + else if (Math.Abs(g - max) < double.Epsilon) + h = (1.0 / 3.0) + deltaR - deltaB; + else + h = (2.0 / 3.0) + deltaG - deltaR; + + if (h < 0) + h += 1; + if (h > 1) + h -= 1; + } + + return new HSL { H = h, S = s, L = l }; + } + //private static int MAKELANGID(int primaryLang, int subLang) //{ // return ((((ushort)(subLang)) << 10) | (ushort)(primaryLang)); @@ -153,5 +623,900 @@ private static class NativeMethods [DllImport("kernel32.dll", SetLastError = true)] public static extern IntPtr LoadResource(IntPtr hModule, IntPtr hResInfo); + + + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + public static extern nint GetModuleHandleW(string lpModuleName); + + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + public static extern nint FindResourceExW(nint hModule, nint lpType, nint lpName, int wLanguage); + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static nint MAKEINTRESOURCEW(int i) => unchecked((ushort)i); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static int MAKELANGID(int primaryLang, int subLang) => (((ushort)subLang) << 10) | (ushort)primaryLang; + + } + #region Enums + 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, + LANG_AZERBAIJANI = 0x2c, + LANG_BANGLA = 0x45, + LANG_BASHKIR = 0x6d, + LANG_BASQUE = 0x2d, + LANG_BELARUSIAN = 0x23, + LANG_BENGALI = 0x45, + LANG_BRETON = 0x7e, + LANG_BOSNIAN = 0x1a, + LANG_BOSNIAN_NEUTRAL = 0x781a, + LANG_BULGARIAN = 0x02, + LANG_CATALAN = 0x03, + LANG_CENTRAL_KURDISH = 0x92, + LANG_CHEROKEE = 0x5c, + LANG_CHINESE = 0x04, + LANG_CHINESE_SIMPLIFIED = 0x04, + LANG_CHINESE_TRADITIONAL = 0x7c04, + 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, + 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, + 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, + 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, + LANG_PASHTO = 0x63, + LANG_PERSIAN = 0x29, + LANG_POLISH = 0x15, + LANG_PORTUGUESE = 0x16, + LANG_PULAR = 0x67, + 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, + LANG_SERBIAN_NEUTRAL = 0x7c1a, + 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, + 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, + LANG_YI = 0x78, + LANG_YORUBA = 0x6a, + LANG_ZULU = 0x35, + } + + 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, } + #endregion } diff --git a/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs b/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs index f9c454df77f6..d3449df5f217 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs +++ b/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; +using System.Linq; using System.Text.RegularExpressions; using Microsoft/* UWP don't rename */.UI.Xaml; @@ -12,8 +13,22 @@ public sealed partial class MainWindow : Window private static List<(string ResourceName, int ResourceId)> GetResources() { var allResources = new List<(string ResourceName, int ResourceId)>(); + + for (var i = 5114; i <= 5155; i++) + { + var resource = Magic.GetLocalizedResource(i); + var trimmedResource = resource.Trim(); + + var textInfo = CultureInfo.CurrentCulture.TextInfo; + var titleCase = textInfo.ToTitleCase(trimmedResource.ToLower(new CultureInfo("en-US"))); + var noWhitespace = string.Concat(titleCase.Where(c => !char.IsWhiteSpace(c))); + + allResources.Add((noWhitespace, i)); + } + allResources.AddRange(GetResourcesFromFile("dxaml\\phone\\lib\\PhoneResource.h")); allResources.AddRange(GetResourcesFromFile("dxaml\\xcp\\inc\\localizedResource.h")); + return allResources; } From 2082455e7c93e5618ca2cb867b8e3dce1dbdd784 Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:06:46 +0200 Subject: [PATCH 2/6] chore: Adjust ResourcesExtractor csproj --- .../ResourcesExtractor/ResourcesExtractor.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ResourcesExtractor/ResourcesExtractor/ResourcesExtractor.csproj b/tools/ResourcesExtractor/ResourcesExtractor/ResourcesExtractor.csproj index 1b11d876376c..41a6769979a9 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/ResourcesExtractor.csproj +++ b/tools/ResourcesExtractor/ResourcesExtractor/ResourcesExtractor.csproj @@ -5,11 +5,11 @@ 10.0.17763.0 ResourcesExtractor app.manifest - x86;x64;ARM64 - win10-x86;win10-x64;win10-arm64 - win10-$(Platform).pubxml + win-$(Platform).pubxml + x86;x64;arm64 + win-x86;win-x64;win-arm64 true - 11.0 + 12.0 true true From 117ff4cc9d6874015573c3222e9b84846dd92658 Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Fri, 27 Sep 2024 22:46:24 +0200 Subject: [PATCH 3/6] chore: ResourcesExtractor adjustments --- .../ResourcesExtractor/Magic.cs | 468 ------------------ .../ResourcesExtractor/MainWindow.xaml.cs | 30 +- 2 files changed, 27 insertions(+), 471 deletions(-) diff --git a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs index 96071742165d..5359bb2e3a6f 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs +++ b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs @@ -138,474 +138,6 @@ private static IntPtr MAKEINTRESOURCEW(int i) return ip; } - private static ReadOnlySpan HueLimitsForSatLevel4 => - [ - 0, - 11, - 26, - 0, - 0, - 38, - 45, - 0, - 0, - 56, - 100, - 121, - 129, - 0, - 140, - 0, - 180, - 0, - 0, - 224, - 241, - 0, - 256 - ]; - - private static ReadOnlySpan HueLimitsForSatLevel5 => - [ - 0, - 13, - 27, - 0, - 0, - 36, - 45, - 0, - 0, - 59, - 118, - 0, - 127, - 136, - 142, - 0, - 185, - 0, - 0, - 216, - 239, - 0, - 256 - ]; - - private static ReadOnlySpan HueLimitsForSatLevel3 => - [ - 0, - 8, - 0, - 0, - 39, - 46, - 0, - 0, - 0, - 71, - 120, - 0, - 131, - 144, - 0, - 0, - 163, - 0, - 177, - 211, - 249, - 0, - 256 - ]; - - private static ReadOnlySpan HueLimitsForSatLevel2 => - [ - 0, - 10, - 0, - 32, - 46, - 0, - 0, - 0, - 61, - 0, - 106, - 0, - 136, - 144, - 0, - 0, - 0, - 158, - 166, - 241, - 0, - 0, - 256 - ]; - - private static ReadOnlySpan HueLimitsForSatLevel1 => - [ - 8, - 0, - 0, - 44, - 0, - 0, - 0, - 63, - 0, - 0, - 122, - 0, - 134, - 0, - 0, - 0, - 0, - 166, - 176, - 241, - 0, - 256, - 0 - ]; - - private static ReadOnlySpan LumLimitsForHueIndexHigh => - [ - 170, - 170, - 170, - 155, - 170, - 170, - 170, - 170, - 170, - 115, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 170, - 150, - 150, - 170, - 140, - 165 - ]; - - private static ReadOnlySpan LumLimitsForHueIndexLow => - [ - 130, - 100, - 115, - 100, - 100, - 100, - 110, - 75, - 100, - 90, - 100, - 100, - 100, - 100, - 80, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 100 - ]; - - private static ReadOnlySpan ColorNamesMid => - [ - 5119, - 5135, - 5136, - 5137, - 5122, - 5138, - 5139, - 5140, - 5140, - 5141, - 5141, - 5142, - 5143, - 5126, - 5144, - 5129, - 5145, - 5146, - 5147, - 5148, - 5134, - 5137, - 5135 - ]; - - private static ReadOnlySpan ColorNamesDark => - [ - 5137, - 5149, - 5137, - 5137, - 5137, - 5150, - 5150, - 5137, - 5151, - 5151, - 5151, - 5151, - 5152, - 5152, - 5152, - 5153, - 5153, - 5146, - 5147, - 5154, - 5155, - 5137, - 5149 - ]; - - private static ReadOnlySpan ColorNamesLight => - [ - 5119, - 5120, - 5121, - 5122, - 5122, - 5123, - 5123, - 5122, - 5124, - 5125, - 5124, - 5124, - 5126, - 5127, - 5128, - 5129, - 5130, - 5131, - 5132, - 5133, - 5134, - 5122, - 5120 - ]; - - public static unsafe Windows.UI.Color GetColorFromNameResourceId(int resourceId) - { - if (resourceId == 5114) - return FromHsl(0, 0, 241.0 / 255.0); // Approximated high lightness - else if (resourceId == 5118) - return FromHsl(0, 0, 19.0 / 255.0); // Approximated low lightness - else if (resourceId == 5115) - return FromHsl(0, 21.0 / 255.0, 171.0 / 255.0); // Approximated low saturation, mid lightness - else if (resourceId == 5116) - return FromHsl(0, 21.0 / 255.0, 101.0 / 255.0); // Approximated low saturation, low lightness - else if (resourceId == 5117) - return FromHsl(0, 21.0 / 255.0, 99.0 / 255.0); // Approximated low saturation, very low lightness - else - { - // Reverse mapping using hue and lightness/saturation limits - for (int i = 0; i < 24; i++) - { - if (ColorNamesLight[i] == resourceId) - { - // Found in light category, construct color - return FromHsl( - (HueLimitsForSatLevel1[i] + HueLimitsForSatLevel1[i + 1]) / 2.0 / 255.0, - 1.0, // Assuming maximum saturation - (LumLimitsForHueIndexHigh[i] + 1.0) / 255.0 - ); - } - else if (ColorNamesMid[i] == resourceId) - { - // Found in mid category, construct color - return FromHsl( - (HueLimitsForSatLevel1[i] + HueLimitsForSatLevel1[i + 1]) / 2.0 / 255.0, - 1.0, // Assuming maximum saturation - ((LumLimitsForHueIndexHigh[i] + LumLimitsForHueIndexLow[i]) / 2.0) / 255.0 - ); - } - else if (ColorNamesDark[i] == resourceId) - { - // Found in dark category, construct color - return FromHsl( - (HueLimitsForSatLevel1[i] + HueLimitsForSatLevel1[i + 1]) / 2.0 / 255.0, - 1.0, // Assuming maximum saturation - (LumLimitsForHueIndexLow[i] - 1.0) / 255.0 - ); - } - } - } - - // Fallback color (black) if no match found - return Windows.UI.Color.FromArgb(255, 0, 0, 0); - } - - // Helper method to convert HSL to RGB and return as Windows.UI.Color - private static Windows.UI.Color FromHsl(double h, double s, double l) - { - double r = l; - double g = l; - double b = l; - - if (s != 0) - { - double temp2; - if (l < 0.5) - { - temp2 = l * (1.0 + s); - } - else - { - temp2 = (l + s) - (l * s); - } - - double temp1 = 2.0 * l - temp2; - - r = GetColorComponent(temp1, temp2, h + 1.0 / 3.0); - g = GetColorComponent(temp1, temp2, h); - b = GetColorComponent(temp1, temp2, h - 1.0 / 3.0); - } - - return Windows.UI.Color.FromArgb( - 255, // Assuming fully opaque - (byte)(r * 255.0), - (byte)(g * 255.0), - (byte)(b * 255.0) - ); - } - - private static double GetColorComponent(double temp1, double temp2, double tempColor) - { - if (tempColor < 0.0) - tempColor += 1.0; - if (tempColor > 1.0) - tempColor -= 1.0; - - if (6.0 * tempColor < 1.0) - return temp1 + (temp2 - temp1) * 6.0 * tempColor; - if (2.0 * tempColor < 1.0) - return temp2; - if (3.0 * tempColor < 2.0) - return temp1 + (temp2 - temp1) * ((2.0 / 3.0) - tempColor) * 6.0; - - return temp1; - } - - - private unsafe static uint GetColorNameResourceId(Windows.UI.Color color) - { - HSL hsl = ConvertRgbToHsl(color); - double h = hsl.H * 255.0; - double s = hsl.S * 255.0; - double l = hsl.L * 255.0; - - if (l > 240.0) - return 5114; - - if (l < 20.0) - return 5118; - - if (s > 20.0) - { - ReadOnlySpan hueLimits = default; - - if (s > 240.0) - hueLimits = HueLimitsForSatLevel5; - - else if (s > 150.0) - hueLimits = HueLimitsForSatLevel4; - - else if (s > 115.0) - hueLimits = HueLimitsForSatLevel3; - - else if (s > 75.0) - hueLimits = HueLimitsForSatLevel2; - - else - hueLimits = HueLimitsForSatLevel1; - - int hueIndex = 0; - while (hueIndex < 23 && hueLimits[hueIndex] <= h) hueIndex++; - - if (l > LumLimitsForHueIndexHigh[hueIndex]) - return ColorNamesLight[hueIndex]; - else if (l >= LumLimitsForHueIndexLow[hueIndex]) - return ColorNamesMid[hueIndex]; - else - return ColorNamesDark[hueIndex]; - } - else if (l <= 170.0) - { - return (l <= 100.0) ? (uint)5117 : 5116; - } - else - { - return 5115; - } - } - - private struct HSL - { - public double H; - public double S; - public double L; - } - - private static HSL ConvertRgbToHsl(Windows.UI.Color color) - { - double r = color.R / 255.0; - double g = color.G / 255.0; - double b = color.B / 255.0; - - double max = Math.Max(Math.Max(r, g), b); - double min = Math.Min(Math.Min(r, g), b); - - double h = 0, s = 0, l = (max + min) / 2; - double delta = max - min; - - if (Math.Abs(delta) > double.Epsilon) - { - s = delta / (l > 0.5 ? (2.0 - max - min) : (max + min)); - - double deltaR = (((max - r) / 6) + (delta / 2)) / delta; - double deltaG = (((max - g) / 6) + (delta / 2)) / delta; - double deltaB = (((max - b) / 6) + (delta / 2)) / delta; - - if (Math.Abs(r - max) < double.Epsilon) - h = deltaB - deltaG; - else if (Math.Abs(g - max) < double.Epsilon) - h = (1.0 / 3.0) + deltaR - deltaB; - else - h = (2.0 / 3.0) + deltaG - deltaR; - - if (h < 0) - h += 1; - if (h > 1) - h -= 1; - } - - return new HSL { H = h, S = s, L = l }; - } - //private static int MAKELANGID(int primaryLang, int subLang) //{ // return ((((ushort)(subLang)) << 10) | (ushort)(primaryLang)); diff --git a/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs b/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs index d3449df5f217..dac9b1db7702 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs +++ b/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs @@ -4,7 +4,10 @@ using System.IO; using System.Linq; using System.Text.RegularExpressions; +using System.Threading.Tasks; using Microsoft/* UWP don't rename */.UI.Xaml; +using Windows.Storage; +using Windows.System; namespace ResourcesExtractor; @@ -54,21 +57,27 @@ public MainWindow() { this.InitializeComponent(); + var rootDirectory = "C:\\GeneratedResources\\"; + var resources = GetResources(); foreach (var lang in Enum.GetValues()) { - var filePath = $"C:\\GeneratedResources\\{lang.ToString().Replace('_', '-')}\\Resources.resw"; + var filePath = $"{rootDirectory}{lang.ToString().Replace('_', '-')}\\Resources.resw"; var directory = Path.GetDirectoryName(filePath); Directory.CreateDirectory(directory); var writer = new StreamWriter(new FileStream(filePath, FileMode.CreateNew)); writer.Write(Constants.ReswFileStart); foreach (var resource in resources) { - string resourceValue = Magic.GetLocalizedResource(resource.ResourceId, (int)lang); + var resourceValue = Magic.GetLocalizedResource(resource.ResourceId, (int)lang); + + var name = (resource.ResourceId >= 5114 && resource.ResourceId <= 5155) + ? resource.ResourceId.ToString(new CultureInfo("en-US")) + : resource.ResourceName; if (resourceValue != null) { writer.Write($""" - + {resourceValue} @@ -79,5 +88,20 @@ public MainWindow() writer.Write(Constants.ReswFileEnd); writer.Close(); } + + OpenFileManagerAsync(rootDirectory).ConfigureAwait(false); + } + + private async Task OpenFileManagerAsync(string directoryPath) + { + try + { + var folder = await StorageFolder.GetFolderFromPathAsync(directoryPath); + await Launcher.LaunchFolderAsync(folder); + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"Error: {ex.Message}"); + } } } From 4c69197b1041119015cadda79bcae79b6145cdf1 Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Fri, 4 Oct 2024 09:34:16 +0200 Subject: [PATCH 4/6] chore: Adjust logic --- .../ResourcesExtractor/MainWindow.xaml.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs b/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs index dac9b1db7702..f0512ef9d9d5 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs +++ b/tools/ResourcesExtractor/ResourcesExtractor/MainWindow.xaml.cs @@ -19,14 +19,7 @@ public sealed partial class MainWindow : Window for (var i = 5114; i <= 5155; i++) { - var resource = Magic.GetLocalizedResource(i); - var trimmedResource = resource.Trim(); - - var textInfo = CultureInfo.CurrentCulture.TextInfo; - var titleCase = textInfo.ToTitleCase(trimmedResource.ToLower(new CultureInfo("en-US"))); - var noWhitespace = string.Concat(titleCase.Where(c => !char.IsWhiteSpace(c))); - - allResources.Add((noWhitespace, i)); + allResources.Add((i.ToString(CultureInfo.InvariantCulture), i)); } allResources.AddRange(GetResourcesFromFile("dxaml\\phone\\lib\\PhoneResource.h")); @@ -69,15 +62,11 @@ public MainWindow() writer.Write(Constants.ReswFileStart); foreach (var resource in resources) { - var resourceValue = Magic.GetLocalizedResource(resource.ResourceId, (int)lang); - - var name = (resource.ResourceId >= 5114 && resource.ResourceId <= 5155) - ? resource.ResourceId.ToString(new CultureInfo("en-US")) - : resource.ResourceName; + string resourceValue = Magic.GetLocalizedResource(resource.ResourceId, (int)lang); if (resourceValue != null) { writer.Write($""" - + {resourceValue} From aadf7243e12d5c6a28dde4b31acca78286d15b8b Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Fri, 4 Oct 2024 09:51:41 +0200 Subject: [PATCH 5/6] chore: Remove Magic changes --- .../ResourcesExtractor/Magic.cs | 907 +----------------- 1 file changed, 9 insertions(+), 898 deletions(-) diff --git a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs index 5359bb2e3a6f..397c09537284 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs +++ b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs @@ -97,23 +97,22 @@ public enum Languages zh_TW = 0x0404, } - public static unsafe string GetLocalizedResource(int resourceId, int? langid = null, LANG language = LANG.LANG_ENGLISH, SUBLANG subLanguage = SUBLANG.SUBLANG_ENGLISH_US) + public static unsafe string GetLocalizedResource(int resourceId, int langid) { try { - var block = NativeMethods.MAKEINTRESOURCEW(resourceId / 16 + 1); - var offset = resourceId % 16; - var hModule = NativeMethods.GetModuleHandle("Microsoft.UI.Xaml.dll"); + IntPtr block = MAKEINTRESOURCEW(resourceId / 16 + 1); + int offset = resourceId % 16; + IntPtr hModule = NativeMethods.GetModuleHandle("Microsoft.UI.Xaml.dll"); - // Determine language ID - var actualLangId = langid ?? NativeMethods.MAKELANGID((int)language, (int)subLanguage); // Find and load the string resource - var hResource = NativeMethods.FindResourceEx(hModule, (IntPtr)NativeMethods.RT_STRING, block, actualLangId); - var hStr = NativeMethods.LoadResource(hModule, hResource); + //var langid = MAKELANGID(0x09 /* LANG_ENGLISH */, 0x01 /* SUBLANG_ENGLISH_US */); + IntPtr hResource = NativeMethods.FindResourceEx(hModule, (IntPtr)NativeMethods.RT_STRING, block, langid); + IntPtr hStr = NativeMethods.LoadResource(hModule, hResource); - var curr = (ushort*)hStr; - for (var i = 0; i < offset; i++) + ushort* curr = (ushort*)hStr; + for (int i = 0; i < offset; i++) { // Skip to next string curr += (*curr + 1); @@ -162,893 +161,5 @@ private static class NativeMethods [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] public static extern nint FindResourceExW(nint hModule, nint lpType, nint lpName, int wLanguage); - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static nint MAKEINTRESOURCEW(int i) => unchecked((ushort)i); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static int MAKELANGID(int primaryLang, int subLang) => (((ushort)subLang) << 10) | (ushort)primaryLang; - - } - #region Enums - 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, - LANG_AZERBAIJANI = 0x2c, - LANG_BANGLA = 0x45, - LANG_BASHKIR = 0x6d, - LANG_BASQUE = 0x2d, - LANG_BELARUSIAN = 0x23, - LANG_BENGALI = 0x45, - LANG_BRETON = 0x7e, - LANG_BOSNIAN = 0x1a, - LANG_BOSNIAN_NEUTRAL = 0x781a, - LANG_BULGARIAN = 0x02, - LANG_CATALAN = 0x03, - LANG_CENTRAL_KURDISH = 0x92, - LANG_CHEROKEE = 0x5c, - LANG_CHINESE = 0x04, - LANG_CHINESE_SIMPLIFIED = 0x04, - LANG_CHINESE_TRADITIONAL = 0x7c04, - 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, - 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, - 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, - 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, - LANG_PASHTO = 0x63, - LANG_PERSIAN = 0x29, - LANG_POLISH = 0x15, - LANG_PORTUGUESE = 0x16, - LANG_PULAR = 0x67, - 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, - LANG_SERBIAN_NEUTRAL = 0x7c1a, - 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, - 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, - LANG_YI = 0x78, - LANG_YORUBA = 0x6a, - LANG_ZULU = 0x35, - } - - 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, } - #endregion } From 042b7274f530763f14e20ca9682bc83218032da3 Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Fri, 4 Oct 2024 09:57:22 +0200 Subject: [PATCH 6/6] chore: Remove NativeMethods changes --- tools/ResourcesExtractor/ResourcesExtractor/Magic.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs index 397c09537284..3e1ab5229d02 100644 --- a/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs +++ b/tools/ResourcesExtractor/ResourcesExtractor/Magic.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace ResourcesExtractor; @@ -154,12 +153,5 @@ private static class NativeMethods [DllImport("kernel32.dll", SetLastError = true)] public static extern IntPtr LoadResource(IntPtr hModule, IntPtr hResInfo); - - - [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern nint GetModuleHandleW(string lpModuleName); - - [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern nint FindResourceExW(nint hModule, nint lpType, nint lpName, int wLanguage); } }