@@ -1050,52 +1050,54 @@ The following table represents the languages list ordered by name.
10501050* [ Guides] ( /docs/documentation/guides )
10511051* [ Documentation] ( /docs/documentation )
10521052
1053- [ //] : # // The following csharp code generates the table above.
1054- [ //] : # using System.Globalization;
1055- [ //] : #
1056- [ //] : # class Program {
1057- [ //] : # static void Main() {
1058- [ //] : # var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures)
1059- [ //] : # .OrderBy(c => c.EnglishName)
1060- [ //] : # .ToArray();
1061- [ //] : #
1062- [ //] : # Console.WriteLine("| Language | Region/Locale | Language ID | Language tag |");
1063- [ //] : # Console.WriteLine("| ---------------------------------------- | ------------------------ | ----------- | ------------ |");
1064- [ //] : #
1065- [ //] : # foreach (var culture in cultures) {
1066- [ //] : # //TryCreateRegion(culture.Name, out var region);
1067- [ //] : # RegionInfo? region = null;
1068- [ //] : # if (!culture.IsNeutralCulture && !string.IsNullOrEmpty(culture.Name) && culture.Name.Contains('-')) TryCreateRegion(culture.Name, out region);
1069- [ //] : # Console.WriteLine($"| {culture.EnglishName,-40} | {region?.EnglishName ?? "(neutral)",-24} | 0x{culture.LCID: X4 } | {culture.Name,-12} |");
1070- [ //] : # }
1071- [ //] : #
1072- [ //] : # Console.WriteLine($"\n> Total supported cultures: {cultures.Length}");
1073- [ //] : # }
1074- [ //] : #
1075- [ //] : # static bool TryCreateRegion(string name, out RegionInfo? region) {
1076- [ //] : # try {
1077- [ //] : # region = new RegionInfo(name);
1078- [ //] : # return true;
1079- [ //] : # } catch {
1080- [ //] : # region = null!;
1081- [ //] : # return false;
1082- [ //] : # }
1083- [ //] : # }
1084- [ //] : # }
1085- [ //] : #
1086- [ //] : # // This code produces the following outputs :
1087- [ //] : # //
1088- [ //] : # // | Language | Region/Locale | Language ID | Language tag |
1089- [ //] : # // | ---------------------------------------- | ------------------------ | ----------- | ------------ |
1090- [ //] : # // | Afrikaans | (neutral) | 0x0036 | af |
1091- [ //] : # // | Afrikaans (Namibia) | Namibia | 0x1000 | af-NA |
1092- [ //] : # // | Afrikaans (South Africa) | South Africa | 0x0436 | af-ZA |
1093- [ //] : # // | Aghem | (neutral) | 0x1000 | agq |
1094- [ //] : # // | Aghem (Cameroon) | Cameroon | 0x1000 | agq-CM |
1095- [ //] : # // ...
1096- [ //] : # // | Zhuang | (neutral) | 0x1000 | za |
1097- [ //] : # // | Zhuang (China mainland) | China mainland | 0x1000 | za-CN |
1098- [ //] : # // | Zulu | (neutral) | 0x0035 | zu |
1099- [ //] : # // | Zulu (South Africa) | South Africa | 0x0435 | zu-ZA |
1100- [ //] : # //
1101- [ //] : # // > Total supported cultures: 1035
1053+ <!--
1054+ // The following csharp code generates the table above.
1055+ using System.Globalization;
1056+
1057+ class Program {
1058+ static void Main() {
1059+ var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures)
1060+ .OrderBy(c => c.EnglishName)
1061+ .ToArray();
1062+
1063+ Console.WriteLine("| Language | Region/Locale | Language ID | Language tag |");
1064+ Console.WriteLine("| ---------------------------------------- | ------------------------ | ----------- | ------------ |");
1065+
1066+ foreach (var culture in cultures) {
1067+ //TryCreateRegion(culture.Name, out var region);
1068+ RegionInfo? region = null;
1069+ if (!culture.IsNeutralCulture && !string.IsNullOrEmpty(culture.Name) && culture.Name.Contains('-')) TryCreateRegion(culture.Name, out region);
1070+ Console.WriteLine($"| {culture.EnglishName,-40} | {region?.EnglishName ?? "(neutral)",-24} | 0x{culture.LCID:X4} | {culture.Name,-12} |");
1071+ }
1072+
1073+ Console.WriteLine($"\n> Total supported cultures: {cultures.Length}");
1074+ }
1075+
1076+ static bool TryCreateRegion(string name, out RegionInfo? region) {
1077+ try {
1078+ region = new RegionInfo(name);
1079+ return true;
1080+ } catch {
1081+ region = null!;
1082+ return false;
1083+ }
1084+ }
1085+ }
1086+
1087+ // This code produces the following outputs :
1088+ //
1089+ // | Language | Region/Locale | Language ID | Language tag |
1090+ // | ---------------------------------------- | ------------------------ | ----------- | ------------ |
1091+ // | Afrikaans | (neutral) | 0x0036 | af |
1092+ // | Afrikaans (Namibia) | Namibia | 0x1000 | af-NA |
1093+ // | Afrikaans (South Africa) | South Africa | 0x0436 | af-ZA |
1094+ // | Aghem | (neutral) | 0x1000 | agq |
1095+ // | Aghem (Cameroon) | Cameroon | 0x1000 | agq-CM |
1096+ // ...
1097+ // | Zhuang | (neutral) | 0x1000 | za |
1098+ // | Zhuang (China mainland) | China mainland | 0x1000 | za-CN |
1099+ // | Zulu | (neutral) | 0x0035 | zu |
1100+ // | Zulu (South Africa) | South Africa | 0x0435 | zu-ZA |
1101+ //
1102+ // > Total supported cultures: 1035
1103+ -->
0 commit comments