From 1423b8537be887fa4bdb29c41ed5380b007fb8fd Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Wed, 27 Dec 2023 23:51:34 +0200 Subject: [PATCH 1/9] added regions (countries) --- .idea/.gitignore | 8 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/whoami.iml | 8 + countries.txt | 249 ++++++++ output.txt | 249 ++++++++ rearanged.txt | 249 ++++++++ src/lib.rs | 1513 ++++++++++++++++++++++++++++++++++++++++++++- tari.txt | 249 ++++++++ 9 files changed, 2537 insertions(+), 2 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/whoami.iml create mode 100644 countries.txt create mode 100644 output.txt create mode 100644 rearanged.txt create mode 100644 tari.txt diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..285cd1e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/whoami.iml b/.idea/whoami.iml new file mode 100644 index 0000000..6102194 --- /dev/null +++ b/.idea/whoami.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/countries.txt b/countries.txt new file mode 100644 index 0000000..8000a83 --- /dev/null +++ b/countries.txt @@ -0,0 +1,249 @@ +Afghanistan AF AFG 004 +Albania AL ALB 008 +Algeria DZ DZA 012 +American Samoa AS ASM 016 +Andorra AD AND 020 +Angola AO AGO 024 +Anguilla AI AIA 660 +Antarctica AQ ATA 010 +Antigua and Barbuda AG ATG 028 +Argentina AR ARG 032 +Armenia AM ARM 051 +Aruba AW ABW 533 +Australia AU AUS 036 +Austria AT AUT 040 +Azerbaijan AZ AZE 031 +Bahamas (the) BS BHS 044 +Bahrain BH BHR 048 +Bangladesh BD BGD 050 +Barbados BB BRB 052 +Belarus BY BLR 112 +Belgium BE BEL 056 +Belize BZ BLZ 084 +Benin BJ BEN 204 +Bermuda BM BMU 060 +Bhutan BT BTN 064 +Bolivia (Plurinational State of) BO BOL 068 +Bonaire, Sint Eustatius and Saba BQ BES 535 +Bosnia and Herzegovina BA BIH 070 +Botswana BW BWA 072 +Bouvet Island BV BVT 074 +Brazil BR BRA 076 +British Indian Ocean Territory (the) IO IOT 086 +Brunei Darussalam BN BRN 096 +Bulgaria BG BGR 100 +Burkina Faso BF BFA 854 +Burundi BI BDI 108 +Cabo Verde CV CPV 132 +Cambodia KH KHM 116 +Cameroon CM CMR 120 +Canada CA CAN 124 +Cayman Islands (the) KY CYM 136 +Central African Republic (the) CF CAF 140 +Chad TD TCD 148 +Chile CL CHL 152 +China CN CHN 156 +Christmas Island CX CXR 162 +Cocos (Keeling) Islands (the) CC CCK 166 +Colombia CO COL 170 +Comoros (the) KM COM 174 +Congo (the Democratic Republic of the) CD COD 180 +Congo (the) CG COG 178 +Cook Islands (the) CK COK 184 +Costa Rica CR CRI 188 +Croatia HR HRV 191 +Cuba CU CUB 192 +Curaçao CW CUW 531 +Cyprus CY CYP 196 +Czechia CZ CZE 203 +Côte d'Ivoire CI CIV 384 +Denmark DK DNK 208 +Djibouti DJ DJI 262 +Dominica DM DMA 212 +Dominican Republic (the) DO DOM 214 +Ecuador EC ECU 218 +Egypt EG EGY 818 +El Salvador SV SLV 222 +Equatorial Guinea GQ GNQ 226 +Eritrea ER ERI 232 +Estonia EE EST 233 +Eswatini SZ SWZ 748 +Ethiopia ET ETH 231 +Falkland Islands (the) [Malvinas] FK FLK 238 +Faroe Islands (the) FO FRO 234 +Fiji FJ FJI 242 +Finland FI FIN 246 +France FR FRA 250 +French Guiana GF GUF 254 +French Polynesia PF PYF 258 +French Southern Territories (the) TF ATF 260 +Gabon GA GAB 266 +Gambia (the) GM GMB 270 +Georgia GE GEO 268 +Germany DE DEU 276 +Ghana GH GHA 288 +Gibraltar GI GIB 292 +Greece GR GRC 300 +Greenland GL GRL 304 +Grenada GD GRD 308 +Guadeloupe GP GLP 312 +Guam GU GUM 316 +Guatemala GT GTM 320 +Guernsey GG GGY 831 +Guinea GN GIN 324 +Guinea-Bissau GW GNB 624 +Guyana GY GUY 328 +Haiti HT HTI 332 +Heard Island and McDonald Islands HM HMD 334 +Holy See (the) VA VAT 336 +Honduras HN HND 340 +Hong Kong HK HKG 344 +Hungary HU HUN 348 +Iceland IS ISL 352 +India IN IND 356 +Indonesia ID IDN 360 +Iran (Islamic Republic of) IR IRN 364 +Iraq IQ IRQ 368 +Ireland IE IRL 372 +Isle of Man IM IMN 833 +Israel IL ISR 376 +Italy IT ITA 380 +Jamaica JM JAM 388 +Japan JP JPN 392 +Jersey JE JEY 832 +Jordan JO JOR 400 +Kazakhstan KZ KAZ 398 +Kenya KE KEN 404 +Kiribati KI KIR 296 +Korea (the Democratic People's Republic of) KP PRK 408 +Korea (the Republic of) KR KOR 410 +Kuwait KW KWT 414 +Kyrgyzstan KG KGZ 417 +Lao People's Democratic Republic (the) LA LAO 418 +Latvia LV LVA 428 +Lebanon LB LBN 422 +Lesotho LS LSO 426 +Liberia LR LBR 430 +Libya LY LBY 434 +Liechtenstein LI LIE 438 +Lithuania LT LTU 440 +Luxembourg LU LUX 442 +Macao MO MAC 446 +Madagascar MG MDG 450 +Malawi MW MWI 454 +Malaysia MY MYS 458 +Maldives MV MDV 462 +Mali ML MLI 466 +Malta MT MLT 470 +Marshall Islands (the) MH MHL 584 +Martinique MQ MTQ 474 +Mauritania MR MRT 478 +Mauritius MU MUS 480 +Mayotte YT MYT 175 +Mexico MX MEX 484 +Micronesia (Federated States of) FM FSM 583 +Moldova (the Republic of) MD MDA 498 +Monaco MC MCO 492 +Mongolia MN MNG 496 +Montenegro ME MNE 499 +Montserrat MS MSR 500 +Morocco MA MAR 504 +Mozambique MZ MOZ 508 +Myanmar MM MMR 104 +Namibia NA NAM 516 +Nauru NR NRU 520 +Nepal NP NPL 524 +Netherlands (the) NL NLD 528 +New Caledonia NC NCL 540 +New Zealand NZ NZL 554 +Nicaragua NI NIC 558 +Niger (the) NE NER 562 +Nigeria NG NGA 566 +Niue NU NIU 570 +Norfolk Island NF NFK 574 +Northern Mariana Islands (the) MP MNP 580 +Norway NO NOR 578 +Oman OM OMN 512 +Pakistan PK PAK 586 +Palau PW PLW 585 +Palestine, State of PS PSE 275 +Panama PA PAN 591 +Papua New Guinea PG PNG 598 +Paraguay PY PRY 600 +Peru PE PER 604 +Philippines (the) PH PHL 608 +Pitcairn PN PCN 612 +Poland PL POL 616 +Portugal PT PRT 620 +Puerto Rico PR PRI 630 +Qatar QA QAT 634 +Republic of North Macedonia MK MKD 807 +Romania RO ROU 642 +Russian Federation (the) RU RUS 643 +Rwanda RW RWA 646 +Réunion RE REU 638 +Saint Barthélemy BL BLM 652 +Saint Helena, Ascension and Tristan da Cunha SH SHN 654 +Saint Kitts and Nevis KN KNA 659 +Saint Lucia LC LCA 662 +Saint Martin (French part) MF MAF 663 +Saint Pierre and Miquelon PM SPM 666 +Saint Vincent and the Grenadines VC VCT 670 +Samoa WS WSM 882 +San Marino SM SMR 674 +Sao Tome and Principe ST STP 678 +Saudi Arabia SA SAU 682 +Senegal SN SEN 686 +Serbia RS SRB 688 +Seychelles SC SYC 690 +Sierra Leone SL SLE 694 +Singapore SG SGP 702 +Sint Maarten (Dutch part) SX SXM 534 +Slovakia SK SVK 703 +Slovenia SI SVN 705 +Solomon Islands SB SLB 090 +Somalia SO SOM 706 +South Africa ZA ZAF 710 +South Georgia and the South Sandwich Islands GS SGS 239 +South Sudan SS SSD 728 +Spain ES ESP 724 +Sri Lanka LK LKA 144 +Sudan (the) SD SDN 729 +Suriname SR SUR 740 +Svalbard and Jan Mayen SJ SJM 744 +Sweden SE SWE 752 +Switzerland CH CHE 756 +Syrian Arab Republic SY SYR 760 +Taiwan (Province of China) TW TWN 158 +Tajikistan TJ TJK 762 +Tanzania, United Republic of TZ TZA 834 +Thailand TH THA 764 +Timor-Leste TL TLS 626 +Togo TG TGO 768 +Tokelau TK TKL 772 +Tonga TO TON 776 +Trinidad and Tobago TT TTO 780 +Tunisia TN TUN 788 +Turkey TR TUR 792 +Turkmenistan TM TKM 795 +Turks and Caicos Islands (the) TC TCA 796 +Tuvalu TV TUV 798 +Uganda UG UGA 800 +Ukraine UA UKR 804 +United Arab Emirates (the) AE ARE 784 +United Kingdom of Great Britain and Northern Ireland (the) GB GBR 826 +United States Minor Outlying Islands (the) UM UMI 581 +United States of America (the) US USA 840 +Uruguay UY URY 858 +Uzbekistan UZ UZB 860 +Vanuatu VU VUT 548 +Venezuela (Bolivarian Republic of) VE VEN 862 +Viet Nam VN VNM 704 +Virgin Islands (British) VG VGB 092 +Virgin Islands (U.S.) VI VIR 850 +Wallis and Futuna WF WLF 876 +Western Sahara EH ESH 732 +Yemen YE YEM 887 +Zambia ZM ZMB 894 +Zimbabwe ZW ZWE 716 +Åland Islands AX ALA 248 diff --git a/output.txt b/output.txt new file mode 100644 index 0000000..c7da936 --- /dev/null +++ b/output.txt @@ -0,0 +1,249 @@ +004 => "AF", // AF AFG 004 Afghanistan +008 => "AL", // AL ALB 008 Albania +012 => "DZ", // DZ DZA 012 Algeria +016 => "AS", // AS ASM 016 American Samoa +020 => "AD", // AD AND 020 Andorra +024 => "AO", // AO AGO 024 Angola +660 => "AI", // AI AIA 660 Anguilla +010 => "AQ", // AQ ATA 010 Antarctica +028 => "AG", // AG ATG 028 Antigua and Barbuda +032 => "AR", // AR ARG 032 Argentina +051 => "AM", // AM ARM 051 Armenia +533 => "AW", // AW ABW 533 Aruba +036 => "AU", // AU AUS 036 Australia +040 => "AT", // AT AUT 040 Austria +031 => "AZ", // AZ AZE 031 Azerbaijan +044 => "BS", // BS BHS 044 Bahamas (the) +048 => "BH", // BH BHR 048 Bahrain +050 => "BD", // BD BGD 050 Bangladesh +052 => "BB", // BB BRB 052 Barbados +112 => "BY", // BY BLR 112 Belarus +056 => "BE", // BE BEL 056 Belgium +084 => "BZ", // BZ BLZ 084 Belize +204 => "BJ", // BJ BEN 204 Benin +060 => "BM", // BM BMU 060 Bermuda +064 => "BT", // BT BTN 064 Bhutan +068 => "BO", // BO BOL 068 Bolivia (Plurinational State of) +535 => "BQ", // BQ BES 535 Bonaire, Sint Eustatius and Saba +070 => "BA", // BA BIH 070 Bosnia and Herzegovina +072 => "BW", // BW BWA 072 Botswana +074 => "BV", // BV BVT 074 Bouvet Island +076 => "BR", // BR BRA 076 Brazil +086 => "IO", // IO IOT 086 British Indian Ocean Territory (the) +096 => "BN", // BN BRN 096 Brunei Darussalam +100 => "BG", // BG BGR 100 Bulgaria +854 => "BF", // BF BFA 854 Burkina Faso +108 => "BI", // BI BDI 108 Burundi +132 => "CV", // CV CPV 132 Cabo Verde +116 => "KH", // KH KHM 116 Cambodia +120 => "CM", // CM CMR 120 Cameroon +124 => "CA", // CA CAN 124 Canada +136 => "KY", // KY CYM 136 Cayman Islands (the) +140 => "CF", // CF CAF 140 Central African Republic (the) +148 => "TD", // TD TCD 148 Chad +152 => "CL", // CL CHL 152 Chile +156 => "CN", // CN CHN 156 China +162 => "CX", // CX CXR 162 Christmas Island +166 => "CC", // CC CCK 166 Cocos (Keeling) Islands (the) +170 => "CO", // CO COL 170 Colombia +174 => "KM", // KM COM 174 Comoros (the) +180 => "CD", // CD COD 180 Congo (the Democratic Republic of the) +178 => "CG", // CG COG 178 Congo (the) +184 => "CK", // CK COK 184 Cook Islands (the) +188 => "CR", // CR CRI 188 Costa Rica +191 => "HR", // HR HRV 191 Croatia +192 => "CU", // CU CUB 192 Cuba +531 => "CW", // CW CUW 531 Curaçao +196 => "CY", // CY CYP 196 Cyprus +203 => "CZ", // CZ CZE 203 Czechia +384 => "CI", // CI CIV 384 Côte d'Ivoire +208 => "DK", // DK DNK 208 Denmark +262 => "DJ", // DJ DJI 262 Djibouti +212 => "DM", // DM DMA 212 Dominica +214 => "DO", // DO DOM 214 Dominican Republic (the) +218 => "EC", // EC ECU 218 Ecuador +818 => "EG", // EG EGY 818 Egypt +222 => "SV", // SV SLV 222 El Salvador +226 => "GQ", // GQ GNQ 226 Equatorial Guinea +232 => "ER", // ER ERI 232 Eritrea +233 => "EE", // EE EST 233 Estonia +748 => "SZ", // SZ SWZ 748 Eswatini +231 => "ET", // ET ETH 231 Ethiopia +238 => "FK", // FK FLK 238 Falkland Islands (the) [Malvinas] +234 => "FO", // FO FRO 234 Faroe Islands (the) +242 => "FJ", // FJ FJI 242 Fiji +246 => "FI", // FI FIN 246 Finland +250 => "FR", // FR FRA 250 France +254 => "GF", // GF GUF 254 French Guiana +258 => "PF", // PF PYF 258 French Polynesia +260 => "TF", // TF ATF 260 French Southern Territories (the) +266 => "GA", // GA GAB 266 Gabon +270 => "GM", // GM GMB 270 Gambia (the) +268 => "GE", // GE GEO 268 Georgia +276 => "DE", // DE DEU 276 Germany +288 => "GH", // GH GHA 288 Ghana +292 => "GI", // GI GIB 292 Gibraltar +300 => "GR", // GR GRC 300 Greece +304 => "GL", // GL GRL 304 Greenland +308 => "GD", // GD GRD 308 Grenada +312 => "GP", // GP GLP 312 Guadeloupe +316 => "GU", // GU GUM 316 Guam +320 => "GT", // GT GTM 320 Guatemala +831 => "GG", // GG GGY 831 Guernsey +324 => "GN", // GN GIN 324 Guinea +624 => "GW", // GW GNB 624 Guinea-Bissau +328 => "GY", // GY GUY 328 Guyana +332 => "HT", // HT HTI 332 Haiti +334 => "HM", // HM HMD 334 Heard Island and McDonald Islands +336 => "VA", // VA VAT 336 Holy See (the) +340 => "HN", // HN HND 340 Honduras +344 => "HK", // HK HKG 344 Hong Kong +348 => "HU", // HU HUN 348 Hungary +352 => "IS", // IS ISL 352 Iceland +356 => "IN", // IN IND 356 India +360 => "ID", // ID IDN 360 Indonesia +364 => "IR", // IR IRN 364 Iran (Islamic Republic of) +368 => "IQ", // IQ IRQ 368 Iraq +372 => "IE", // IE IRL 372 Ireland +833 => "IM", // IM IMN 833 Isle of Man +376 => "IL", // IL ISR 376 Israel +380 => "IT", // IT ITA 380 Italy +388 => "JM", // JM JAM 388 Jamaica +392 => "JP", // JP JPN 392 Japan +832 => "JE", // JE JEY 832 Jersey +400 => "JO", // JO JOR 400 Jordan +398 => "KZ", // KZ KAZ 398 Kazakhstan +404 => "KE", // KE KEN 404 Kenya +296 => "KI", // KI KIR 296 Kiribati +408 => "KP", // KP PRK 408 Korea (the Democratic People's Republic of) +410 => "KR", // KR KOR 410 Korea (the Republic of) +414 => "KW", // KW KWT 414 Kuwait +417 => "KG", // KG KGZ 417 Kyrgyzstan +418 => "LA", // LA LAO 418 Lao People's Democratic Republic (the) +428 => "LV", // LV LVA 428 Latvia +422 => "LB", // LB LBN 422 Lebanon +426 => "LS", // LS LSO 426 Lesotho +430 => "LR", // LR LBR 430 Liberia +434 => "LY", // LY LBY 434 Libya +438 => "LI", // LI LIE 438 Liechtenstein +440 => "LT", // LT LTU 440 Lithuania +442 => "LU", // LU LUX 442 Luxembourg +446 => "MO", // MO MAC 446 Macao +450 => "MG", // MG MDG 450 Madagascar +454 => "MW", // MW MWI 454 Malawi +458 => "MY", // MY MYS 458 Malaysia +462 => "MV", // MV MDV 462 Maldives +466 => "ML", // ML MLI 466 Mali +470 => "MT", // MT MLT 470 Malta +584 => "MH", // MH MHL 584 Marshall Islands (the) +474 => "MQ", // MQ MTQ 474 Martinique +478 => "MR", // MR MRT 478 Mauritania +480 => "MU", // MU MUS 480 Mauritius +175 => "YT", // YT MYT 175 Mayotte +484 => "MX", // MX MEX 484 Mexico +583 => "FM", // FM FSM 583 Micronesia (Federated States of) +498 => "MD", // MD MDA 498 Moldova (the Republic of) +492 => "MC", // MC MCO 492 Monaco +496 => "MN", // MN MNG 496 Mongolia +499 => "ME", // ME MNE 499 Montenegro +500 => "MS", // MS MSR 500 Montserrat +504 => "MA", // MA MAR 504 Morocco +508 => "MZ", // MZ MOZ 508 Mozambique +104 => "MM", // MM MMR 104 Myanmar +516 => "NA", // NA NAM 516 Namibia +520 => "NR", // NR NRU 520 Nauru +524 => "NP", // NP NPL 524 Nepal +528 => "NL", // NL NLD 528 Netherlands (the) +540 => "NC", // NC NCL 540 New Caledonia +554 => "NZ", // NZ NZL 554 New Zealand +558 => "NI", // NI NIC 558 Nicaragua +562 => "NE", // NE NER 562 Niger (the) +566 => "NG", // NG NGA 566 Nigeria +570 => "NU", // NU NIU 570 Niue +574 => "NF", // NF NFK 574 Norfolk Island +580 => "MP", // MP MNP 580 Northern Mariana Islands (the) +578 => "NO", // NO NOR 578 Norway +512 => "OM", // OM OMN 512 Oman +586 => "PK", // PK PAK 586 Pakistan +585 => "PW", // PW PLW 585 Palau +275 => "PS", // PS PSE 275 Palestine, State of +591 => "PA", // PA PAN 591 Panama +598 => "PG", // PG PNG 598 Papua New Guinea +600 => "PY", // PY PRY 600 Paraguay +604 => "PE", // PE PER 604 Peru +608 => "PH", // PH PHL 608 Philippines (the) +612 => "PN", // PN PCN 612 Pitcairn +616 => "PL", // PL POL 616 Poland +620 => "PT", // PT PRT 620 Portugal +630 => "PR", // PR PRI 630 Puerto Rico +634 => "QA", // QA QAT 634 Qatar +807 => "MK", // MK MKD 807 Republic of North Macedonia +642 => "RO", // RO ROU 642 Romania +643 => "RU", // RU RUS 643 Russian Federation (the) +646 => "RW", // RW RWA 646 Rwanda +638 => "RE", // RE REU 638 Réunion +652 => "BL", // BL BLM 652 Saint Barthélemy +654 => "SH", // SH SHN 654 Saint Helena, Ascension and Tristan da Cunha +659 => "KN", // KN KNA 659 Saint Kitts and Nevis +662 => "LC", // LC LCA 662 Saint Lucia +663 => "MF", // MF MAF 663 Saint Martin (French part) +666 => "PM", // PM SPM 666 Saint Pierre and Miquelon +670 => "VC", // VC VCT 670 Saint Vincent and the Grenadines +882 => "WS", // WS WSM 882 Samoa +674 => "SM", // SM SMR 674 San Marino +678 => "ST", // ST STP 678 Sao Tome and Principe +682 => "SA", // SA SAU 682 Saudi Arabia +686 => "SN", // SN SEN 686 Senegal +688 => "RS", // RS SRB 688 Serbia +690 => "SC", // SC SYC 690 Seychelles +694 => "SL", // SL SLE 694 Sierra Leone +702 => "SG", // SG SGP 702 Singapore +534 => "SX", // SX SXM 534 Sint Maarten (Dutch part) +703 => "SK", // SK SVK 703 Slovakia +705 => "SI", // SI SVN 705 Slovenia +090 => "SB", // SB SLB 090 Solomon Islands +706 => "SO", // SO SOM 706 Somalia +710 => "ZA", // ZA ZAF 710 South Africa +239 => "GS", // GS SGS 239 South Georgia and the South Sandwich Islands +728 => "SS", // SS SSD 728 South Sudan +724 => "ES", // ES ESP 724 Spain +144 => "LK", // LK LKA 144 Sri Lanka +729 => "SD", // SD SDN 729 Sudan (the) +740 => "SR", // SR SUR 740 Suriname +744 => "SJ", // SJ SJM 744 Svalbard and Jan Mayen +752 => "SE", // SE SWE 752 Sweden +756 => "CH", // CH CHE 756 Switzerland +760 => "SY", // SY SYR 760 Syrian Arab Republic +158 => "TW", // TW TWN 158 Taiwan (Province of China) +762 => "TJ", // TJ TJK 762 Tajikistan +834 => "TZ", // TZ TZA 834 Tanzania, United Republic of +764 => "TH", // TH THA 764 Thailand +626 => "TL", // TL TLS 626 Timor-Leste +768 => "TG", // TG TGO 768 Togo +772 => "TK", // TK TKL 772 Tokelau +776 => "TO", // TO TON 776 Tonga +780 => "TT", // TT TTO 780 Trinidad and Tobago +788 => "TN", // TN TUN 788 Tunisia +792 => "TR", // TR TUR 792 Turkey +795 => "TM", // TM TKM 795 Turkmenistan +796 => "TC", // TC TCA 796 Turks and Caicos Islands (the) +798 => "TV", // TV TUV 798 Tuvalu +800 => "UG", // UG UGA 800 Uganda +804 => "UA", // UA UKR 804 Ukraine +784 => "AE", // AE ARE 784 United Arab Emirates (the) +826 => "GB", // GB GBR 826 United Kingdom of Great Britain and Northern Ireland (the) +581 => "UM", // UM UMI 581 United States Minor Outlying Islands (the) +840 => "US", // US USA 840 United States of America (the) +858 => "UY", // UY URY 858 Uruguay +860 => "UZ", // UZ UZB 860 Uzbekistan +548 => "VU", // VU VUT 548 Vanuatu +862 => "VE", // VE VEN 862 Venezuela (Bolivarian Republic of) +704 => "VN", // VN VNM 704 Viet Nam +092 => "VG", // VG VGB 092 Virgin Islands (British) +850 => "VI", // VI VIR 850 Virgin Islands (U.S.) +876 => "WF", // WF WLF 876 Wallis and Futuna +732 => "EH", // EH ESH 732 Western Sahara +887 => "YE", // YE YEM 887 Yemen +894 => "ZM", // ZM ZMB 894 Zambia +716 => "ZW", // ZW ZWE 716 Zimbabwe +248 => "AX", // AX ALA 248 Åland Islands diff --git a/rearanged.txt b/rearanged.txt new file mode 100644 index 0000000..287733b --- /dev/null +++ b/rearanged.txt @@ -0,0 +1,249 @@ +AF AFG 004 Afghanistan +AL ALB 008 Albania +DZ DZA 012 Algeria +AS ASM 016 American Samoa +AD AND 020 Andorra +AO AGO 024 Angola +AI AIA 660 Anguilla +AQ ATA 010 Antarctica +AG ATG 028 Antigua and Barbuda +AR ARG 032 Argentina +AM ARM 051 Armenia +AW ABW 533 Aruba +AU AUS 036 Australia +AT AUT 040 Austria +AZ AZE 031 Azerbaijan +BS BHS 044 Bahamas (the) +BH BHR 048 Bahrain +BD BGD 050 Bangladesh +BB BRB 052 Barbados +BY BLR 112 Belarus +BE BEL 056 Belgium +BZ BLZ 084 Belize +BJ BEN 204 Benin +BM BMU 060 Bermuda +BT BTN 064 Bhutan +BO BOL 068 Bolivia (Plurinational State of) +BQ BES 535 Bonaire, Sint Eustatius and Saba +BA BIH 070 Bosnia and Herzegovina +BW BWA 072 Botswana +BV BVT 074 Bouvet Island +BR BRA 076 Brazil +IO IOT 086 British Indian Ocean Territory (the) +BN BRN 096 Brunei Darussalam +BG BGR 100 Bulgaria +BF BFA 854 Burkina Faso +BI BDI 108 Burundi +CV CPV 132 Cabo Verde +KH KHM 116 Cambodia +CM CMR 120 Cameroon +CA CAN 124 Canada +KY CYM 136 Cayman Islands (the) +CF CAF 140 Central African Republic (the) +TD TCD 148 Chad +CL CHL 152 Chile +CN CHN 156 China +CX CXR 162 Christmas Island +CC CCK 166 Cocos (Keeling) Islands (the) +CO COL 170 Colombia +KM COM 174 Comoros (the) +CD COD 180 Congo (the Democratic Republic of the) +CG COG 178 Congo (the) +CK COK 184 Cook Islands (the) +CR CRI 188 Costa Rica +HR HRV 191 Croatia +CU CUB 192 Cuba +CW CUW 531 Curaçao +CY CYP 196 Cyprus +CZ CZE 203 Czechia +CI CIV 384 Côte d'Ivoire +DK DNK 208 Denmark +DJ DJI 262 Djibouti +DM DMA 212 Dominica +DO DOM 214 Dominican Republic (the) +EC ECU 218 Ecuador +EG EGY 818 Egypt +SV SLV 222 El Salvador +GQ GNQ 226 Equatorial Guinea +ER ERI 232 Eritrea +EE EST 233 Estonia +SZ SWZ 748 Eswatini +ET ETH 231 Ethiopia +FK FLK 238 Falkland Islands (the) [Malvinas] +FO FRO 234 Faroe Islands (the) +FJ FJI 242 Fiji +FI FIN 246 Finland +FR FRA 250 France +GF GUF 254 French Guiana +PF PYF 258 French Polynesia +TF ATF 260 French Southern Territories (the) +GA GAB 266 Gabon +GM GMB 270 Gambia (the) +GE GEO 268 Georgia +DE DEU 276 Germany +GH GHA 288 Ghana +GI GIB 292 Gibraltar +GR GRC 300 Greece +GL GRL 304 Greenland +GD GRD 308 Grenada +GP GLP 312 Guadeloupe +GU GUM 316 Guam +GT GTM 320 Guatemala +GG GGY 831 Guernsey +GN GIN 324 Guinea +GW GNB 624 Guinea-Bissau +GY GUY 328 Guyana +HT HTI 332 Haiti +HM HMD 334 Heard Island and McDonald Islands +VA VAT 336 Holy See (the) +HN HND 340 Honduras +HK HKG 344 Hong Kong +HU HUN 348 Hungary +IS ISL 352 Iceland +IN IND 356 India +ID IDN 360 Indonesia +IR IRN 364 Iran (Islamic Republic of) +IQ IRQ 368 Iraq +IE IRL 372 Ireland +IM IMN 833 Isle of Man +IL ISR 376 Israel +IT ITA 380 Italy +JM JAM 388 Jamaica +JP JPN 392 Japan +JE JEY 832 Jersey +JO JOR 400 Jordan +KZ KAZ 398 Kazakhstan +KE KEN 404 Kenya +KI KIR 296 Kiribati +KP PRK 408 Korea (the Democratic People's Republic of) +KR KOR 410 Korea (the Republic of) +KW KWT 414 Kuwait +KG KGZ 417 Kyrgyzstan +LA LAO 418 Lao People's Democratic Republic (the) +LV LVA 428 Latvia +LB LBN 422 Lebanon +LS LSO 426 Lesotho +LR LBR 430 Liberia +LY LBY 434 Libya +LI LIE 438 Liechtenstein +LT LTU 440 Lithuania +LU LUX 442 Luxembourg +MO MAC 446 Macao +MG MDG 450 Madagascar +MW MWI 454 Malawi +MY MYS 458 Malaysia +MV MDV 462 Maldives +ML MLI 466 Mali +MT MLT 470 Malta +MH MHL 584 Marshall Islands (the) +MQ MTQ 474 Martinique +MR MRT 478 Mauritania +MU MUS 480 Mauritius +YT MYT 175 Mayotte +MX MEX 484 Mexico +FM FSM 583 Micronesia (Federated States of) +MD MDA 498 Moldova (the Republic of) +MC MCO 492 Monaco +MN MNG 496 Mongolia +ME MNE 499 Montenegro +MS MSR 500 Montserrat +MA MAR 504 Morocco +MZ MOZ 508 Mozambique +MM MMR 104 Myanmar +NA NAM 516 Namibia +NR NRU 520 Nauru +NP NPL 524 Nepal +NL NLD 528 Netherlands (the) +NC NCL 540 New Caledonia +NZ NZL 554 New Zealand +NI NIC 558 Nicaragua +NE NER 562 Niger (the) +NG NGA 566 Nigeria +NU NIU 570 Niue +NF NFK 574 Norfolk Island +MP MNP 580 Northern Mariana Islands (the) +NO NOR 578 Norway +OM OMN 512 Oman +PK PAK 586 Pakistan +PW PLW 585 Palau +PS PSE 275 Palestine, State of +PA PAN 591 Panama +PG PNG 598 Papua New Guinea +PY PRY 600 Paraguay +PE PER 604 Peru +PH PHL 608 Philippines (the) +PN PCN 612 Pitcairn +PL POL 616 Poland +PT PRT 620 Portugal +PR PRI 630 Puerto Rico +QA QAT 634 Qatar +MK MKD 807 Republic of North Macedonia +RO ROU 642 Romania +RU RUS 643 Russian Federation (the) +RW RWA 646 Rwanda +RE REU 638 Réunion +BL BLM 652 Saint Barthélemy +SH SHN 654 Saint Helena, Ascension and Tristan da Cunha +KN KNA 659 Saint Kitts and Nevis +LC LCA 662 Saint Lucia +MF MAF 663 Saint Martin (French part) +PM SPM 666 Saint Pierre and Miquelon +VC VCT 670 Saint Vincent and the Grenadines +WS WSM 882 Samoa +SM SMR 674 San Marino +ST STP 678 Sao Tome and Principe +SA SAU 682 Saudi Arabia +SN SEN 686 Senegal +RS SRB 688 Serbia +SC SYC 690 Seychelles +SL SLE 694 Sierra Leone +SG SGP 702 Singapore +SX SXM 534 Sint Maarten (Dutch part) +SK SVK 703 Slovakia +SI SVN 705 Slovenia +SB SLB 090 Solomon Islands +SO SOM 706 Somalia +ZA ZAF 710 South Africa +GS SGS 239 South Georgia and the South Sandwich Islands +SS SSD 728 South Sudan +ES ESP 724 Spain +LK LKA 144 Sri Lanka +SD SDN 729 Sudan (the) +SR SUR 740 Suriname +SJ SJM 744 Svalbard and Jan Mayen +SE SWE 752 Sweden +CH CHE 756 Switzerland +SY SYR 760 Syrian Arab Republic +TW TWN 158 Taiwan (Province of China) +TJ TJK 762 Tajikistan +TZ TZA 834 Tanzania, United Republic of +TH THA 764 Thailand +TL TLS 626 Timor-Leste +TG TGO 768 Togo +TK TKL 772 Tokelau +TO TON 776 Tonga +TT TTO 780 Trinidad and Tobago +TN TUN 788 Tunisia +TR TUR 792 Turkey +TM TKM 795 Turkmenistan +TC TCA 796 Turks and Caicos Islands (the) +TV TUV 798 Tuvalu +UG UGA 800 Uganda +UA UKR 804 Ukraine +AE ARE 784 United Arab Emirates (the) +GB GBR 826 United Kingdom of Great Britain and Northern Ireland (the) +UM UMI 581 United States Minor Outlying Islands (the) +US USA 840 United States of America (the) +UY URY 858 Uruguay +UZ UZB 860 Uzbekistan +VU VUT 548 Vanuatu +VE VEN 862 Venezuela (Bolivarian Republic of) +VN VNM 704 Viet Nam +VG VGB 092 Virgin Islands (British) +VI VIR 850 Virgin Islands (U.S.) +WF WLF 876 Wallis and Futuna +EH ESH 732 Western Sahara +YE YEM 887 Yemen +ZM ZMB 894 Zambia +ZW ZWE 716 Zimbabwe +AX ALA 248 Åland Islands diff --git a/src/lib.rs b/src/lib.rs index 49ce2d0..0229d47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,6 +122,9 @@ pub type Result = std::result::Result; /// Region code for a [`Language`] dialect /// /// Uses +/// +/// https://www.suny.edu/media/suny/content-assets/documents/international-student/InternationalCountryCodes.pdf +/// https://www.iban.com/country-codes #[non_exhaustive] #[repr(u32)] #[derive(Copy, Clone, Eq, PartialEq, Debug)] @@ -130,16 +133,1522 @@ pub enum Region { // FIXME: Add aliases up to 3-4 letters, but hidden /// Any dialect Any, - /// `US`: United States of America + + /// an u32 code for region + #[doc(hidden)] + Custom(u32), + + /// `AF`: Afghanistan + #[doc(hidden)] + Af, + + /// `AL`: Albania + #[doc(hidden)] + Al, + + /// `DZ`: Algeria + #[doc(hidden)] + Dz, + + /// `AS`: American Samoa + #[doc(hidden)] + As, + + /// `AD`: Andorra + #[doc(hidden)] + Ad, + + /// `AO`: Angola + #[doc(hidden)] + Ao, + + /// `AI`: Anguilla + #[doc(hidden)] + Ai, + + /// `AQ`: Antarctica + #[doc(hidden)] + Aq, + + /// `AG`: Antigua and Barbuda + #[doc(hidden)] + Ag, + + /// `AR`: Argentina + #[doc(hidden)] + Ar, + + /// `AM`: Armenia + #[doc(hidden)] + Am, + + /// `AW`: Aruba + #[doc(hidden)] + Aw, + + /// `AU`: Australia + #[doc(hidden)] + Au, + + /// `AT`: Austria + #[doc(hidden)] + At, + + /// `AZ`: Azerbaijan + #[doc(hidden)] + Az, + + /// `BS`: Bahamas (the) + #[doc(hidden)] + Bs, + + /// `BH`: Bahrain + #[doc(hidden)] + Bh, + + /// `BD`: Bangladesh + #[doc(hidden)] + Bd, + + /// `BB`: Barbados + #[doc(hidden)] + Bb, + + /// `BY`: Belarus + #[doc(hidden)] + By, + + /// `BE`: Belgium + #[doc(hidden)] + Be, + + /// `BZ`: Belize + #[doc(hidden)] + Bz, + + /// `BJ`: Benin + #[doc(hidden)] + Bj, + + /// `BM`: Bermuda + #[doc(hidden)] + Bm, + + /// `BT`: Bhutan + #[doc(hidden)] + Bt, + + /// `BO`: Bolivia (Plurinational State of) + #[doc(hidden)] + Bo, + + /// `BQ`: Bonaire, Sint Eustatius and Saba + #[doc(hidden)] + Bq, + + /// `BA`: Bosnia and Herzegovina + #[doc(hidden)] + Ba, + + /// `BW`: Botswana + #[doc(hidden)] + Bw, + + /// `BV`: Bouvet Island + #[doc(hidden)] + Bv, + + /// `BR`: Brazil + #[doc(hidden)] + Br, + + /// `IO`: British Indian Ocean Territory (the) + #[doc(hidden)] + Io, + + /// `BN`: Brunei Darussalam + #[doc(hidden)] + Bn, + + /// `BG`: Bulgaria + #[doc(hidden)] + Bg, + + /// `BF`: Burkina Faso + #[doc(hidden)] + Bf, + + /// `BI`: Burundi + #[doc(hidden)] + Bi, + + /// `CV`: Cabo Verde + #[doc(hidden)] + Cv, + + /// `KH`: Cambodia + #[doc(hidden)] + Kh, + + /// `CM`: Cameroon + #[doc(hidden)] + Cm, + + /// `CA`: Canada + #[doc(hidden)] + Ca, + + /// `KY`: Cayman Islands (the) + #[doc(hidden)] + Ky, + + /// `CF`: Central African Republic (the) + #[doc(hidden)] + Cf, + + /// `TD`: Chad + #[doc(hidden)] + Td, + + /// `CL`: Chile + #[doc(hidden)] + Cl, + + /// `CN`: China + #[doc(hidden)] + Cn, + + /// `CX`: Christmas Island + #[doc(hidden)] + Cx, + + /// `CC`: Cocos (Keeling) Islands (the) + #[doc(hidden)] + Cc, + + /// `CO`: Colombia + #[doc(hidden)] + Co, + + /// `KM`: Comoros (the) + #[doc(hidden)] + Km, + + /// `CD`: Congo (the Democratic Republic of the) + #[doc(hidden)] + Cd, + + /// `CG`: Congo (the) + #[doc(hidden)] + Cg, + + /// `CK`: Cook Islands (the) + #[doc(hidden)] + Ck, + + /// `CR`: Costa Rica + #[doc(hidden)] + Cr, + + /// `HR`: Croatia + #[doc(hidden)] + Hr, + + /// `CU`: Cuba + #[doc(hidden)] + Cu, + + /// `CW`: Curaçao + #[doc(hidden)] + Cw, + + /// `CY`: Cyprus + #[doc(hidden)] + Cy, + + /// `CZ`: Czechia + #[doc(hidden)] + Cz, + + /// `CI`: Côte d'Ivoire + #[doc(hidden)] + Ci, + + /// `DK`: Denmark + #[doc(hidden)] + Dk, + + /// `DJ`: Djibouti + #[doc(hidden)] + Dj, + + /// `DM`: Dominica + #[doc(hidden)] + Dm, + + /// `DO`: Dominican Republic (the) + #[doc(hidden)] + Do, + + /// `EC`: Ecuador + #[doc(hidden)] + Ec, + + /// `EG`: Egypt + #[doc(hidden)] + Eg, + + /// `SV`: El Salvador + #[doc(hidden)] + Sv, + + /// `GQ`: Equatorial Guinea + #[doc(hidden)] + Gq, + + /// `ER`: Eritrea + #[doc(hidden)] + Er, + + /// `EE`: Estonia + #[doc(hidden)] + Ee, + + /// `SZ`: Eswatini + #[doc(hidden)] + Sz, + + /// `ET`: Ethiopia + #[doc(hidden)] + Et, + + /// `FK`: Falkland Islands (the) [Malvinas] + #[doc(hidden)] + Fk, + + /// `FO`: Faroe Islands (the) + #[doc(hidden)] + Fo, + + /// `FJ`: Fiji + #[doc(hidden)] + Fj, + + /// `FI`: Finland + #[doc(hidden)] + Fi, + + /// `FR`: France + #[doc(hidden)] + Fr, + + /// `GF`: French Guiana + #[doc(hidden)] + Gf, + + /// `PF`: French Polynesia + #[doc(hidden)] + Pf, + + /// `TF`: French Southern Territories (the) + #[doc(hidden)] + Tf, + + /// `GA`: Gabon + #[doc(hidden)] + Ga, + + /// `GM`: Gambia (the) + #[doc(hidden)] + Gm, + + /// `GE`: Georgia + #[doc(hidden)] + Ge, + + /// `DE`: Germany + #[doc(hidden)] + De, + + /// `GH`: Ghana + #[doc(hidden)] + Gh, + + /// `GI`: Gibraltar + #[doc(hidden)] + Gi, + + /// `GR`: Greece + #[doc(hidden)] + Gr, + + /// `GL`: Greenland + #[doc(hidden)] + Gl, + + /// `GD`: Grenada + #[doc(hidden)] + Gd, + + /// `GP`: Guadeloupe + #[doc(hidden)] + Gp, + + /// `GU`: Guam + #[doc(hidden)] + Gu, + + /// `GT`: Guatemala + #[doc(hidden)] + Gt, + + /// `GG`: Guernsey + #[doc(hidden)] + Gg, + + /// `GN`: Guinea + #[doc(hidden)] + Gn, + + /// `GW`: Guinea-Bissau + #[doc(hidden)] + Gw, + + /// `GY`: Guyana + #[doc(hidden)] + Gy, + + /// `HT`: Haiti + #[doc(hidden)] + Ht, + + /// `HM`: Heard Island and McDonald Islands + #[doc(hidden)] + Hm, + + /// `VA`: Holy See (the) + #[doc(hidden)] + Va, + + /// `HN`: Honduras + #[doc(hidden)] + Hn, + + /// `HK`: Hong Kong + #[doc(hidden)] + Hk, + + /// `HU`: Hungary + #[doc(hidden)] + Hu, + + /// `IS`: Iceland + #[doc(hidden)] + Is, + + /// `IN`: India + #[doc(hidden)] + In, + + /// `ID`: Indonesia + #[doc(hidden)] + Id, + + /// `IR`: Iran (Islamic Republic of) + #[doc(hidden)] + Ir, + + /// `IQ`: Iraq + #[doc(hidden)] + Iq, + + /// `IE`: Ireland + #[doc(hidden)] + Ie, + + /// `IM`: Isle of Man + #[doc(hidden)] + Im, + + /// `IL`: Israel + #[doc(hidden)] + Il, + + /// `IT`: Italy + #[doc(hidden)] + It, + + /// `JM`: Jamaica + #[doc(hidden)] + Jm, + + /// `JP`: Japan + #[doc(hidden)] + Jp, + + /// `JE`: Jersey + #[doc(hidden)] + Je, + + /// `JO`: Jordan + #[doc(hidden)] + Jo, + + /// `KZ`: Kazakhstan + #[doc(hidden)] + Kz, + + /// `KE`: Kenya + #[doc(hidden)] + Ke, + + /// `KI`: Kiribati + #[doc(hidden)] + Ki, + + /// `KP`: Korea (the Democratic People's Republic of) + #[doc(hidden)] + Kp, + + /// `KR`: Korea (the Republic of) + #[doc(hidden)] + Kr, + + /// `KW`: Kuwait + #[doc(hidden)] + Kw, + + /// `KG`: Kyrgyzstan + #[doc(hidden)] + Kg, + + /// `LA`: Lao People's Democratic Republic (the) + #[doc(hidden)] + La, + + /// `LV`: Latvia + #[doc(hidden)] + Lv, + + /// `LB`: Lebanon + #[doc(hidden)] + Lb, + + /// `LS`: Lesotho + #[doc(hidden)] + Ls, + + /// `LR`: Liberia + #[doc(hidden)] + Lr, + + /// `LY`: Libya + #[doc(hidden)] + Ly, + + /// `LI`: Liechtenstein + #[doc(hidden)] + Li, + + /// `LT`: Lithuania + #[doc(hidden)] + Lt, + + /// `LU`: Luxembourg + #[doc(hidden)] + Lu, + + /// `MO`: Macao + #[doc(hidden)] + Mo, + + /// `MG`: Madagascar + #[doc(hidden)] + Mg, + + /// `MW`: Malawi + #[doc(hidden)] + Mw, + + /// `MY`: Malaysia + #[doc(hidden)] + My, + + /// `MV`: Maldives + #[doc(hidden)] + Mv, + + /// `ML`: Mali + #[doc(hidden)] + Ml, + + /// `MT`: Malta + #[doc(hidden)] + Mt, + + /// `MH`: Marshall Islands (the) + #[doc(hidden)] + Mh, + + /// `MQ`: Martinique + #[doc(hidden)] + Mq, + + /// `MR`: Mauritania + #[doc(hidden)] + Mr, + + /// `MU`: Mauritius + #[doc(hidden)] + Mu, + + /// `YT`: Mayotte + #[doc(hidden)] + Yt, + + /// `MX`: Mexico + #[doc(hidden)] + Mx, + + /// `FM`: Micronesia (Federated States of) + #[doc(hidden)] + Fm, + + /// `MD`: Moldova (the Republic of) + #[doc(hidden)] + Md, + + /// `MC`: Monaco + #[doc(hidden)] + Mc, + + /// `MN`: Mongolia + #[doc(hidden)] + Mn, + + /// `ME`: Montenegro + #[doc(hidden)] + Me, + + /// `MS`: Montserrat + #[doc(hidden)] + Ms, + + /// `MA`: Morocco + #[doc(hidden)] + Ma, + + /// `MZ`: Mozambique + #[doc(hidden)] + Mz, + + /// `MM`: Myanmar + #[doc(hidden)] + Mm, + + /// `NA`: Namibia + #[doc(hidden)] + Na, + + /// `NR`: Nauru + #[doc(hidden)] + Nr, + + /// `NP`: Nepal + #[doc(hidden)] + Np, + + /// `NL`: Netherlands (the) + #[doc(hidden)] + Nl, + + /// `NC`: New Caledonia + #[doc(hidden)] + Nc, + + /// `NZ`: New Zealand + #[doc(hidden)] + Nz, + + /// `NI`: Nicaragua + #[doc(hidden)] + Ni, + + /// `NE`: Niger (the) + #[doc(hidden)] + Ne, + + /// `NG`: Nigeria + #[doc(hidden)] + Ng, + + /// `NU`: Niue + #[doc(hidden)] + Nu, + + /// `NF`: Norfolk Island + #[doc(hidden)] + Nf, + + /// `MP`: Northern Mariana Islands (the) + #[doc(hidden)] + Mp, + + /// `NO`: Norway + #[doc(hidden)] + No, + + /// `OM`: Oman + #[doc(hidden)] + Om, + + /// `PK`: Pakistan + #[doc(hidden)] + Pk, + + /// `PW`: Palau + #[doc(hidden)] + Pw, + + /// `PS`: Palestine, State of + #[doc(hidden)] + Ps, + + /// `PA`: Panama + #[doc(hidden)] + Pa, + + /// `PG`: Papua New Guinea + #[doc(hidden)] + Pg, + + /// `PY`: Paraguay + #[doc(hidden)] + Py, + + /// `PE`: Peru + #[doc(hidden)] + Pe, + + /// `PH`: Philippines (the) + #[doc(hidden)] + Ph, + + /// `PN`: Pitcairn + #[doc(hidden)] + Pn, + + /// `PL`: Poland + #[doc(hidden)] + Pl, + + /// `PT`: Portugal + #[doc(hidden)] + Pt, + + /// `PR`: Puerto Rico + #[doc(hidden)] + Pr, + + /// `QA`: Qatar + #[doc(hidden)] + Qa, + + /// `MK`: Republic of North Macedonia + #[doc(hidden)] + Mk, + + /// `RO`: Romania + #[doc(hidden)] + Ro, + + /// `RU`: Russian Federation (the) + #[doc(hidden)] + Ru, + + /// `RW`: Rwanda + #[doc(hidden)] + Rw, + + /// `RE`: Réunion + #[doc(hidden)] + Re, + + /// `BL`: Saint Barthélemy + #[doc(hidden)] + Bl, + + /// `SH`: Saint Helena, Ascension and Tristan da Cunha + #[doc(hidden)] + Sh, + + /// `KN`: Saint Kitts and Nevis + #[doc(hidden)] + Kn, + + /// `LC`: Saint Lucia + #[doc(hidden)] + Lc, + + /// `MF`: Saint Martin (French part) + #[doc(hidden)] + Mf, + + /// `PM`: Saint Pierre and Miquelon + #[doc(hidden)] + Pm, + + /// `VC`: Saint Vincent and the Grenadines + #[doc(hidden)] + Vc, + + /// `WS`: Samoa + #[doc(hidden)] + Ws, + + /// `SM`: San Marino + #[doc(hidden)] + Sm, + + /// `ST`: Sao Tome and Principe + #[doc(hidden)] + St, + + /// `SA`: Saudi Arabia + #[doc(hidden)] + Sa, + + /// `SN`: Senegal + #[doc(hidden)] + Sn, + + /// `RS`: Serbia + #[doc(hidden)] + Rs, + + /// `SC`: Seychelles + #[doc(hidden)] + Sc, + + /// `SL`: Sierra Leone + #[doc(hidden)] + Sl, + + /// `SG`: Singapore + #[doc(hidden)] + Sg, + + /// `SX`: Sint Maarten (Dutch part) + #[doc(hidden)] + Sx, + + /// `SK`: Slovakia + #[doc(hidden)] + Sk, + + /// `SI`: Slovenia + #[doc(hidden)] + Si, + + /// `SB`: Solomon Islands + #[doc(hidden)] + Sb, + + /// `SO`: Somalia + #[doc(hidden)] + So, + + /// `ZA`: South Africa + #[doc(hidden)] + Za, + + /// `GS`: South Georgia and the South Sandwich Islands + #[doc(hidden)] + Gs, + + /// `SS`: South Sudan + #[doc(hidden)] + Ss, + + /// `ES`: Spain + #[doc(hidden)] + Es, + + /// `LK`: Sri Lanka + #[doc(hidden)] + Lk, + + /// `SD`: Sudan (the) + #[doc(hidden)] + Sd, + + /// `SR`: Suriname + #[doc(hidden)] + Sr, + + /// `SJ`: Svalbard and Jan Mayen + #[doc(hidden)] + Sj, + + /// `SE`: Sweden + #[doc(hidden)] + Se, + + /// `CH`: Switzerland + #[doc(hidden)] + Ch, + + /// `SY`: Syrian Arab Republic + #[doc(hidden)] + Sy, + + /// `TW`: Taiwan (Province of China) + #[doc(hidden)] + Tw, + + /// `TJ`: Tajikistan + #[doc(hidden)] + Tj, + + /// `TZ`: Tanzania, United Republic of + #[doc(hidden)] + Tz, + + /// `TH`: Thailand + #[doc(hidden)] + Th, + + /// `TL`: Timor-Leste + #[doc(hidden)] + Tl, + + /// `TG`: Togo + #[doc(hidden)] + Tg, + + /// `TK`: Tokelau + #[doc(hidden)] + Tk, + + /// `TO`: Tonga + #[doc(hidden)] + To, + + /// `TT`: Trinidad and Tobago + #[doc(hidden)] + Tt, + + /// `TN`: Tunisia + #[doc(hidden)] + Tn, + + /// `TR`: Turkey + #[doc(hidden)] + Tr, + + /// `TM`: Turkmenistan + #[doc(hidden)] + Tm, + + /// `TC`: Turks and Caicos Islands (the) + #[doc(hidden)] + Tc, + + /// `TV`: Tuvalu + #[doc(hidden)] + Tv, + + /// `UG`: Uganda + #[doc(hidden)] + Ug, + + /// `UA`: Ukraine + #[doc(hidden)] + Ua, + + /// `AE`: United Arab Emirates (the) + #[doc(hidden)] + Ae, + + /// `GB`: United Kingdom of Great Britain and Northern Ireland (the) + #[doc(hidden)] + Gb, + + /// `UM`: United States Minor Outlying Islands (the) + #[doc(hidden)] + Um, + + /// `US`: United States of America (the) #[doc(hidden)] Us, + + /// `UY`: Uruguay + #[doc(hidden)] + Uy, + + /// `UZ`: Uzbekistan + #[doc(hidden)] + Uz, + + /// `VU`: Vanuatu + #[doc(hidden)] + Vu, + + /// `VE`: Venezuela (Bolivarian Republic of) + #[doc(hidden)] + Ve, + + /// `VN`: Viet Nam + #[doc(hidden)] + Vn, + + /// `VG`: Virgin Islands (British) + #[doc(hidden)] + Vg, + + /// `VI`: Virgin Islands (U.S.) + #[doc(hidden)] + Vi, + + /// `WF`: Wallis and Futuna + #[doc(hidden)] + Wf, + + /// `EH`: Western Sahara + #[doc(hidden)] + Eh, + + /// `YE`: Yemen + #[doc(hidden)] + Ye, + + /// `ZM`: Zambia + #[doc(hidden)] + Zm, + + /// `ZW`: Zimbabwe + #[doc(hidden)] + Zw, + + /// `AX`: Åland Islands + #[doc(hidden)] + Ax, + } impl Display for Region { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.write_str(match self { + // Self is a instance of Region Self::Any => "**", - Self::Us => "US", + + // https://www.iban.com/country-codes + Region::Custom(value) => { + match value { + 004 => "AF", // Afghanistan + 008 => "AL", // Albania + 012 => "DZ", // Algeria + 016 => "AS", // American Samoa + 020 => "AD", // Andorra + 024 => "AO", // Angola + 660 => "AI", // Anguilla + 010 => "AQ", // Antarctica + 028 => "AG", // Antigua and Barbuda + 032 => "AR", // Argentina + 051 => "AM", // Armenia + 533 => "AW", // Aruba + 036 => "AU", // Australia + 040 => "AT", // Austria + 031 => "AZ", // Azerbaijan + 044 => "BS", // Bahamas (the) + 048 => "BH", // Bahrain + 050 => "BD", // Bangladesh + 052 => "BB", // Barbados + 112 => "BY", // Belarus + 056 => "BE", // Belgium + 084 => "BZ", // Belize + 204 => "BJ", // Benin + 060 => "BM", // BM BMU 060 Besrmuda + 064 => "BT", // BT BTN 064 Bhutan + 068 => "BO", // BO BOL 068 Bolivia (Plurinational State of) + 535 => "BQ", // BQ BES 535 Bonaire, Sint Eustatius and Saba + 070 => "BA", // BA BIH 070 Bosnia and Herzegovina + 072 => "BW", // BW BWA 072 Botswana + 074 => "BV", // BV BVT 074 Bouvet Island + 076 => "BR", // BR BRA 076 Brazil + 086 => "IO", // IO IOT 086 British Indian Ocean Territory (the) + 096 => "BN", // BN BRN 096 Brunei Darussalam + 100 => "BG", // BG BGR 100 Bulgaria + 854 => "BF", // BF BFA 854 Burkina Faso + 108 => "BI", // BI BDI 108 Burundi + 132 => "CV", // CV CPV 132 Cabo Verde + 116 => "KH", // KH KHM 116 Cambodia + 120 => "CM", // CM CMR 120 Cameroon + 124 => "CA", // CA CAN 124 Canada + 136 => "KY", // KY CYM 136 Cayman Islands (the) + 140 => "CF", // CF CAF 140 Central African Republic (the) + 148 => "TD", // TD TCD 148 Chad + 152 => "CL", // CL CHL 152 Chile + 156 => "CN", // CN CHN 156 China + 162 => "CX", // CX CXR 162 Christmas Island + 166 => "CC", // CC CCK 166 Cocos (Keeling) Islands (the) + 170 => "CO", // CO COL 170 Colombia + 174 => "KM", // KM COM 174 Comoros (the) + 180 => "CD", // CD COD 180 Congo (the Democratic Republic of the) + 178 => "CG", // CG COG 178 Congo (the) + 184 => "CK", // CK COK 184 Cook Islands (the) + 188 => "CR", // CR CRI 188 Costa Rica + 191 => "HR", // HR HRV 191 Croatia + 192 => "CU", // CU CUB 192 Cuba + 531 => "CW", // CW CUW 531 Curaçao + 196 => "CY", // CY CYP 196 Cyprus + 203 => "CZ", // CZ CZE 203 Czechia + 384 => "CI", // CI CIV 384 Côte d'Ivoire + 208 => "DK", // DK DNK 208 Denmark + 262 => "DJ", // DJ DJI 262 Djibouti + 212 => "DM", // DM DMA 212 Dominica + 214 => "DO", // DO DOM 214 Dominican Republic (the) + 218 => "EC", // EC ECU 218 Ecuador + 818 => "EG", // EG EGY 818 Egypt + 222 => "SV", // SV SLV 222 El Salvador + 226 => "GQ", // GQ GNQ 226 Equatorial Guinea + 232 => "ER", // ER ERI 232 Eritrea + 233 => "EE", // EE EST 233 Estonia + 748 => "SZ", // SZ SWZ 748 Eswatini + 231 => "ET", // ET ETH 231 Ethiopia + 238 => "FK", // FK FLK 238 Falkland Islands (the) [Malvinas] + 234 => "FO", // FO FRO 234 Faroe Islands (the) + 242 => "FJ", // FJ FJI 242 Fiji + 246 => "FI", // FI FIN 246 Finland + 250 => "FR", // FR FRA 250 France + 254 => "GF", // GF GUF 254 French Guiana + 258 => "PF", // PF PYF 258 French Polynesia + 260 => "TF", // TF ATF 260 French Southern Territories (the) + 266 => "GA", // GA GAB 266 Gabon + 270 => "GM", // GM GMB 270 Gambia (the) + 268 => "GE", // GE GEO 268 Georgia + 276 => "DE", // DE DEU 276 Germany + 288 => "GH", // GH GHA 288 Ghana + 292 => "GI", // GI GIB 292 Gibraltar + 300 => "GR", // GR GRC 300 Greece + 304 => "GL", // GL GRL 304 Greenland + 308 => "GD", // GD GRD 308 Grenada + 312 => "GP", // GP GLP 312 Guadeloupe + 316 => "GU", // GU GUM 316 Guam + 320 => "GT", // GT GTM 320 Guatemala + 831 => "GG", // GG GGY 831 Guernsey + 324 => "GN", // GN GIN 324 Guinea + 624 => "GW", // GW GNB 624 Guinea-Bissau + 328 => "GY", // GY GUY 328 Guyana + 332 => "HT", // HT HTI 332 Haiti + 334 => "HM", // HM HMD 334 Heard Island and McDonald Islands + 336 => "VA", // VA VAT 336 Holy See (the) + 340 => "HN", // HN HND 340 Honduras + 344 => "HK", // HK HKG 344 Hong Kong + 348 => "HU", // HU HUN 348 Hungary + 352 => "IS", // IS ISL 352 Iceland + 356 => "IN", // IN IND 356 India + 360 => "ID", // ID IDN 360 Indonesia + 364 => "IR", // IR IRN 364 Iran (Islamic Republic of) + 368 => "IQ", // IQ IRQ 368 Iraq + 372 => "IE", // IE IRL 372 Ireland + 833 => "IM", // IM IMN 833 Isle of Man + 376 => "IL", // IL ISR 376 Israel + 380 => "IT", // IT ITA 380 Italy + 388 => "JM", // JM JAM 388 Jamaica + 392 => "JP", // JP JPN 392 Japan + 832 => "JE", // JE JEY 832 Jersey + 400 => "JO", // JO JOR 400 Jordan + 398 => "KZ", // KZ KAZ 398 Kazakhstan + 404 => "KE", // KE KEN 404 Kenya + 296 => "KI", // KI KIR 296 Kiribati + 408 => "KP", // KP PRK 408 Korea (the Democratic People's Republic of) + 410 => "KR", // KR KOR 410 Korea (the Republic of) + 414 => "KW", // KW KWT 414 Kuwait + 417 => "KG", // KG KGZ 417 Kyrgyzstan + 418 => "LA", // LA LAO 418 Lao People's Democratic Republic (the) + 428 => "LV", // LV LVA 428 Latvia + 422 => "LB", // LB LBN 422 Lebanon + 426 => "LS", // LS LSO 426 Lesotho + 430 => "LR", // LR LBR 430 Liberia + 434 => "LY", // LY LBY 434 Libya + 438 => "LI", // LI LIE 438 Liechtenstein + 440 => "LT", // LT LTU 440 Lithuania + 442 => "LU", // LU LUX 442 Luxembourg + 446 => "MO", // MO MAC 446 Macao + 450 => "MG", // MG MDG 450 Madagascar + 454 => "MW", // MW MWI 454 Malawi + 458 => "MY", // MY MYS 458 Malaysia + 462 => "MV", // MV MDV 462 Maldives + 466 => "ML", // ML MLI 466 Mali + 470 => "MT", // MT MLT 470 Malta + 584 => "MH", // MH MHL 584 Marshall Islands (the) + 474 => "MQ", // MQ MTQ 474 Martinique + 478 => "MR", // MR MRT 478 Mauritania + 480 => "MU", // MU MUS 480 Mauritius + 175 => "YT", // YT MYT 175 Mayotte + 484 => "MX", // MX MEX 484 Mexico + 583 => "FM", // FM FSM 583 Micronesia (Federated States of) + 498 => "MD", // MD MDA 498 Moldova (the Republic of) + 492 => "MC", // MC MCO 492 Monaco + 496 => "MN", // MN MNG 496 Mongolia + 499 => "ME", // ME MNE 499 Montenegro + 500 => "MS", // MS MSR 500 Montserrat + 504 => "MA", // MA MAR 504 Morocco + 508 => "MZ", // MZ MOZ 508 Mozambique + 104 => "MM", // MM MMR 104 Myanmar + 516 => "NA", // NA NAM 516 Namibia + 520 => "NR", // NR NRU 520 Nauru + 524 => "NP", // NP NPL 524 Nepal + 528 => "NL", // NL NLD 528 Netherlands (the) + 540 => "NC", // NC NCL 540 New Caledonia + 554 => "NZ", // NZ NZL 554 New Zealand + 558 => "NI", // NI NIC 558 Nicaragua + 562 => "NE", // NE NER 562 Niger (the) + 566 => "NG", // NG NGA 566 Nigeria + 570 => "NU", // NU NIU 570 Niue + 574 => "NF", // NF NFK 574 Norfolk Island + 580 => "MP", // MP MNP 580 Northern Mariana Islands (the) + 578 => "NO", // NO NOR 578 Norway + 512 => "OM", // OM OMN 512 Oman + 586 => "PK", // PK PAK 586 Pakistan + 585 => "PW", // PW PLW 585 Palau + 275 => "PS", // PS PSE 275 Palestine, State of + 591 => "PA", // PA PAN 591 Panama + 598 => "PG", // PG PNG 598 Papua New Guinea + 600 => "PY", // PY PRY 600 Paraguay + 604 => "PE", // PE PER 604 Peru + 608 => "PH", // PH PHL 608 Philippines (the) + 612 => "PN", // PN PCN 612 Pitcairn + 616 => "PL", // PL POL 616 Poland + 620 => "PT", // PT PRT 620 Portugal + 630 => "PR", // PR PRI 630 Puerto Rico + 634 => "QA", // QA QAT 634 Qatar + 807 => "MK", // MK MKD 807 Republic of North Macedonia + 642 => "RO", // RO ROU 642 Romania + 643 => "RU", // RU RUS 643 Russian Federation (the) + 646 => "RW", // RW RWA 646 Rwanda + 638 => "RE", // RE REU 638 Réunion + 652 => "BL", // BL BLM 652 Saint Barthélemy + 654 => "SH", // SH SHN 654 Saint Helena, Ascension and Tristan da Cunha + 659 => "KN", // KN KNA 659 Saint Kitts and Nevis + 662 => "LC", // LC LCA 662 Saint Lucia + 663 => "MF", // MF MAF 663 Saint Martin (French part) + 666 => "PM", // PM SPM 666 Saint Pierre and Miquelon + 670 => "VC", // VC VCT 670 Saint Vincent and the Grenadines + 882 => "WS", // WS WSM 882 Samoa + 674 => "SM", // SM SMR 674 San Marino + 678 => "ST", // ST STP 678 Sao Tome and Principe + 682 => "SA", // SA SAU 682 Saudi Arabia + 686 => "SN", // SN SEN 686 Senegal + 688 => "RS", // RS SRB 688 Serbia + 690 => "SC", // SC SYC 690 Seychelles + 694 => "SL", // SL SLE 694 Sierra Leone + 702 => "SG", // SG SGP 702 Singapore + 534 => "SX", // SX SXM 534 Sint Maarten (Dutch part) + 703 => "SK", // SK SVK 703 Slovakia + 705 => "SI", // SI SVN 705 Slovenia + 090 => "SB", // SB SLB 090 Solomon Islands + 706 => "SO", // SO SOM 706 Somalia + 710 => "ZA", // ZA ZAF 710 South Africa + 239 => "GS", // GS SGS 239 South Georgia and the South Sandwich Islands + 728 => "SS", // SS SSD 728 South Sudan + 724 => "ES", // ES ESP 724 Spain + 144 => "LK", // LK LKA 144 Sri Lanka + 729 => "SD", // SD SDN 729 Sudan (the) + 740 => "SR", // SR SUR 740 Suriname + 744 => "SJ", // SJ SJM 744 Svalbard and Jan Mayen + 752 => "SE", // SE SWE 752 Sweden + 756 => "CH", // CH CHE 756 Switzerland + 760 => "SY", // SY SYR 760 Syrian Arab Republic + 158 => "TW", // TW TWN 158 Taiwan (Province of China) + 762 => "TJ", // TJ TJK 762 Tajikistan + 834 => "TZ", // TZ TZA 834 Tanzania, United Republic of + 764 => "TH", // TH THA 764 Thailand + 626 => "TL", // TL TLS 626 Timor-Leste + 768 => "TG", // TG TGO 768 Togo + 772 => "TK", // TK TKL 772 Tokelau + 776 => "TO", // TO TON 776 Tonga + 780 => "TT", // TT TTO 780 Trinidad and Tobago + 788 => "TN", // TN TUN 788 Tunisia + 792 => "TR", // TR TUR 792 Turkey + 795 => "TM", // TM TKM 795 Turkmenistan + 796 => "TC", // TC TCA 796 Turks and Caicos Islands (the) + 798 => "TV", // TV TUV 798 Tuvalu + 800 => "UG", // UG UGA 800 Uganda + 804 => "UA", // UA UKR 804 Ukraine + 784 => "AE", // AE ARE 784 United Arab Emirates (the) + 826 => "GB", // GB GBR 826 United Kingdom of Great Britain and Northern Ireland (the) + 581 => "UM", // UM UMI 581 United States Minor Outlying Islands (the) + 840 => "US", // US USA 840 United States of America (the) + 858 => "UY", // UY URY 858 Uruguay + 860 => "UZ", // UZ UZB 860 Uzbekistan + 548 => "VU", // VU VUT 548 Vanuatu + 862 => "VE", // VE VEN 862 Venezuela (Bolivarian Republic of) + 704 => "VN", // VN VNM 704 Viet Nam + 092 => "VG", // VG VGB 092 Virgin Islands (British) + 850 => "VI", // VI VIR 850 Virgin Islands (U.S.) + 876 => "WF", // WF WLF 876 Wallis and Futuna + 732 => "EH", // EH ESH 732 Western Sahara + 887 => "YE", // YE YEM 887 Yemen + 894 => "ZM", // ZM ZMB 894 Zambia + 716 => "ZW", // ZW ZWE 716 Zimbabwe + 248 => "AX", // AX ALA 248 Åland Islands + _ => "??", // unknow for other cases + } + } + + // https://www.iban.com/country-codes + Self::Af => "AF", // Afghanistan + Self::Al => "AL", // Albania + Self::Dz => "DZ", // Algeria + Self::As => "AS", // American Samoa + Self::Ad => "AD", // Andorra + Self::Ao => "AO", // Angola + Self::Ai => "AI", // Anguilla + Self::Aq => "AQ", // Antarctica + Self::Ag => "AG", // Antigua and Barbuda + Self::Ar => "AR", // Argentina + Self::Am => "AM", // Armenia + Self::Aw => "AW", // Aruba + Self::Au => "AU", // Australia + Self::At => "AT", // Austria + Self::Az => "AZ", // Azerbaijan + Self::Bs => "BS", // Bahamas (the) + Self::Bh => "BH", // Bahrain + Self::Bd => "BD", // Bangladesh + Self::Bb => "BB", // Barbados + Self::By => "BY", // Belarus + Self::Be => "BE", // Belgium + Self::Bz => "BZ", // Belize + Self::Bj => "BJ", // Benin + Self::Bm => "BM", // Bermuda + Self::Bt => "BT", // Bhutan + Self::Bo => "BO", // Bolivia (Plurinational State of) + Self::Bq => "BQ", // Bonaire, Sint Eustatius and Saba + Self::Ba => "BA", // Bosnia and Herzegovina + Self::Bw => "BW", // Botswana + Self::Bv => "BV", // Bouvet Island + Self::Br => "BR", // Brazil + Self::Io => "IO", // British Indian Ocean Territory (the) + Self::Bn => "BN", // Brunei Darussalam + Self::Bg => "BG", // Bulgaria + Self::Bf => "BF", // Burkina Faso + Self::Bi => "BI", // Burundi + Self::Cv => "CV", // Cabo Verde + Self::Kh => "KH", // Cambodia + Self::Cm => "CM", // Cameroon + Self::Ca => "CA", // Canada + Self::Ky => "KY", // Cayman Islands (the) + Self::Cf => "CF", // Central African Republic (the) + Self::Td => "TD", // Chad + Self::Cl => "CL", // Chile + Self::Cn => "CN", // China + Self::Cx => "CX", // Christmas Island + Self::Cc => "CC", // Cocos (Keeling) Islands (the) + Self::Co => "CO", // Colombia + Self::Km => "KM", // Comoros (the) + Self::Cd => "CD", // Congo (the Democratic Republic of the) + Self::Cg => "CG", // Congo (the) + Self::Ck => "CK", // Cook Islands (the) + Self::Cr => "CR", // Costa Rica + Self::Hr => "HR", // Croatia + Self::Cu => "CU", // Cuba + Self::Cw => "CW", // Curaçao + Self::Cy => "CY", // Cyprus + Self::Cz => "CZ", // Czechia + Self::Ci => "CI", // Côte d'Ivoire + Self::Dk => "DK", // Denmark + Self::Dj => "DJ", // Djibouti + Self::Dm => "DM", // Dominica + Self::Do => "DO", // Dominican Republic (the) + Self::Ec => "EC", // Ecuador + Self::Eg => "EG", // Egypt + Self::Sv => "SV", // El Salvador + Self::Gq => "GQ", // Equatorial Guinea + Self::Er => "ER", // Eritrea + Self::Ee => "EE", // Estonia + Self::Sz => "SZ", // Eswatini + Self::Et => "ET", // Ethiopia + Self::Fk => "FK", // Falkland Islands (the) [Malvinas] + Self::Fo => "FO", // Faroe Islands (the) + Self::Fj => "FJ", // Fiji + Self::Fi => "FI", // Finland + Self::Fr => "FR", // France + Self::Gf => "GF", // French Guiana + Self::Pf => "PF", // French Polynesia + Self::Tf => "TF", // French Southern Territories (the) + Self::Ga => "GA", // Gabon + Self::Gm => "GM", // Gambia (the) + Self::Ge => "GE", // Georgia + Self::De => "DE", // Germany + Self::Gh => "GH", // Ghana + Self::Gi => "GI", // Gibraltar + Self::Gr => "GR", // Greece + Self::Gl => "GL", // Greenland + Self::Gd => "GD", // Grenada + Self::Gp => "GP", // Guadeloupe + Self::Gu => "GU", // Guam + Self::Gt => "GT", // Guatemala + Self::Gg => "GG", // Guernsey + Self::Gn => "GN", // Guinea + Self::Gw => "GW", // Guinea-Bissau + Self::Gy => "GY", // Guyana + Self::Ht => "HT", // Haiti + Self::Hm => "HM", // Heard Island and McDonald Islands + Self::Va => "VA", // Holy See (the) + Self::Hn => "HN", // Honduras + Self::Hk => "HK", // Hong Kong + Self::Hu => "HU", // Hungary + Self::Is => "IS", // Iceland + Self::In => "IN", // India + Self::Id => "ID", // Indonesia + Self::Ir => "IR", // Iran (Islamic Republic of) + Self::Iq => "IQ", // Iraq + Self::Ie => "IE", // Ireland + Self::Im => "IM", // Isle of Man + Self::Il => "IL", // Israel + Self::It => "IT", // Italy + Self::Jm => "JM", // Jamaica + Self::Jp => "JP", // Japan + Self::Je => "JE", // Jersey + Self::Jo => "JO", // Jordan + Self::Kz => "KZ", // Kazakhstan + Self::Ke => "KE", // Kenya + Self::Ki => "KI", // Kiribati + Self::Kp => "KP", // Korea (the Democratic People's Republic of) + Self::Kr => "KR", // Korea (the Republic of) + Self::Kw => "KW", // Kuwait + Self::Kg => "KG", // KG KGZ 417 Kyrgyzstan + Self::La => "LA", // LA LAO 418 Lao People's Democratic Republic (the) + Self::Lv => "LV", // LV LVA 428 Latvia + Self::Lb => "LB", // LB LBN 422 Lebanon + Self::Ls => "LS", // LS LSO 426 Lesotho + Self::Lr => "LR", // LR LBR 430 Liberia + Self::Ly => "LY", // LY LBY 434 Libya + Self::Li => "LI", // LI LIE 438 Liechtenstein + Self::Lt => "LT", // LT LTU 440 Lithuania + Self::Lu => "LU", // LU LUX 442 Luxembourg + Self::Mo => "MO", // MO MAC 446 Macao + Self::Mg => "MG", // MG MDG 450 Madagascar + Self::Mw => "MW", // MW MWI 454 Malawi + Self::My => "MY", // MY MYS 458 Malaysia + Self::Mv => "MV", // MV MDV 462 Maldives + Self::Ml => "ML", // ML MLI 466 Mali + Self::Mt => "MT", // MT MLT 470 Malta + Self::Mh => "MH", // MH MHL 584 Marshall Islands (the) + Self::Mq => "MQ", // MQ MTQ 474 Martinique + Self::Mr => "MR", // MR MRT 478 Mauritania + Self::Mu => "MU", // MU MUS 480 Mauritius + Self::Yt => "YT", // YT MYT 175 Mayotte + Self::Mx => "MX", // MX MEX 484 Mexico + Self::Fm => "FM", // FM FSM 583 Micronesia (Federated States of) + Self::Md => "MD", // MD MDA 498 Moldova (the Republic of) + Self::Mc => "MC", // MC MCO 492 Monaco + Self::Mn => "MN", // MN MNG 496 Mongolia + Self::Me => "ME", // ME MNE 499 Montenegro + Self::Ms => "MS", // MS MSR 500 Montserrat + Self::Ma => "MA", // MA MAR 504 Morocco + Self::Mz => "MZ", // MZ MOZ 508 Mozambique + Self::Mm => "MM", // MM MMR 104 Myanmar + Self::Na => "NA", // NA NAM 516 Namibia + Self::Nr => "NR", // NR NRU 520 Nauru + Self::Np => "NP", // NP NPL 524 Nepal + Self::Nl => "NL", // NL NLD 528 Netherlands (the) + Self::Nc => "NC", // NC NCL 540 New Caledonia + Self::Nz => "NZ", // NZ NZL 554 New Zealand + Self::Ni => "NI", // NI NIC 558 Nicaragua + Self::Ne => "NE", // NE NER 562 Niger (the) + Self::Ng => "NG", // NG NGA 566 Nigeria + Self::Nu => "NU", // NU NIU 570 Niue + Self::Nf => "NF", // NF NFK 574 Norfolk Island + Self::Mp => "MP", // MP MNP 580 Northern Mariana Islands (the) + Self::No => "NO", // NO NOR 578 Norway + Self::Om => "OM", // OM OMN 512 Oman + Self::Pk => "PK", // PK PAK 586 Pakistan + Self::Pw => "PW", // PW PLW 585 Palau + Self::Ps => "PS", // PS PSE 275 Palestine, State of + Self::Pa => "PA", // PA PAN 591 Panama + Self::Pg => "PG", // PG PNG 598 Papua New Guinea + Self::Py => "PY", // PY PRY 600 Paraguay + Self::Pe => "PE", // PE PER 604 Peru + Self::Ph => "PH", // PH PHL 608 Philippines (the) + Self::Pn => "PN", // PN PCN 612 Pitcairn + Self::Pl => "PL", // PL POL 616 Poland + Self::Pt => "PT", // PT PRT 620 Portugal + Self::Pr => "PR", // PR PRI 630 Puerto Rico + Self::Qa => "QA", // QA QAT 634 Qatar + Self::Mk => "MK", // MK MKD 807 Republic of North Macedonia + Self::Ro => "RO", // RO ROU 642 Romania + Self::Ru => "RU", // RU RUS 643 Russian Federation (the) + Self::Rw => "RW", // RW RWA 646 Rwanda + Self::Re => "RE", // RE REU 638 Réunion + Self::Bl => "BL", // BL BLM 652 Saint Barthélemy + Self::Sh => "SH", // SH SHN 654 Saint Helena, Ascension and Tristan da Cunha + Self::Kn => "KN", // KN KNA 659 Saint Kitts and Nevis + Self::Lc => "LC", // LC LCA 662 Saint Lucia + Self::Mf => "MF", // MF MAF 663 Saint Martin (French part) + Self::Pm => "PM", // PM SPM 666 Saint Pierre and Miquelon + Self::Vc => "VC", // VC VCT 670 Saint Vincent and the Grenadines + Self::Ws => "WS", // WS WSM 882 Samoa + Self::Sm => "SM", // SM SMR 674 San Marino + Self::St => "ST", // ST STP 678 Sao Tome and Principe + Self::Sa => "SA", // SA SAU 682 Saudi Arabia + Self::Sn => "SN", // SN SEN 686 Senegal + Self::Rs => "RS", // RS SRB 688 Serbia + Self::Sc => "SC", // SC SYC 690 Seychelles + Self::Sl => "SL", // SL SLE 694 Sierra Leone + Self::Sg => "SG", // SG SGP 702 Singapore + Self::Sx => "SX", // SX SXM 534 Sint Maarten (Dutch part) + Self::Sk => "SK", // SK SVK 703 Slovakia + Self::Si => "SI", // SI SVN 705 Slovenia + Self::Sb => "SB", // SB SLB 090 Solomon Islands + Self::So => "SO", // SO SOM 706 Somalia + Self::Za => "ZA", // ZA ZAF 710 South Africa + Self::Gs => "GS", // GS SGS 239 South Georgia and the South Sandwich Islands + Self::Ss => "SS", // SS SSD 728 South Sudan + Self::Es => "ES", // ES ESP 724 Spain + Self::Lk => "LK", // LK LKA 144 Sri Lanka + Self::Sd => "SD", // SD SDN 729 Sudan (the) + Self::Sr => "SR", // SR SUR 740 Suriname + Self::Sj => "SJ", // SJ SJM 744 Svalbard and Jan Mayen + Self::Se => "SE", // SE SWE 752 Sweden + Self::Ch => "CH", // CH CHE 756 Switzerland + Self::Sy => "SY", // SY SYR 760 Syrian Arab Republic + Self::Tw => "TW", // TW TWN 158 Taiwan (Province of China) + Self::Tj => "TJ", // TJ TJK 762 Tajikistan + Self::Tz => "TZ", // TZ TZA 834 Tanzania, United Republic of + Self::Th => "TH", // TH THA 764 Thailand + Self::Tl => "TL", // TL TLS 626 Timor-Leste + Self::Tg => "TG", // TG TGO 768 Togo + Self::Tk => "TK", // TK TKL 772 Tokelau + Self::To => "TO", // TO TON 776 Tonga + Self::Tt => "TT", // TT TTO 780 Trinidad and Tobago + Self::Tn => "TN", // TN TUN 788 Tunisia + Self::Tr => "TR", // TR TUR 792 Turkey + Self::Tm => "TM", // TM TKM 795 Turkmenistan + Self::Tc => "TC", // TC TCA 796 Turks and Caicos Islands (the) + Self::Tv => "TV", // TV TUV 798 Tuvalu + Self::Ug => "UG", // UG UGA 800 Uganda + Self::Ua => "UA", // UA UKR 804 Ukraine + Self::Ae => "AE", // AE ARE 784 United Arab Emirates (the) + Self::Gb => "GB", // GB GBR 826 United Kingdom of Great Britain and Northern Ireland (the) + Self::Um => "UM", // UM UMI 581 United States Minor Outlying Islands (the) + Self::Us => "US", // US USA 840 United States of America (the) + Self::Uy => "UY", // UY URY 858 Uruguay + Self::Uz => "UZ", // UZ UZB 860 Uzbekistan + Self::Vu => "VU", // VU VUT 548 Vanuatu + Self::Ve => "VE", // VE VEN 862 Venezuela (Bolivarian Republic of) + Self::Vn => "VN", // VN VNM 704 Viet Nam + Self::Vg => "VG", // VG VGB 092 Virgin Islands (British) + Self::Vi => "VI", // VI VIR 850 Virgin Islands (U.S.) + Self::Wf => "WF", // WF WLF 876 Wallis and Futuna + Self::Eh => "EH", // EH ESH 732 Western Sahara + Self::Ye => "YE", // YE YEM 887 Yemen + Self::Zm => "ZM", // ZM ZMB 894 Zambia + Self::Zw => "ZW", // ZW ZWE 716 Zimbabwe + Self::Ax => "AX", // AX ALA 248 Åland Islands + _ => "**", }) } } diff --git a/tari.txt b/tari.txt new file mode 100644 index 0000000..62d6c96 --- /dev/null +++ b/tari.txt @@ -0,0 +1,249 @@ +004 => "AF", +008 => "AL", +012 => "DZ", +016 => "AS", +020 => "AD", +024 => "AO", +660 => "AI", +010 => "AQ", +028 => "AG", +032 => "AR", +051 => "AM", +533 => "AW", +036 => "AU", +040 => "AT", +031 => "AZ", +044 => "BS", +048 => "BH", +050 => "BD", +052 => "BB", +112 => "BY", +056 => "BE", +084 => "BZ", +204 => "BJ", +060 => "BM", +064 => "BT", +068 => "BO", +535 => "BQ", +070 => "BA", +072 => "BW", +074 => "BV", +076 => "BR", +086 => "IO", +096 => "BN", +100 => "BG", +854 => "BF", +108 => "BI", +132 => "CV", +116 => "KH", +120 => "CM", +124 => "CA", +136 => "KY", +140 => "CF", +148 => "TD", +152 => "CL", +156 => "CN", +162 => "CX", +166 => "CC", +170 => "CO", +174 => "KM", +180 => "CD", +178 => "CG", +184 => "CK", +188 => "CR", +191 => "HR", +192 => "CU", +531 => "CW", +196 => "CY", +203 => "CZ", +384 => "CI", +208 => "DK", +262 => "DJ", +212 => "DM", +214 => "DO", +218 => "EC", +818 => "EG", +222 => "SV", +226 => "GQ", +232 => "ER", +233 => "EE", +748 => "SZ", +231 => "ET", +238 => "FK", +234 => "FO", +242 => "FJ", +246 => "FI", +250 => "FR", +254 => "GF", +258 => "PF", +260 => "TF", +266 => "GA", +270 => "GM", +268 => "GE", +276 => "DE", +288 => "GH", +292 => "GI", +300 => "GR", +304 => "GL", +308 => "GD", +312 => "GP", +316 => "GU", +320 => "GT", +831 => "GG", +324 => "GN", +624 => "GW", +328 => "GY", +332 => "HT", +334 => "HM", +336 => "VA", +340 => "HN", +344 => "HK", +348 => "HU", +352 => "IS", +356 => "IN", +360 => "ID", +364 => "IR", +368 => "IQ", +372 => "IE", +833 => "IM", +376 => "IL", +380 => "IT", +388 => "JM", +392 => "JP", +832 => "JE", +400 => "JO", +398 => "KZ", +404 => "KE", +296 => "KI", +408 => "KP", +410 => "KR", +414 => "KW", +417 => "KG", +418 => "LA", +428 => "LV", +422 => "LB", +426 => "LS", +430 => "LR", +434 => "LY", +438 => "LI", +440 => "LT", +442 => "LU", +446 => "MO", +450 => "MG", +454 => "MW", +458 => "MY", +462 => "MV", +466 => "ML", +470 => "MT", +584 => "MH", +474 => "MQ", +478 => "MR", +480 => "MU", +175 => "YT", +484 => "MX", +583 => "FM", +498 => "MD", +492 => "MC", +496 => "MN", +499 => "ME", +500 => "MS", +504 => "MA", +508 => "MZ", +104 => "MM", +516 => "NA", +520 => "NR", +524 => "NP", +528 => "NL", +540 => "NC", +554 => "NZ", +558 => "NI", +562 => "NE", +566 => "NG", +570 => "NU", +574 => "NF", +580 => "MP", +578 => "NO", +512 => "OM", +586 => "PK", +585 => "PW", +275 => "PS", +591 => "PA", +598 => "PG", +600 => "PY", +604 => "PE", +608 => "PH", +612 => "PN", +616 => "PL", +620 => "PT", +630 => "PR", +634 => "QA", +807 => "MK", +642 => "RO", +643 => "RU", +646 => "RW", +638 => "RE", +652 => "BL", +654 => "SH", +659 => "KN", +662 => "LC", +663 => "MF", +666 => "PM", +670 => "VC", +882 => "WS", +674 => "SM", +678 => "ST", +682 => "SA", +686 => "SN", +688 => "RS", +690 => "SC", +694 => "SL", +702 => "SG", +534 => "SX", +703 => "SK", +705 => "SI", +090 => "SB", +706 => "SO", +710 => "ZA", +239 => "GS", +728 => "SS", +724 => "ES", +144 => "LK", +729 => "SD", +740 => "SR", +744 => "SJ", +752 => "SE", +756 => "CH", +760 => "SY", +158 => "TW", +762 => "TJ", +834 => "TZ", +764 => "TH", +626 => "TL", +768 => "TG", +772 => "TK", +776 => "TO", +780 => "TT", +788 => "TN", +792 => "TR", +795 => "TM", +796 => "TC", +798 => "TV", +800 => "UG", +804 => "UA", +784 => "AE", +826 => "GB", +581 => "UM", +840 => "US", +858 => "UY", +860 => "UZ", +548 => "VU", +862 => "VE", +704 => "VN", +092 => "VG", +850 => "VI", +876 => "WF", +732 => "EH", +887 => "YE", +894 => "ZM", +716 => "ZW", +248 => "AX", From fa20ee28911236fa280a805c403167adeea194bb Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Thu, 28 Dec 2023 00:20:43 +0200 Subject: [PATCH 2/9] simple comment for countries --- output.txt | 249 ------------------ src/lib.rs | 748 ++++++++++++++++++++++++++--------------------------- 2 files changed, 374 insertions(+), 623 deletions(-) delete mode 100644 output.txt diff --git a/output.txt b/output.txt deleted file mode 100644 index c7da936..0000000 --- a/output.txt +++ /dev/null @@ -1,249 +0,0 @@ -004 => "AF", // AF AFG 004 Afghanistan -008 => "AL", // AL ALB 008 Albania -012 => "DZ", // DZ DZA 012 Algeria -016 => "AS", // AS ASM 016 American Samoa -020 => "AD", // AD AND 020 Andorra -024 => "AO", // AO AGO 024 Angola -660 => "AI", // AI AIA 660 Anguilla -010 => "AQ", // AQ ATA 010 Antarctica -028 => "AG", // AG ATG 028 Antigua and Barbuda -032 => "AR", // AR ARG 032 Argentina -051 => "AM", // AM ARM 051 Armenia -533 => "AW", // AW ABW 533 Aruba -036 => "AU", // AU AUS 036 Australia -040 => "AT", // AT AUT 040 Austria -031 => "AZ", // AZ AZE 031 Azerbaijan -044 => "BS", // BS BHS 044 Bahamas (the) -048 => "BH", // BH BHR 048 Bahrain -050 => "BD", // BD BGD 050 Bangladesh -052 => "BB", // BB BRB 052 Barbados -112 => "BY", // BY BLR 112 Belarus -056 => "BE", // BE BEL 056 Belgium -084 => "BZ", // BZ BLZ 084 Belize -204 => "BJ", // BJ BEN 204 Benin -060 => "BM", // BM BMU 060 Bermuda -064 => "BT", // BT BTN 064 Bhutan -068 => "BO", // BO BOL 068 Bolivia (Plurinational State of) -535 => "BQ", // BQ BES 535 Bonaire, Sint Eustatius and Saba -070 => "BA", // BA BIH 070 Bosnia and Herzegovina -072 => "BW", // BW BWA 072 Botswana -074 => "BV", // BV BVT 074 Bouvet Island -076 => "BR", // BR BRA 076 Brazil -086 => "IO", // IO IOT 086 British Indian Ocean Territory (the) -096 => "BN", // BN BRN 096 Brunei Darussalam -100 => "BG", // BG BGR 100 Bulgaria -854 => "BF", // BF BFA 854 Burkina Faso -108 => "BI", // BI BDI 108 Burundi -132 => "CV", // CV CPV 132 Cabo Verde -116 => "KH", // KH KHM 116 Cambodia -120 => "CM", // CM CMR 120 Cameroon -124 => "CA", // CA CAN 124 Canada -136 => "KY", // KY CYM 136 Cayman Islands (the) -140 => "CF", // CF CAF 140 Central African Republic (the) -148 => "TD", // TD TCD 148 Chad -152 => "CL", // CL CHL 152 Chile -156 => "CN", // CN CHN 156 China -162 => "CX", // CX CXR 162 Christmas Island -166 => "CC", // CC CCK 166 Cocos (Keeling) Islands (the) -170 => "CO", // CO COL 170 Colombia -174 => "KM", // KM COM 174 Comoros (the) -180 => "CD", // CD COD 180 Congo (the Democratic Republic of the) -178 => "CG", // CG COG 178 Congo (the) -184 => "CK", // CK COK 184 Cook Islands (the) -188 => "CR", // CR CRI 188 Costa Rica -191 => "HR", // HR HRV 191 Croatia -192 => "CU", // CU CUB 192 Cuba -531 => "CW", // CW CUW 531 Curaçao -196 => "CY", // CY CYP 196 Cyprus -203 => "CZ", // CZ CZE 203 Czechia -384 => "CI", // CI CIV 384 Côte d'Ivoire -208 => "DK", // DK DNK 208 Denmark -262 => "DJ", // DJ DJI 262 Djibouti -212 => "DM", // DM DMA 212 Dominica -214 => "DO", // DO DOM 214 Dominican Republic (the) -218 => "EC", // EC ECU 218 Ecuador -818 => "EG", // EG EGY 818 Egypt -222 => "SV", // SV SLV 222 El Salvador -226 => "GQ", // GQ GNQ 226 Equatorial Guinea -232 => "ER", // ER ERI 232 Eritrea -233 => "EE", // EE EST 233 Estonia -748 => "SZ", // SZ SWZ 748 Eswatini -231 => "ET", // ET ETH 231 Ethiopia -238 => "FK", // FK FLK 238 Falkland Islands (the) [Malvinas] -234 => "FO", // FO FRO 234 Faroe Islands (the) -242 => "FJ", // FJ FJI 242 Fiji -246 => "FI", // FI FIN 246 Finland -250 => "FR", // FR FRA 250 France -254 => "GF", // GF GUF 254 French Guiana -258 => "PF", // PF PYF 258 French Polynesia -260 => "TF", // TF ATF 260 French Southern Territories (the) -266 => "GA", // GA GAB 266 Gabon -270 => "GM", // GM GMB 270 Gambia (the) -268 => "GE", // GE GEO 268 Georgia -276 => "DE", // DE DEU 276 Germany -288 => "GH", // GH GHA 288 Ghana -292 => "GI", // GI GIB 292 Gibraltar -300 => "GR", // GR GRC 300 Greece -304 => "GL", // GL GRL 304 Greenland -308 => "GD", // GD GRD 308 Grenada -312 => "GP", // GP GLP 312 Guadeloupe -316 => "GU", // GU GUM 316 Guam -320 => "GT", // GT GTM 320 Guatemala -831 => "GG", // GG GGY 831 Guernsey -324 => "GN", // GN GIN 324 Guinea -624 => "GW", // GW GNB 624 Guinea-Bissau -328 => "GY", // GY GUY 328 Guyana -332 => "HT", // HT HTI 332 Haiti -334 => "HM", // HM HMD 334 Heard Island and McDonald Islands -336 => "VA", // VA VAT 336 Holy See (the) -340 => "HN", // HN HND 340 Honduras -344 => "HK", // HK HKG 344 Hong Kong -348 => "HU", // HU HUN 348 Hungary -352 => "IS", // IS ISL 352 Iceland -356 => "IN", // IN IND 356 India -360 => "ID", // ID IDN 360 Indonesia -364 => "IR", // IR IRN 364 Iran (Islamic Republic of) -368 => "IQ", // IQ IRQ 368 Iraq -372 => "IE", // IE IRL 372 Ireland -833 => "IM", // IM IMN 833 Isle of Man -376 => "IL", // IL ISR 376 Israel -380 => "IT", // IT ITA 380 Italy -388 => "JM", // JM JAM 388 Jamaica -392 => "JP", // JP JPN 392 Japan -832 => "JE", // JE JEY 832 Jersey -400 => "JO", // JO JOR 400 Jordan -398 => "KZ", // KZ KAZ 398 Kazakhstan -404 => "KE", // KE KEN 404 Kenya -296 => "KI", // KI KIR 296 Kiribati -408 => "KP", // KP PRK 408 Korea (the Democratic People's Republic of) -410 => "KR", // KR KOR 410 Korea (the Republic of) -414 => "KW", // KW KWT 414 Kuwait -417 => "KG", // KG KGZ 417 Kyrgyzstan -418 => "LA", // LA LAO 418 Lao People's Democratic Republic (the) -428 => "LV", // LV LVA 428 Latvia -422 => "LB", // LB LBN 422 Lebanon -426 => "LS", // LS LSO 426 Lesotho -430 => "LR", // LR LBR 430 Liberia -434 => "LY", // LY LBY 434 Libya -438 => "LI", // LI LIE 438 Liechtenstein -440 => "LT", // LT LTU 440 Lithuania -442 => "LU", // LU LUX 442 Luxembourg -446 => "MO", // MO MAC 446 Macao -450 => "MG", // MG MDG 450 Madagascar -454 => "MW", // MW MWI 454 Malawi -458 => "MY", // MY MYS 458 Malaysia -462 => "MV", // MV MDV 462 Maldives -466 => "ML", // ML MLI 466 Mali -470 => "MT", // MT MLT 470 Malta -584 => "MH", // MH MHL 584 Marshall Islands (the) -474 => "MQ", // MQ MTQ 474 Martinique -478 => "MR", // MR MRT 478 Mauritania -480 => "MU", // MU MUS 480 Mauritius -175 => "YT", // YT MYT 175 Mayotte -484 => "MX", // MX MEX 484 Mexico -583 => "FM", // FM FSM 583 Micronesia (Federated States of) -498 => "MD", // MD MDA 498 Moldova (the Republic of) -492 => "MC", // MC MCO 492 Monaco -496 => "MN", // MN MNG 496 Mongolia -499 => "ME", // ME MNE 499 Montenegro -500 => "MS", // MS MSR 500 Montserrat -504 => "MA", // MA MAR 504 Morocco -508 => "MZ", // MZ MOZ 508 Mozambique -104 => "MM", // MM MMR 104 Myanmar -516 => "NA", // NA NAM 516 Namibia -520 => "NR", // NR NRU 520 Nauru -524 => "NP", // NP NPL 524 Nepal -528 => "NL", // NL NLD 528 Netherlands (the) -540 => "NC", // NC NCL 540 New Caledonia -554 => "NZ", // NZ NZL 554 New Zealand -558 => "NI", // NI NIC 558 Nicaragua -562 => "NE", // NE NER 562 Niger (the) -566 => "NG", // NG NGA 566 Nigeria -570 => "NU", // NU NIU 570 Niue -574 => "NF", // NF NFK 574 Norfolk Island -580 => "MP", // MP MNP 580 Northern Mariana Islands (the) -578 => "NO", // NO NOR 578 Norway -512 => "OM", // OM OMN 512 Oman -586 => "PK", // PK PAK 586 Pakistan -585 => "PW", // PW PLW 585 Palau -275 => "PS", // PS PSE 275 Palestine, State of -591 => "PA", // PA PAN 591 Panama -598 => "PG", // PG PNG 598 Papua New Guinea -600 => "PY", // PY PRY 600 Paraguay -604 => "PE", // PE PER 604 Peru -608 => "PH", // PH PHL 608 Philippines (the) -612 => "PN", // PN PCN 612 Pitcairn -616 => "PL", // PL POL 616 Poland -620 => "PT", // PT PRT 620 Portugal -630 => "PR", // PR PRI 630 Puerto Rico -634 => "QA", // QA QAT 634 Qatar -807 => "MK", // MK MKD 807 Republic of North Macedonia -642 => "RO", // RO ROU 642 Romania -643 => "RU", // RU RUS 643 Russian Federation (the) -646 => "RW", // RW RWA 646 Rwanda -638 => "RE", // RE REU 638 Réunion -652 => "BL", // BL BLM 652 Saint Barthélemy -654 => "SH", // SH SHN 654 Saint Helena, Ascension and Tristan da Cunha -659 => "KN", // KN KNA 659 Saint Kitts and Nevis -662 => "LC", // LC LCA 662 Saint Lucia -663 => "MF", // MF MAF 663 Saint Martin (French part) -666 => "PM", // PM SPM 666 Saint Pierre and Miquelon -670 => "VC", // VC VCT 670 Saint Vincent and the Grenadines -882 => "WS", // WS WSM 882 Samoa -674 => "SM", // SM SMR 674 San Marino -678 => "ST", // ST STP 678 Sao Tome and Principe -682 => "SA", // SA SAU 682 Saudi Arabia -686 => "SN", // SN SEN 686 Senegal -688 => "RS", // RS SRB 688 Serbia -690 => "SC", // SC SYC 690 Seychelles -694 => "SL", // SL SLE 694 Sierra Leone -702 => "SG", // SG SGP 702 Singapore -534 => "SX", // SX SXM 534 Sint Maarten (Dutch part) -703 => "SK", // SK SVK 703 Slovakia -705 => "SI", // SI SVN 705 Slovenia -090 => "SB", // SB SLB 090 Solomon Islands -706 => "SO", // SO SOM 706 Somalia -710 => "ZA", // ZA ZAF 710 South Africa -239 => "GS", // GS SGS 239 South Georgia and the South Sandwich Islands -728 => "SS", // SS SSD 728 South Sudan -724 => "ES", // ES ESP 724 Spain -144 => "LK", // LK LKA 144 Sri Lanka -729 => "SD", // SD SDN 729 Sudan (the) -740 => "SR", // SR SUR 740 Suriname -744 => "SJ", // SJ SJM 744 Svalbard and Jan Mayen -752 => "SE", // SE SWE 752 Sweden -756 => "CH", // CH CHE 756 Switzerland -760 => "SY", // SY SYR 760 Syrian Arab Republic -158 => "TW", // TW TWN 158 Taiwan (Province of China) -762 => "TJ", // TJ TJK 762 Tajikistan -834 => "TZ", // TZ TZA 834 Tanzania, United Republic of -764 => "TH", // TH THA 764 Thailand -626 => "TL", // TL TLS 626 Timor-Leste -768 => "TG", // TG TGO 768 Togo -772 => "TK", // TK TKL 772 Tokelau -776 => "TO", // TO TON 776 Tonga -780 => "TT", // TT TTO 780 Trinidad and Tobago -788 => "TN", // TN TUN 788 Tunisia -792 => "TR", // TR TUR 792 Turkey -795 => "TM", // TM TKM 795 Turkmenistan -796 => "TC", // TC TCA 796 Turks and Caicos Islands (the) -798 => "TV", // TV TUV 798 Tuvalu -800 => "UG", // UG UGA 800 Uganda -804 => "UA", // UA UKR 804 Ukraine -784 => "AE", // AE ARE 784 United Arab Emirates (the) -826 => "GB", // GB GBR 826 United Kingdom of Great Britain and Northern Ireland (the) -581 => "UM", // UM UMI 581 United States Minor Outlying Islands (the) -840 => "US", // US USA 840 United States of America (the) -858 => "UY", // UY URY 858 Uruguay -860 => "UZ", // UZ UZB 860 Uzbekistan -548 => "VU", // VU VUT 548 Vanuatu -862 => "VE", // VE VEN 862 Venezuela (Bolivarian Republic of) -704 => "VN", // VN VNM 704 Viet Nam -092 => "VG", // VG VGB 092 Virgin Islands (British) -850 => "VI", // VI VIR 850 Virgin Islands (U.S.) -876 => "WF", // WF WLF 876 Wallis and Futuna -732 => "EH", // EH ESH 732 Western Sahara -887 => "YE", // YE YEM 887 Yemen -894 => "ZM", // ZM ZMB 894 Zambia -716 => "ZW", // ZW ZWE 716 Zimbabwe -248 => "AX", // AX ALA 248 Åland Islands diff --git a/src/lib.rs b/src/lib.rs index 0229d47..cf413a3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1145,255 +1145,255 @@ impl Display for Region { // https://www.iban.com/country-codes Region::Custom(value) => { match value { - 004 => "AF", // Afghanistan - 008 => "AL", // Albania - 012 => "DZ", // Algeria - 016 => "AS", // American Samoa - 020 => "AD", // Andorra - 024 => "AO", // Angola + 4 => "AF", // Afghanistan + 8 => "AL", // Albania + 12 => "DZ", // Algeria + 16 => "AS", // American Samoa + 20 => "AD", // Andorra + 24 => "AO", // Angola 660 => "AI", // Anguilla - 010 => "AQ", // Antarctica - 028 => "AG", // Antigua and Barbuda - 032 => "AR", // Argentina - 051 => "AM", // Armenia + 10 => "AQ", // Antarctica + 28 => "AG", // Antigua and Barbuda + 32 => "AR", // Argentina + 51 => "AM", // Armenia 533 => "AW", // Aruba - 036 => "AU", // Australia - 040 => "AT", // Austria - 031 => "AZ", // Azerbaijan - 044 => "BS", // Bahamas (the) - 048 => "BH", // Bahrain - 050 => "BD", // Bangladesh - 052 => "BB", // Barbados + 36 => "AU", // Australia + 40 => "AT", // Austria + 31 => "AZ", // Azerbaijan + 44 => "BS", // Bahamas (the) + 48 => "BH", // Bahrain + 50 => "BD", // Bangladesh + 52 => "BB", // Barbados 112 => "BY", // Belarus - 056 => "BE", // Belgium - 084 => "BZ", // Belize + 56 => "BE", // Belgium + 84 => "BZ", // Belize 204 => "BJ", // Benin - 060 => "BM", // BM BMU 060 Besrmuda - 064 => "BT", // BT BTN 064 Bhutan - 068 => "BO", // BO BOL 068 Bolivia (Plurinational State of) - 535 => "BQ", // BQ BES 535 Bonaire, Sint Eustatius and Saba - 070 => "BA", // BA BIH 070 Bosnia and Herzegovina - 072 => "BW", // BW BWA 072 Botswana - 074 => "BV", // BV BVT 074 Bouvet Island - 076 => "BR", // BR BRA 076 Brazil - 086 => "IO", // IO IOT 086 British Indian Ocean Territory (the) - 096 => "BN", // BN BRN 096 Brunei Darussalam - 100 => "BG", // BG BGR 100 Bulgaria - 854 => "BF", // BF BFA 854 Burkina Faso - 108 => "BI", // BI BDI 108 Burundi - 132 => "CV", // CV CPV 132 Cabo Verde - 116 => "KH", // KH KHM 116 Cambodia - 120 => "CM", // CM CMR 120 Cameroon - 124 => "CA", // CA CAN 124 Canada - 136 => "KY", // KY CYM 136 Cayman Islands (the) - 140 => "CF", // CF CAF 140 Central African Republic (the) - 148 => "TD", // TD TCD 148 Chad - 152 => "CL", // CL CHL 152 Chile - 156 => "CN", // CN CHN 156 China - 162 => "CX", // CX CXR 162 Christmas Island - 166 => "CC", // CC CCK 166 Cocos (Keeling) Islands (the) - 170 => "CO", // CO COL 170 Colombia - 174 => "KM", // KM COM 174 Comoros (the) - 180 => "CD", // CD COD 180 Congo (the Democratic Republic of the) - 178 => "CG", // CG COG 178 Congo (the) - 184 => "CK", // CK COK 184 Cook Islands (the) - 188 => "CR", // CR CRI 188 Costa Rica - 191 => "HR", // HR HRV 191 Croatia - 192 => "CU", // CU CUB 192 Cuba - 531 => "CW", // CW CUW 531 Curaçao - 196 => "CY", // CY CYP 196 Cyprus - 203 => "CZ", // CZ CZE 203 Czechia - 384 => "CI", // CI CIV 384 Côte d'Ivoire - 208 => "DK", // DK DNK 208 Denmark - 262 => "DJ", // DJ DJI 262 Djibouti - 212 => "DM", // DM DMA 212 Dominica - 214 => "DO", // DO DOM 214 Dominican Republic (the) - 218 => "EC", // EC ECU 218 Ecuador - 818 => "EG", // EG EGY 818 Egypt - 222 => "SV", // SV SLV 222 El Salvador - 226 => "GQ", // GQ GNQ 226 Equatorial Guinea - 232 => "ER", // ER ERI 232 Eritrea - 233 => "EE", // EE EST 233 Estonia - 748 => "SZ", // SZ SWZ 748 Eswatini - 231 => "ET", // ET ETH 231 Ethiopia - 238 => "FK", // FK FLK 238 Falkland Islands (the) [Malvinas] - 234 => "FO", // FO FRO 234 Faroe Islands (the) - 242 => "FJ", // FJ FJI 242 Fiji - 246 => "FI", // FI FIN 246 Finland - 250 => "FR", // FR FRA 250 France - 254 => "GF", // GF GUF 254 French Guiana - 258 => "PF", // PF PYF 258 French Polynesia - 260 => "TF", // TF ATF 260 French Southern Territories (the) - 266 => "GA", // GA GAB 266 Gabon - 270 => "GM", // GM GMB 270 Gambia (the) - 268 => "GE", // GE GEO 268 Georgia - 276 => "DE", // DE DEU 276 Germany - 288 => "GH", // GH GHA 288 Ghana - 292 => "GI", // GI GIB 292 Gibraltar - 300 => "GR", // GR GRC 300 Greece - 304 => "GL", // GL GRL 304 Greenland - 308 => "GD", // GD GRD 308 Grenada - 312 => "GP", // GP GLP 312 Guadeloupe - 316 => "GU", // GU GUM 316 Guam - 320 => "GT", // GT GTM 320 Guatemala - 831 => "GG", // GG GGY 831 Guernsey - 324 => "GN", // GN GIN 324 Guinea - 624 => "GW", // GW GNB 624 Guinea-Bissau - 328 => "GY", // GY GUY 328 Guyana - 332 => "HT", // HT HTI 332 Haiti - 334 => "HM", // HM HMD 334 Heard Island and McDonald Islands - 336 => "VA", // VA VAT 336 Holy See (the) - 340 => "HN", // HN HND 340 Honduras - 344 => "HK", // HK HKG 344 Hong Kong - 348 => "HU", // HU HUN 348 Hungary - 352 => "IS", // IS ISL 352 Iceland - 356 => "IN", // IN IND 356 India - 360 => "ID", // ID IDN 360 Indonesia - 364 => "IR", // IR IRN 364 Iran (Islamic Republic of) - 368 => "IQ", // IQ IRQ 368 Iraq - 372 => "IE", // IE IRL 372 Ireland - 833 => "IM", // IM IMN 833 Isle of Man - 376 => "IL", // IL ISR 376 Israel - 380 => "IT", // IT ITA 380 Italy - 388 => "JM", // JM JAM 388 Jamaica - 392 => "JP", // JP JPN 392 Japan - 832 => "JE", // JE JEY 832 Jersey - 400 => "JO", // JO JOR 400 Jordan - 398 => "KZ", // KZ KAZ 398 Kazakhstan - 404 => "KE", // KE KEN 404 Kenya - 296 => "KI", // KI KIR 296 Kiribati - 408 => "KP", // KP PRK 408 Korea (the Democratic People's Republic of) - 410 => "KR", // KR KOR 410 Korea (the Republic of) - 414 => "KW", // KW KWT 414 Kuwait - 417 => "KG", // KG KGZ 417 Kyrgyzstan - 418 => "LA", // LA LAO 418 Lao People's Democratic Republic (the) - 428 => "LV", // LV LVA 428 Latvia - 422 => "LB", // LB LBN 422 Lebanon - 426 => "LS", // LS LSO 426 Lesotho - 430 => "LR", // LR LBR 430 Liberia - 434 => "LY", // LY LBY 434 Libya - 438 => "LI", // LI LIE 438 Liechtenstein - 440 => "LT", // LT LTU 440 Lithuania - 442 => "LU", // LU LUX 442 Luxembourg - 446 => "MO", // MO MAC 446 Macao - 450 => "MG", // MG MDG 450 Madagascar - 454 => "MW", // MW MWI 454 Malawi - 458 => "MY", // MY MYS 458 Malaysia - 462 => "MV", // MV MDV 462 Maldives - 466 => "ML", // ML MLI 466 Mali - 470 => "MT", // MT MLT 470 Malta - 584 => "MH", // MH MHL 584 Marshall Islands (the) - 474 => "MQ", // MQ MTQ 474 Martinique - 478 => "MR", // MR MRT 478 Mauritania - 480 => "MU", // MU MUS 480 Mauritius - 175 => "YT", // YT MYT 175 Mayotte - 484 => "MX", // MX MEX 484 Mexico - 583 => "FM", // FM FSM 583 Micronesia (Federated States of) - 498 => "MD", // MD MDA 498 Moldova (the Republic of) - 492 => "MC", // MC MCO 492 Monaco - 496 => "MN", // MN MNG 496 Mongolia - 499 => "ME", // ME MNE 499 Montenegro - 500 => "MS", // MS MSR 500 Montserrat - 504 => "MA", // MA MAR 504 Morocco - 508 => "MZ", // MZ MOZ 508 Mozambique - 104 => "MM", // MM MMR 104 Myanmar - 516 => "NA", // NA NAM 516 Namibia - 520 => "NR", // NR NRU 520 Nauru - 524 => "NP", // NP NPL 524 Nepal - 528 => "NL", // NL NLD 528 Netherlands (the) - 540 => "NC", // NC NCL 540 New Caledonia - 554 => "NZ", // NZ NZL 554 New Zealand - 558 => "NI", // NI NIC 558 Nicaragua - 562 => "NE", // NE NER 562 Niger (the) - 566 => "NG", // NG NGA 566 Nigeria - 570 => "NU", // NU NIU 570 Niue - 574 => "NF", // NF NFK 574 Norfolk Island - 580 => "MP", // MP MNP 580 Northern Mariana Islands (the) - 578 => "NO", // NO NOR 578 Norway - 512 => "OM", // OM OMN 512 Oman - 586 => "PK", // PK PAK 586 Pakistan - 585 => "PW", // PW PLW 585 Palau - 275 => "PS", // PS PSE 275 Palestine, State of - 591 => "PA", // PA PAN 591 Panama - 598 => "PG", // PG PNG 598 Papua New Guinea - 600 => "PY", // PY PRY 600 Paraguay - 604 => "PE", // PE PER 604 Peru - 608 => "PH", // PH PHL 608 Philippines (the) - 612 => "PN", // PN PCN 612 Pitcairn - 616 => "PL", // PL POL 616 Poland - 620 => "PT", // PT PRT 620 Portugal - 630 => "PR", // PR PRI 630 Puerto Rico - 634 => "QA", // QA QAT 634 Qatar - 807 => "MK", // MK MKD 807 Republic of North Macedonia - 642 => "RO", // RO ROU 642 Romania - 643 => "RU", // RU RUS 643 Russian Federation (the) - 646 => "RW", // RW RWA 646 Rwanda - 638 => "RE", // RE REU 638 Réunion - 652 => "BL", // BL BLM 652 Saint Barthélemy - 654 => "SH", // SH SHN 654 Saint Helena, Ascension and Tristan da Cunha - 659 => "KN", // KN KNA 659 Saint Kitts and Nevis - 662 => "LC", // LC LCA 662 Saint Lucia - 663 => "MF", // MF MAF 663 Saint Martin (French part) - 666 => "PM", // PM SPM 666 Saint Pierre and Miquelon - 670 => "VC", // VC VCT 670 Saint Vincent and the Grenadines - 882 => "WS", // WS WSM 882 Samoa - 674 => "SM", // SM SMR 674 San Marino - 678 => "ST", // ST STP 678 Sao Tome and Principe - 682 => "SA", // SA SAU 682 Saudi Arabia - 686 => "SN", // SN SEN 686 Senegal - 688 => "RS", // RS SRB 688 Serbia - 690 => "SC", // SC SYC 690 Seychelles - 694 => "SL", // SL SLE 694 Sierra Leone - 702 => "SG", // SG SGP 702 Singapore - 534 => "SX", // SX SXM 534 Sint Maarten (Dutch part) - 703 => "SK", // SK SVK 703 Slovakia - 705 => "SI", // SI SVN 705 Slovenia - 090 => "SB", // SB SLB 090 Solomon Islands - 706 => "SO", // SO SOM 706 Somalia - 710 => "ZA", // ZA ZAF 710 South Africa - 239 => "GS", // GS SGS 239 South Georgia and the South Sandwich Islands - 728 => "SS", // SS SSD 728 South Sudan - 724 => "ES", // ES ESP 724 Spain - 144 => "LK", // LK LKA 144 Sri Lanka - 729 => "SD", // SD SDN 729 Sudan (the) - 740 => "SR", // SR SUR 740 Suriname - 744 => "SJ", // SJ SJM 744 Svalbard and Jan Mayen - 752 => "SE", // SE SWE 752 Sweden - 756 => "CH", // CH CHE 756 Switzerland - 760 => "SY", // SY SYR 760 Syrian Arab Republic - 158 => "TW", // TW TWN 158 Taiwan (Province of China) - 762 => "TJ", // TJ TJK 762 Tajikistan - 834 => "TZ", // TZ TZA 834 Tanzania, United Republic of - 764 => "TH", // TH THA 764 Thailand - 626 => "TL", // TL TLS 626 Timor-Leste - 768 => "TG", // TG TGO 768 Togo - 772 => "TK", // TK TKL 772 Tokelau - 776 => "TO", // TO TON 776 Tonga - 780 => "TT", // TT TTO 780 Trinidad and Tobago - 788 => "TN", // TN TUN 788 Tunisia - 792 => "TR", // TR TUR 792 Turkey - 795 => "TM", // TM TKM 795 Turkmenistan - 796 => "TC", // TC TCA 796 Turks and Caicos Islands (the) - 798 => "TV", // TV TUV 798 Tuvalu - 800 => "UG", // UG UGA 800 Uganda - 804 => "UA", // UA UKR 804 Ukraine - 784 => "AE", // AE ARE 784 United Arab Emirates (the) - 826 => "GB", // GB GBR 826 United Kingdom of Great Britain and Northern Ireland (the) - 581 => "UM", // UM UMI 581 United States Minor Outlying Islands (the) - 840 => "US", // US USA 840 United States of America (the) - 858 => "UY", // UY URY 858 Uruguay - 860 => "UZ", // UZ UZB 860 Uzbekistan - 548 => "VU", // VU VUT 548 Vanuatu - 862 => "VE", // VE VEN 862 Venezuela (Bolivarian Republic of) - 704 => "VN", // VN VNM 704 Viet Nam - 092 => "VG", // VG VGB 092 Virgin Islands (British) - 850 => "VI", // VI VIR 850 Virgin Islands (U.S.) - 876 => "WF", // WF WLF 876 Wallis and Futuna - 732 => "EH", // EH ESH 732 Western Sahara - 887 => "YE", // YE YEM 887 Yemen - 894 => "ZM", // ZM ZMB 894 Zambia - 716 => "ZW", // ZW ZWE 716 Zimbabwe - 248 => "AX", // AX ALA 248 Åland Islands + 60 => "BM", // Besrmuda + 064 => "BT", // Bhutan + 68 => "BO", // Bolivia (Plurinational State of) + 535 => "BQ", // Bonaire, Sint Eustatius and Saba + 70 => "BA", // Bosnia and Herzegovina + 72 => "BW", // Botswana + 074 => "BV", // Bouvet Island + 76 => "BR", // Brazil + 086 => "IO", // British Indian Ocean Territory (the) + 96 => "BN", // Brunei Darussalam + 100 => "BG", // Bulgaria + 854 => "BF", // Burkina Faso + 108 => "BI", // Burundi + 132 => "CV", // Cabo Verde + 116 => "KH", // Cambodia + 120 => "CM", // Cameroon + 124 => "CA", // Canada + 136 => "KY", // Cayman Islands (the) + 140 => "CF", // Central African Republic (the) + 148 => "TD", // Chad + 152 => "CL", // Chile + 156 => "CN", // China + 162 => "CX", // Christmas Island + 166 => "CC", // Cocos (Keeling) Islands (the) + 170 => "CO", // Colombia + 174 => "KM", // Comoros (the) + 180 => "CD", // Congo (the Democratic Republic of the) + 178 => "CG", // Congo (the) + 184 => "CK", // Cook Islands (the) + 188 => "CR", // Costa Rica + 191 => "HR", // Croatia + 192 => "CU", // Cuba + 531 => "CW", // Curaçao + 196 => "CY", // Cyprus + 203 => "CZ", // Czechia + 384 => "CI", // Côte d'Ivoire + 208 => "DK", // Denmark + 262 => "DJ", // Djibouti + 212 => "DM", // Dominica + 214 => "DO", // Dominican Republic (the) + 218 => "EC", // Ecuador + 818 => "EG", // Egypt + 222 => "SV", // El Salvador + 226 => "GQ", // Equatorial Guinea + 232 => "ER", // Eritrea + 233 => "EE", // Estonia + 748 => "SZ", // Eswatini + 231 => "ET", // Ethiopia + 238 => "FK", // Falkland Islands (the) [Malvinas] + 234 => "FO", // Faroe Islands (the) + 242 => "FJ", // Fiji + 246 => "FI", // Finland + 250 => "FR", // France + 254 => "GF", // French Guiana + 258 => "PF", // French Polynesia + 260 => "TF", // French Southern Territories (the) + 266 => "GA", // Gabon + 270 => "GM", // Gambia (the) + 268 => "GE", // Georgia + 276 => "DE", // Germany + 288 => "GH", // Ghana + 292 => "GI", // Gibraltar + 300 => "GR", // Greece + 304 => "GL", // Greenland + 308 => "GD", // Grenada + 312 => "GP", // Guadeloupe + 316 => "GU", // Guam + 320 => "GT", // Guatemala + 831 => "GG", // Guernsey + 324 => "GN", // Guinea + 624 => "GW", // Guinea-Bissau + 328 => "GY", // Guyana + 332 => "HT", // Haiti + 334 => "HM", // Heard Island and McDonald Islands + 336 => "VA", // Holy See (the) + 340 => "HN", // Honduras + 344 => "HK", // Hong Kong + 348 => "HU", // Hungary + 352 => "IS", // Iceland + 356 => "IN", // India + 360 => "ID", // Indonesia + 364 => "IR", // Iran (Islamic Republic of) + 368 => "IQ", // Iraq + 372 => "IE", // Ireland + 833 => "IM", // Isle of Man + 376 => "IL", // Israel + 380 => "IT", // Italy + 388 => "JM", // Jamaica + 392 => "JP", // Japan + 832 => "JE", // Jersey + 400 => "JO", // Jordan + 398 => "KZ", // Kazakhstan + 404 => "KE", // Kenya + 296 => "KI", // Kiribati + 408 => "KP", // Korea (the Democratic People's Republic of) + 410 => "KR", // Korea (the Republic of) + 414 => "KW", // Kuwait + 417 => "KG", // Kyrgyzstan + 418 => "LA", // Lao People's Democratic Republic (the) + 428 => "LV", // Latvia + 422 => "LB", // Lebanon + 426 => "LS", // Lesotho + 430 => "LR", // Liberia + 434 => "LY", // Libya + 438 => "LI", // Liechtenstein + 440 => "LT", // Lithuania + 442 => "LU", // Luxembourg + 446 => "MO", // Macao + 450 => "MG", // Madagascar + 454 => "MW", // Malawi + 458 => "MY", // Malaysia + 462 => "MV", // Maldives + 466 => "ML", // Mali + 470 => "MT", // Malta + 584 => "MH", // Marshall Islands (the) + 474 => "MQ", // Martinique + 478 => "MR", // Mauritania + 480 => "MU", // Mauritius + 175 => "YT", // Mayotte + 484 => "MX", // Mexico + 583 => "FM", // Micronesia (Federated States of) + 498 => "MD", // Moldova (the Republic of) + 492 => "MC", // Monaco + 496 => "MN", // Mongolia + 499 => "ME", // Montenegro + 500 => "MS", // Montserrat + 504 => "MA", // Morocco + 508 => "MZ", // Mozambique + 104 => "MM", // Myanmar + 516 => "NA", // Namibia + 520 => "NR", // Nauru + 524 => "NP", // Nepal + 528 => "NL", // Netherlands (the) + 540 => "NC", // New Caledonia + 554 => "NZ", // New Zealand + 558 => "NI", // Nicaragua + 562 => "NE", // Niger (the) + 566 => "NG", // Nigeria + 570 => "NU", // Niue + 574 => "NF", // Norfolk Island + 580 => "MP", // Northern Mariana Islands (the) + 578 => "NO", // Norway + 512 => "OM", // Oman + 586 => "PK", // Pakistan + 585 => "PW", // Palau + 275 => "PS", // Palestine, State of + 591 => "PA", // Panama + 598 => "PG", // Papua New Guinea + 600 => "PY", // Paraguay + 604 => "PE", // Peru + 608 => "PH", // Philippines (the) + 612 => "PN", // Pitcairn + 616 => "PL", // Poland + 620 => "PT", // Portugal + 630 => "PR", // Puerto Rico + 634 => "QA", // Qatar + 807 => "MK", // Republic of North Macedonia + 642 => "RO", // Romania + 643 => "RU", // Russian Federation (the) + 646 => "RW", // Rwanda + 638 => "RE", // Réunion + 652 => "BL", // Saint Barthélemy + 654 => "SH", // Saint Helena, Ascension and Tristan da Cunha + 659 => "KN", // Saint Kitts and Nevis + 662 => "LC", // Saint Lucia + 663 => "MF", // Saint Martin (French part) + 666 => "PM", // Saint Pierre and Miquelon + 670 => "VC", // Saint Vincent and the Grenadines + 882 => "WS", // Samoa + 674 => "SM", // San Marino + 678 => "ST", // Sao Tome and Principe + 682 => "SA", // Saudi Arabia + 686 => "SN", // Senegal + 688 => "RS", // Serbia + 690 => "SC", // Seychelles + 694 => "SL", // Sierra Leone + 702 => "SG", // Singapore + 534 => "SX", // Sint Maarten (Dutch part) + 703 => "SK", // Slovakia + 705 => "SI", // Slovenia + 090 => "SB", // Solomon Islands + 706 => "SO", // Somalia + 710 => "ZA", // South Africa + 239 => "GS", // South Georgia and the South Sandwich Islands + 728 => "SS", // South Sudan + 724 => "ES", // Spain + 144 => "LK", // Sri Lanka + 729 => "SD", // Sudan (the) + 740 => "SR", // Suriname + 744 => "SJ", // Svalbard and Jan Mayen + 752 => "SE", // Sweden + 756 => "CH", // Switzerland + 760 => "SY", // Syrian Arab Republic + 158 => "TW", // Taiwan (Province of China) + 762 => "TJ", // Tajikistan + 834 => "TZ", // Tanzania, United Republic of + 764 => "TH", // Thailand + 626 => "TL", // Timor-Leste + 768 => "TG", // Togo + 772 => "TK", // Tokelau + 776 => "TO", // Tonga + 780 => "TT", // Trinidad and Tobago + 788 => "TN", // Tunisia + 792 => "TR", // Turkey + 795 => "TM", // Turkmenistan + 796 => "TC", // Turks and Caicos Islands (the) + 798 => "TV", // Tuvalu + 800 => "UG", // Uganda + 804 => "UA", // Ukraine + 784 => "AE", // United Arab Emirates (the) + 826 => "GB", // United Kingdom of Great Britain and Northern Ireland (the) + 581 => "UM", // United States Minor Outlying Islands (the) + 840 => "US", // United States of America (the) + 858 => "UY", // Uruguay + 860 => "UZ", // Uzbekistan + 548 => "VU", // Vanuatu + 862 => "VE", // Venezuela (Bolivarian Republic of) + 704 => "VN", // Viet Nam + 092 => "VG", // Virgin Islands (British) + 850 => "VI", // Virgin Islands (U.S.) + 876 => "WF", // Wallis and Futuna + 732 => "EH", // Western Sahara + 887 => "YE", // Yemen + 894 => "ZM", // Zambia + 716 => "ZW", // Zimbabwe + 248 => "AX", // Åland Islands _ => "??", // unknow for other cases } } @@ -1519,135 +1519,135 @@ impl Display for Region { Self::Kp => "KP", // Korea (the Democratic People's Republic of) Self::Kr => "KR", // Korea (the Republic of) Self::Kw => "KW", // Kuwait - Self::Kg => "KG", // KG KGZ 417 Kyrgyzstan - Self::La => "LA", // LA LAO 418 Lao People's Democratic Republic (the) - Self::Lv => "LV", // LV LVA 428 Latvia - Self::Lb => "LB", // LB LBN 422 Lebanon - Self::Ls => "LS", // LS LSO 426 Lesotho - Self::Lr => "LR", // LR LBR 430 Liberia - Self::Ly => "LY", // LY LBY 434 Libya - Self::Li => "LI", // LI LIE 438 Liechtenstein - Self::Lt => "LT", // LT LTU 440 Lithuania - Self::Lu => "LU", // LU LUX 442 Luxembourg - Self::Mo => "MO", // MO MAC 446 Macao - Self::Mg => "MG", // MG MDG 450 Madagascar - Self::Mw => "MW", // MW MWI 454 Malawi - Self::My => "MY", // MY MYS 458 Malaysia - Self::Mv => "MV", // MV MDV 462 Maldives - Self::Ml => "ML", // ML MLI 466 Mali - Self::Mt => "MT", // MT MLT 470 Malta - Self::Mh => "MH", // MH MHL 584 Marshall Islands (the) - Self::Mq => "MQ", // MQ MTQ 474 Martinique - Self::Mr => "MR", // MR MRT 478 Mauritania - Self::Mu => "MU", // MU MUS 480 Mauritius - Self::Yt => "YT", // YT MYT 175 Mayotte - Self::Mx => "MX", // MX MEX 484 Mexico - Self::Fm => "FM", // FM FSM 583 Micronesia (Federated States of) - Self::Md => "MD", // MD MDA 498 Moldova (the Republic of) - Self::Mc => "MC", // MC MCO 492 Monaco - Self::Mn => "MN", // MN MNG 496 Mongolia - Self::Me => "ME", // ME MNE 499 Montenegro - Self::Ms => "MS", // MS MSR 500 Montserrat - Self::Ma => "MA", // MA MAR 504 Morocco - Self::Mz => "MZ", // MZ MOZ 508 Mozambique - Self::Mm => "MM", // MM MMR 104 Myanmar - Self::Na => "NA", // NA NAM 516 Namibia - Self::Nr => "NR", // NR NRU 520 Nauru - Self::Np => "NP", // NP NPL 524 Nepal - Self::Nl => "NL", // NL NLD 528 Netherlands (the) - Self::Nc => "NC", // NC NCL 540 New Caledonia - Self::Nz => "NZ", // NZ NZL 554 New Zealand - Self::Ni => "NI", // NI NIC 558 Nicaragua - Self::Ne => "NE", // NE NER 562 Niger (the) - Self::Ng => "NG", // NG NGA 566 Nigeria - Self::Nu => "NU", // NU NIU 570 Niue - Self::Nf => "NF", // NF NFK 574 Norfolk Island - Self::Mp => "MP", // MP MNP 580 Northern Mariana Islands (the) - Self::No => "NO", // NO NOR 578 Norway - Self::Om => "OM", // OM OMN 512 Oman - Self::Pk => "PK", // PK PAK 586 Pakistan - Self::Pw => "PW", // PW PLW 585 Palau - Self::Ps => "PS", // PS PSE 275 Palestine, State of - Self::Pa => "PA", // PA PAN 591 Panama - Self::Pg => "PG", // PG PNG 598 Papua New Guinea - Self::Py => "PY", // PY PRY 600 Paraguay - Self::Pe => "PE", // PE PER 604 Peru - Self::Ph => "PH", // PH PHL 608 Philippines (the) - Self::Pn => "PN", // PN PCN 612 Pitcairn - Self::Pl => "PL", // PL POL 616 Poland - Self::Pt => "PT", // PT PRT 620 Portugal - Self::Pr => "PR", // PR PRI 630 Puerto Rico - Self::Qa => "QA", // QA QAT 634 Qatar - Self::Mk => "MK", // MK MKD 807 Republic of North Macedonia - Self::Ro => "RO", // RO ROU 642 Romania - Self::Ru => "RU", // RU RUS 643 Russian Federation (the) - Self::Rw => "RW", // RW RWA 646 Rwanda - Self::Re => "RE", // RE REU 638 Réunion - Self::Bl => "BL", // BL BLM 652 Saint Barthélemy - Self::Sh => "SH", // SH SHN 654 Saint Helena, Ascension and Tristan da Cunha - Self::Kn => "KN", // KN KNA 659 Saint Kitts and Nevis - Self::Lc => "LC", // LC LCA 662 Saint Lucia - Self::Mf => "MF", // MF MAF 663 Saint Martin (French part) - Self::Pm => "PM", // PM SPM 666 Saint Pierre and Miquelon - Self::Vc => "VC", // VC VCT 670 Saint Vincent and the Grenadines - Self::Ws => "WS", // WS WSM 882 Samoa - Self::Sm => "SM", // SM SMR 674 San Marino - Self::St => "ST", // ST STP 678 Sao Tome and Principe - Self::Sa => "SA", // SA SAU 682 Saudi Arabia - Self::Sn => "SN", // SN SEN 686 Senegal - Self::Rs => "RS", // RS SRB 688 Serbia - Self::Sc => "SC", // SC SYC 690 Seychelles - Self::Sl => "SL", // SL SLE 694 Sierra Leone - Self::Sg => "SG", // SG SGP 702 Singapore - Self::Sx => "SX", // SX SXM 534 Sint Maarten (Dutch part) - Self::Sk => "SK", // SK SVK 703 Slovakia - Self::Si => "SI", // SI SVN 705 Slovenia - Self::Sb => "SB", // SB SLB 090 Solomon Islands - Self::So => "SO", // SO SOM 706 Somalia - Self::Za => "ZA", // ZA ZAF 710 South Africa - Self::Gs => "GS", // GS SGS 239 South Georgia and the South Sandwich Islands - Self::Ss => "SS", // SS SSD 728 South Sudan - Self::Es => "ES", // ES ESP 724 Spain - Self::Lk => "LK", // LK LKA 144 Sri Lanka - Self::Sd => "SD", // SD SDN 729 Sudan (the) - Self::Sr => "SR", // SR SUR 740 Suriname - Self::Sj => "SJ", // SJ SJM 744 Svalbard and Jan Mayen - Self::Se => "SE", // SE SWE 752 Sweden - Self::Ch => "CH", // CH CHE 756 Switzerland - Self::Sy => "SY", // SY SYR 760 Syrian Arab Republic - Self::Tw => "TW", // TW TWN 158 Taiwan (Province of China) - Self::Tj => "TJ", // TJ TJK 762 Tajikistan - Self::Tz => "TZ", // TZ TZA 834 Tanzania, United Republic of - Self::Th => "TH", // TH THA 764 Thailand - Self::Tl => "TL", // TL TLS 626 Timor-Leste - Self::Tg => "TG", // TG TGO 768 Togo - Self::Tk => "TK", // TK TKL 772 Tokelau - Self::To => "TO", // TO TON 776 Tonga - Self::Tt => "TT", // TT TTO 780 Trinidad and Tobago - Self::Tn => "TN", // TN TUN 788 Tunisia - Self::Tr => "TR", // TR TUR 792 Turkey - Self::Tm => "TM", // TM TKM 795 Turkmenistan - Self::Tc => "TC", // TC TCA 796 Turks and Caicos Islands (the) - Self::Tv => "TV", // TV TUV 798 Tuvalu - Self::Ug => "UG", // UG UGA 800 Uganda - Self::Ua => "UA", // UA UKR 804 Ukraine - Self::Ae => "AE", // AE ARE 784 United Arab Emirates (the) - Self::Gb => "GB", // GB GBR 826 United Kingdom of Great Britain and Northern Ireland (the) - Self::Um => "UM", // UM UMI 581 United States Minor Outlying Islands (the) - Self::Us => "US", // US USA 840 United States of America (the) - Self::Uy => "UY", // UY URY 858 Uruguay - Self::Uz => "UZ", // UZ UZB 860 Uzbekistan - Self::Vu => "VU", // VU VUT 548 Vanuatu - Self::Ve => "VE", // VE VEN 862 Venezuela (Bolivarian Republic of) - Self::Vn => "VN", // VN VNM 704 Viet Nam - Self::Vg => "VG", // VG VGB 092 Virgin Islands (British) - Self::Vi => "VI", // VI VIR 850 Virgin Islands (U.S.) - Self::Wf => "WF", // WF WLF 876 Wallis and Futuna - Self::Eh => "EH", // EH ESH 732 Western Sahara - Self::Ye => "YE", // YE YEM 887 Yemen - Self::Zm => "ZM", // ZM ZMB 894 Zambia - Self::Zw => "ZW", // ZW ZWE 716 Zimbabwe - Self::Ax => "AX", // AX ALA 248 Åland Islands + Self::Kg => "KG", // Kyrgyzstan + Self::La => "LA", // Lao People's Democratic Republic (the) + Self::Lv => "LV", // Latvia + Self::Lb => "LB", // Lebanon + Self::Ls => "LS", // Lesotho + Self::Lr => "LR", // Liberia + Self::Ly => "LY", // Libya + Self::Li => "LI", // Liechtenstein + Self::Lt => "LT", // Lithuania + Self::Lu => "LU", // Luxembourg + Self::Mo => "MO", // Macao + Self::Mg => "MG", // Madagascar + Self::Mw => "MW", // Malawi + Self::My => "MY", // Malaysia + Self::Mv => "MV", // Maldives + Self::Ml => "ML", // Mali + Self::Mt => "MT", // Malta + Self::Mh => "MH", // Marshall Islands (the) + Self::Mq => "MQ", // Martinique + Self::Mr => "MR", // Mauritania + Self::Mu => "MU", // Mauritius + Self::Yt => "YT", // Mayotte + Self::Mx => "MX", // Mexico + Self::Fm => "FM", // Micronesia (Federated States of) + Self::Md => "MD", // Moldova (the Republic of) + Self::Mc => "MC", // Monaco + Self::Mn => "MN", // Mongolia + Self::Me => "ME", // Montenegro + Self::Ms => "MS", // Montserrat + Self::Ma => "MA", // Morocco + Self::Mz => "MZ", // Mozambique + Self::Mm => "MM", // Myanmar + Self::Na => "NA", // Namibia + Self::Nr => "NR", // Nauru + Self::Np => "NP", // Nepal + Self::Nl => "NL", // Netherlands (the) + Self::Nc => "NC", // New Caledonia + Self::Nz => "NZ", // New Zealand + Self::Ni => "NI", // Nicaragua + Self::Ne => "NE", // Niger (the) + Self::Ng => "NG", // Nigeria + Self::Nu => "NU", // Niue + Self::Nf => "NF", // Norfolk Island + Self::Mp => "MP", // Northern Mariana Islands (the) + Self::No => "NO", // Norway + Self::Om => "OM", // Oman + Self::Pk => "PK", // Pakistan + Self::Pw => "PW", // Palau + Self::Ps => "PS", // Palestine, State of + Self::Pa => "PA", // Panama + Self::Pg => "PG", // Papua New Guinea + Self::Py => "PY", // Paraguay + Self::Pe => "PE", // Peru + Self::Ph => "PH", // Philippines (the) + Self::Pn => "PN", // Pitcairn + Self::Pl => "PL", // Poland + Self::Pt => "PT", // Portugal + Self::Pr => "PR", // Puerto Rico + Self::Qa => "QA", // Qatar + Self::Mk => "MK", // Republic of North Macedonia + Self::Ro => "RO", // Romania + Self::Ru => "RU", // Russian Federation (the) + Self::Rw => "RW", // Rwanda + Self::Re => "RE", // Réunion + Self::Bl => "BL", // Saint Barthélemy + Self::Sh => "SH", // Saint Helena, Ascension and Tristan da Cunha + Self::Kn => "KN", // Saint Kitts and Nevis + Self::Lc => "LC", // Saint Lucia + Self::Mf => "MF", // Saint Martin (French part) + Self::Pm => "PM", // Saint Pierre and Miquelon + Self::Vc => "VC", // Saint Vincent and the Grenadines + Self::Ws => "WS", // Samoa + Self::Sm => "SM", // San Marino + Self::St => "ST", // Sao Tome and Principe + Self::Sa => "SA", // Saudi Arabia + Self::Sn => "SN", // Senegal + Self::Rs => "RS", // Serbia + Self::Sc => "SC", // Seychelles + Self::Sl => "SL", // Sierra Leone + Self::Sg => "SG", // Singapore + Self::Sx => "SX", // Sint Maarten (Dutch part) + Self::Sk => "SK", // Slovakia + Self::Si => "SI", // Slovenia + Self::Sb => "SB", // Solomon Islands + Self::So => "SO", // Somalia + Self::Za => "ZA", // South Africa + Self::Gs => "GS", // South Georgia and the South Sandwich Islands + Self::Ss => "SS", // South Sudan + Self::Es => "ES", // Spain + Self::Lk => "LK", // Sri Lanka + Self::Sd => "SD", // Sudan (the) + Self::Sr => "SR", // Suriname + Self::Sj => "SJ", // Svalbard and Jan Mayen + Self::Se => "SE", // Sweden + Self::Ch => "CH", // Switzerland + Self::Sy => "SY", // Syrian Arab Republic + Self::Tw => "TW", // Taiwan (Province of China) + Self::Tj => "TJ", // Tajikistan + Self::Tz => "TZ", // Tanzania, United Republic of + Self::Th => "TH", // Thailand + Self::Tl => "TL", // Timor-Leste + Self::Tg => "TG", // Togo + Self::Tk => "TK", // Tokelau + Self::To => "TO", // Tonga + Self::Tt => "TT", // Trinidad and Tobago + Self::Tn => "TN", // Tunisia + Self::Tr => "TR", // Turkey + Self::Tm => "TM", // Turkmenistan + Self::Tc => "TC", // Turks and Caicos Islands (the) + Self::Tv => "TV", // Tuvalu + Self::Ug => "UG", // Uganda + Self::Ua => "UA", // Ukraine + Self::Ae => "AE", // United Arab Emirates (the) + Self::Gb => "GB", // United Kingdom of Great Britain and Northern Ireland (the) + Self::Um => "UM", // United States Minor Outlying Islands (the) + Self::Us => "US", // United States of America (the) + Self::Uy => "UY", // Uruguay + Self::Uz => "UZ", // Uzbekistan + Self::Vu => "VU", // Vanuatu + Self::Ve => "VE", // Venezuela (Bolivarian Republic of) + Self::Vn => "VN", // Viet Nam + Self::Vg => "VG", // Virgin Islands (British) + Self::Vi => "VI", // Virgin Islands (U.S.) + Self::Wf => "WF", // Wallis and Futuna + Self::Eh => "EH", // Western Sahara + Self::Ye => "YE", // Yemen + Self::Zm => "ZM", // Zambia + Self::Zw => "ZW", // Zimbabwe + Self::Ax => "AX", // Åland Islands _ => "**", }) } From 2b77cf1e862ca5085de77716935056b7b1deb092 Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Thu, 28 Dec 2023 00:25:45 +0200 Subject: [PATCH 3/9] fixed value numbers --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cf413a3..61433fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1169,14 +1169,14 @@ impl Display for Region { 84 => "BZ", // Belize 204 => "BJ", // Benin 60 => "BM", // Besrmuda - 064 => "BT", // Bhutan + 64 => "BT", // Bhutan 68 => "BO", // Bolivia (Plurinational State of) 535 => "BQ", // Bonaire, Sint Eustatius and Saba 70 => "BA", // Bosnia and Herzegovina 72 => "BW", // Botswana - 074 => "BV", // Bouvet Island + 74 => "BV", // Bouvet Island 76 => "BR", // Brazil - 086 => "IO", // British Indian Ocean Territory (the) + 86 => "IO", // British Indian Ocean Territory (the) 96 => "BN", // Brunei Darussalam 100 => "BG", // Bulgaria 854 => "BF", // Burkina Faso @@ -1348,7 +1348,7 @@ impl Display for Region { 534 => "SX", // Sint Maarten (Dutch part) 703 => "SK", // Slovakia 705 => "SI", // Slovenia - 090 => "SB", // Solomon Islands + 90 => "SB", // Solomon Islands 706 => "SO", // Somalia 710 => "ZA", // South Africa 239 => "GS", // South Georgia and the South Sandwich Islands @@ -1386,7 +1386,7 @@ impl Display for Region { 548 => "VU", // Vanuatu 862 => "VE", // Venezuela (Bolivarian Republic of) 704 => "VN", // Viet Nam - 092 => "VG", // Virgin Islands (British) + 92 => "VG", // Virgin Islands (British) 850 => "VI", // Virgin Islands (U.S.) 876 => "WF", // Wallis and Futuna 732 => "EH", // Western Sahara From a5fea93ab989ccbb7e1ea5b5a92eb760e814c457 Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Thu, 28 Dec 2023 00:29:46 +0200 Subject: [PATCH 4/9] excluding _ from outer match --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 61433fb..0230852 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1394,7 +1394,7 @@ impl Display for Region { 894 => "ZM", // Zambia 716 => "ZW", // Zimbabwe 248 => "AX", // Åland Islands - _ => "??", // unknow for other cases + _ => "**", // unknown for other cases } } @@ -1648,7 +1648,6 @@ impl Display for Region { Self::Zm => "ZM", // Zambia Self::Zw => "ZW", // Zimbabwe Self::Ax => "AX", // Åland Islands - _ => "**", }) } } From b6cf344631666f029cccb8c166d0b5c5c88b3dde Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Thu, 28 Dec 2023 01:10:19 +0200 Subject: [PATCH 5/9] added languages --- languages.txt | 136 ++++++++++ output.txt | 136 ++++++++++ src/lib.rs | 684 +++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 952 insertions(+), 4 deletions(-) create mode 100644 languages.txt create mode 100644 output.txt diff --git a/languages.txt b/languages.txt new file mode 100644 index 0000000..c4897bb --- /dev/null +++ b/languages.txt @@ -0,0 +1,136 @@ +Abkhazian AB +Afar AA +Afrikaans AF +Albanian SQ +Amharic AM +Arabic AR +Armenian HY +Assamese AS +Aymara AY +Azerbaijani AZ +Bashkir BA +Basque EU +Bengali, Bangla BN +Bhutani DZ +Bihari BH +Bislama BI +Breton BR +Bulgarian BG +Burmese MY +Byelorussian BE +Cambodian KM +Catalan CA +Chinese ZH +Corsican CO +Croatian HR +Czech CS +Danish DA +Dutch NL +English, American EN +Esperanto EO +Estonian ET +Faeroese FO +Fiji FJ +Finnish FI +French FR +Frisian FY +Gaelic (Scots Gaelic) GD +Galician GL +Georgian KA +German DE +Greek EL +Greenlandic KL +Guarani GN +Gujarati GU +Hausa HA +Hebrew IW +Hindi HI +Hungarian HU +Icelandic IS +Indonesian IN +Interlingua IA +Interlingue IE +Inupiak IK +Irish GA +Italian IT +Japanese JA +Javanese JW +Kannada KN +Kashmiri KS +Kazakh KK +Kinyarwanda RW +Kirghiz KY +Kirundi RN +Korean KO +Kurdish KU +Laothian LO +Latin LA +Latvian, Lettish LV +Lingala LN +Lithuanian LT +Macedonian MK +Malagasy MG +Malay MS +Malayalam ML +Maltese MT +Maori MI +Marathi MR +Moldavian MO +Mongolian MN +Nauru NA +Nepali NE +Norwegian NO +Occitan OC +Oriya OR +Oromo, Afan OM +Pashto, Pushto PS +Persian FA +Polish PL +Portuguese PT +Punjabi PA +Quechua QU +Rhaeto-Romance RM +Romanian RO +Russian RU +Samoan SM +Sangro SG +Sanskrit SA +Serbian SR +Serbo-Croatian SH +Sesotho ST +Setswana TN +Shona SN +Sindhi SD +Singhalese SI +Siswati SS +Slovak SK +Slovenian SL +Somali SO +Spanish ES +Sudanese SU +Swahili SW +Swedish SV +Tagalog TL +Tajik TG +Tamil TA +Tatar TT +Tegulu TE +Thai TH +Tibetan BO +Tigrinya TI +Tonga TO +Tsonga TS +Turkish TR +Turkmen TK +Twi TW +Ukrainian UK +Urdu UR +Uzbek UZ +Vietnamese VI +Volapuk VO +Welsh CY +Wolof WO +Xhosa XH +Yiddish JI +Yoruba YO +Zulu ZU diff --git a/output.txt b/output.txt new file mode 100644 index 0000000..8c10974 --- /dev/null +++ b/output.txt @@ -0,0 +1,136 @@ +Self::AB(region) => *region, // Abkhazian AB +Self::AA(region) => *region, // Afar AA +Self::AF(region) => *region, // Afrikaans AF +Self::SQ(region) => *region, // Albanian SQ +Self::AM(region) => *region, // Amharic AM +Self::AR(region) => *region, // Arabic AR +Self::HY(region) => *region, // Armenian HY +Self::AS(region) => *region, // Assamese AS +Self::AY(region) => *region, // Aymara AY +Self::AZ(region) => *region, // Azerbaijani AZ +Self::BA(region) => *region, // Bashkir BA +Self::EU(region) => *region, // Basque EU +Self::BN(region) => *region, // Bengali, Bangla BN +Self::DZ(region) => *region, // Bhutani DZ +Self::BH(region) => *region, // Bihari BH +Self::BI(region) => *region, // Bislama BI +Self::BR(region) => *region, // Breton BR +Self::BG(region) => *region, // Bulgarian BG +Self::MY(region) => *region, // Burmese MY +Self::BE(region) => *region, // Byelorussian BE +Self::KM(region) => *region, // Cambodian KM +Self::CA(region) => *region, // Catalan CA +Self::ZH(region) => *region, // Chinese ZH +Self::CO(region) => *region, // Corsican CO +Self::HR(region) => *region, // Croatian HR +Self::CS(region) => *region, // Czech CS +Self::DA(region) => *region, // Danish DA +Self::NL(region) => *region, // Dutch NL +Self::EN(region) => *region, // English, American EN +Self::EO(region) => *region, // Esperanto EO +Self::ET(region) => *region, // Estonian ET +Self::FO(region) => *region, // Faeroese FO +Self::FJ(region) => *region, // Fiji FJ +Self::FI(region) => *region, // Finnish FI +Self::FR(region) => *region, // French FR +Self::FY(region) => *region, // Frisian FY +Self::GD(region) => *region, // Gaelic (Scots Gaelic) GD +Self::GL(region) => *region, // Galician GL +Self::KA(region) => *region, // Georgian KA +Self::DE(region) => *region, // German DE +Self::EL(region) => *region, // Greek EL +Self::KL(region) => *region, // Greenlandic KL +Self::GN(region) => *region, // Guarani GN +Self::GU(region) => *region, // Gujarati GU +Self::HA(region) => *region, // Hausa HA +Self::IW(region) => *region, // Hebrew IW +Self::HI(region) => *region, // Hindi HI +Self::HU(region) => *region, // Hungarian HU +Self::IS(region) => *region, // Icelandic IS +Self::IN(region) => *region, // Indonesian IN +Self::IA(region) => *region, // Interlingua IA +Self::IE(region) => *region, // Interlingue IE +Self::IK(region) => *region, // Inupiak IK +Self::GA(region) => *region, // Irish GA +Self::IT(region) => *region, // Italian IT +Self::JA(region) => *region, // Japanese JA +Self::JW(region) => *region, // Javanese JW +Self::KN(region) => *region, // Kannada KN +Self::KS(region) => *region, // Kashmiri KS +Self::KK(region) => *region, // Kazakh KK +Self::RW(region) => *region, // Kinyarwanda RW +Self::KY(region) => *region, // Kirghiz KY +Self::RN(region) => *region, // Kirundi RN +Self::KO(region) => *region, // Korean KO +Self::KU(region) => *region, // Kurdish KU +Self::LO(region) => *region, // Laothian LO +Self::LA(region) => *region, // Latin LA +Self::LV(region) => *region, // Latvian, Lettish LV +Self::LN(region) => *region, // Lingala LN +Self::LT(region) => *region, // Lithuanian LT +Self::MK(region) => *region, // Macedonian MK +Self::MG(region) => *region, // Malagasy MG +Self::MS(region) => *region, // Malay MS +Self::ML(region) => *region, // Malayalam ML +Self::MT(region) => *region, // Maltese MT +Self::MI(region) => *region, // Maori MI +Self::MR(region) => *region, // Marathi MR +Self::MO(region) => *region, // Moldavian MO +Self::MN(region) => *region, // Mongolian MN +Self::NA(region) => *region, // Nauru NA +Self::NE(region) => *region, // Nepali NE +Self::NO(region) => *region, // Norwegian NO +Self::OC(region) => *region, // Occitan OC +Self::OR(region) => *region, // Oriya OR +Self::OM(region) => *region, // Oromo, Afan OM +Self::PS(region) => *region, // Pashto, Pushto PS +Self::FA(region) => *region, // Persian FA +Self::PL(region) => *region, // Polish PL +Self::PT(region) => *region, // Portuguese PT +Self::PA(region) => *region, // Punjabi PA +Self::QU(region) => *region, // Quechua QU +Self::RM(region) => *region, // Rhaeto-Romance RM +Self::RO(region) => *region, // Romanian RO +Self::RU(region) => *region, // Russian RU +Self::SM(region) => *region, // Samoan SM +Self::SG(region) => *region, // Sangro SG +Self::SA(region) => *region, // Sanskrit SA +Self::SR(region) => *region, // Serbian SR +Self::SH(region) => *region, // Serbo-Croatian SH +Self::ST(region) => *region, // Sesotho ST +Self::TN(region) => *region, // Setswana TN +Self::SN(region) => *region, // Shona SN +Self::SD(region) => *region, // Sindhi SD +Self::SI(region) => *region, // Singhalese SI +Self::SS(region) => *region, // Siswati SS +Self::SK(region) => *region, // Slovak SK +Self::SL(region) => *region, // Slovenian SL +Self::SO(region) => *region, // Somali SO +Self::ES(region) => *region, // Spanish ES +Self::SU(region) => *region, // Sudanese SU +Self::SW(region) => *region, // Swahili SW +Self::SV(region) => *region, // Swedish SV +Self::TL(region) => *region, // Tagalog TL +Self::TG(region) => *region, // Tajik TG +Self::TA(region) => *region, // Tamil TA +Self::TT(region) => *region, // Tatar TT +Self::TE(region) => *region, // Tegulu TE +Self::TH(region) => *region, // Thai TH +Self::BO(region) => *region, // Tibetan BO +Self::TI(region) => *region, // Tigrinya TI +Self::TO(region) => *region, // Tonga TO +Self::TS(region) => *region, // Tsonga TS +Self::TR(region) => *region, // Turkish TR +Self::TK(region) => *region, // Turkmen TK +Self::TW(region) => *region, // Twi TW +Self::UK(region) => *region, // Ukrainian UK +Self::UR(region) => *region, // Urdu UR +Self::UZ(region) => *region, // Uzbek UZ +Self::VI(region) => *region, // Vietnamese VI +Self::VO(region) => *region, // Volapuk VO +Self::CY(region) => *region, // Welsh CY +Self::WO(region) => *region, // Wolof WO +Self::XH(region) => *region, // Xhosa XH +Self::JI(region) => *region, // Yiddish JI +Self::YO(region) => *region, // Yoruba YO +Self::ZU(region) => *region, // Zulu ZU diff --git a/src/lib.rs b/src/lib.rs index 0230852..8240624 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1132,8 +1132,7 @@ pub enum Region { /// `AX`: Åland Islands #[doc(hidden)] - Ax, - + Ax } impl Display for Region { @@ -1665,12 +1664,551 @@ impl Display for Region { pub enum Language { #[doc(hidden)] __(Box), - /// `en`: English + + /// `ab`: Abkhazian + #[doc(hidden)] + Ab(Region), + + /// `aa`: Afar + #[doc(hidden)] + Aa(Region), + + /// `AF`: Afrikaans + #[doc(hidden)] + Af(Region), + + /// `SQ`: Albanian + #[doc(hidden)] + Sq(Region), + + /// `AM`: Amharic + #[doc(hidden)] + Am(Region), + + /// `AR`: Arabic + #[doc(hidden)] + Ar(Region), + + /// `HY`: Armenian + #[doc(hidden)] + Hy(Region), + + /// `AS`: Assamese + #[doc(hidden)] + As(Region), + + /// `AY`: Aymara + #[doc(hidden)] + Ay(Region), + + /// `AZ`: Azerbaijani + #[doc(hidden)] + Az(Region), + + /// `BA`: Bashkir + #[doc(hidden)] + Ba(Region), + + /// `EU`: Basque + #[doc(hidden)] + Eu(Region), + + /// `bn`: Bengali, Bangla + #[doc(hidden)] + Bn(Region), + + /// `dz`: Bhutani + #[doc(hidden)] + Dz(Region), + + /// `bh`: Bihari + #[doc(hidden)] + Bh(Region), + + /// `BI`: Bislama + #[doc(hidden)] + BI(Region), + + /// `br`: Breton + #[doc(hidden)] + Br(Region), + + /// `bg`: Bulgarian + #[doc(hidden)] + Bg(Region), + + /// `my`: Burmese + #[doc(hidden)] + My(Region), + + /// `be`: Byelorussian + #[doc(hidden)] + Be(Region), + + /// `km`: Cambodian + #[doc(hidden)] + Km(Region), + + /// `ca`: Catalan + #[doc(hidden)] + Ca(Region), + + /// `zh`: Chinese + #[doc(hidden)] + Zh(Region), + + /// `co`: Corsican + #[doc(hidden)] + Co(Region), + + /// `hr`: Croatian + #[doc(hidden)] + Hr(Region), + + /// `CS`: Czech + #[doc(hidden)] + Cs(Region), + + /// `DA`: Danish + #[doc(hidden)] + Da(Region), + + /// `nl`: Dutch + #[doc(hidden)] + Nl(Region), + + /// `en`: English, American #[doc(hidden)] En(Region), + + /// `EO`: Esperanto + #[doc(hidden)] + Eo(Region), + + /// `Et`: Estonian + #[doc(hidden)] + Et(Region), + + /// `Fo`: Faeroese + #[doc(hidden)] + Fo(Region), + + /// `FJ`: Fiji + #[doc(hidden)] + Fj(Region), + + /// `FI`: Finnish + #[doc(hidden)] + Fi(Region), + + /// `FR`: French + #[doc(hidden)] + Fr(Region), + + /// `fy`: Frisian + #[doc(hidden)] + Fy(Region), + + /// `gd`: Gaelic (Scots Gaelic) + #[doc(hidden)] + Gd(Region), + + /// `GL`: Galician + #[doc(hidden)] + Gl(Region), + + /// `KA`: Georgian + #[doc(hidden)] + Ka(Region), + + /// `DE`: German + #[doc(hidden)] + De(Region), + + /// `EL`: Greek + #[doc(hidden)] + El(Region), + + /// `KL`: Greenlandic + #[doc(hidden)] + Kl(Region), + + /// `GN`: Guarani + #[doc(hidden)] + Gn(Region), + + /// `GU`: Gujarati + #[doc(hidden)] + Gu(Region), + + /// `HA`: Hausa + #[doc(hidden)] + Ha(Region), + + /// `IW`: Hebrew + #[doc(hidden)] + Iw(Region), + + /// `HI`: Hindi + #[doc(hidden)] + Hi(Region), + + /// `HU`: Hungarian + #[doc(hidden)] + Hu(Region), + + /// `IS`: Icelandic + #[doc(hidden)] + Is(Region), + + /// `IN`: Indonesian + #[doc(hidden)] + In(Region), + + /// `IA`: Interlingua + #[doc(hidden)] + Ia(Region), + + /// `IE`: Interlingue + #[doc(hidden)] + Ie(Region), + + /// `IK`: Inupiak + #[doc(hidden)] + Ik(Region), + + /// `GA`: Irish + #[doc(hidden)] + Ga(Region), + + /// `IT`: Italian + #[doc(hidden)] + It(Region), + + /// `JA`: Japanese + #[doc(hidden)] + Ja(Region), + + /// `JW`: Javanese + #[doc(hidden)] + Jw(Region), + + /// `KN`: Kannada + #[doc(hidden)] + Kn(Region), + + /// `KS`: Kashmiri + #[doc(hidden)] + Ks(Region), + + /// `KK`: Kazakh + #[doc(hidden)] + Kk(Region), + + /// `RW`: Kinyarwanda + #[doc(hidden)] + Rw(Region), + + /// `KY`: Kirghiz + #[doc(hidden)] + Ky(Region), + + /// `RN`: Kirundi + #[doc(hidden)] + Rn(Region), + + /// `KO`: Korean + #[doc(hidden)] + Ko(Region), + + /// `ku`: Kurdish + #[doc(hidden)] + Ku(Region), + + /// `lo`: Laothian + #[doc(hidden)] + Lo(Region), + + /// `LA`: Latin + #[doc(hidden)] + La(Region), + + /// `lv`: Latvian, Lettish + #[doc(hidden)] + Lv(Region), + + /// `ln`: Lingala + #[doc(hidden)] + Ln(Region), + + /// `lt`: Lithuanian + #[doc(hidden)] + Lt(Region), + + /// `mk`: Macedonian + #[doc(hidden)] + Mk(Region), + + /// `mg`: Malagasy + #[doc(hidden)] + Mg(Region), + + /// `ms`: Malay + #[doc(hidden)] + Ms(Region), + + /// `ml`: Malayalam + #[doc(hidden)] + Ml(Region), + + /// `mt`: Maltese + #[doc(hidden)] + Mt(Region), + + /// `mi`: Maori + #[doc(hidden)] + Mi(Region), + + /// `mr`: Marathi + #[doc(hidden)] + Mr(Region), + + /// `mo`: Moldavian + #[doc(hidden)] + Mo(Region), + + /// `mn`: Mongolian + #[doc(hidden)] + Mn(Region), + + /// `na`: Nauru + #[doc(hidden)] + Na(Region), + + /// `ne`: Nepali + #[doc(hidden)] + Ne(Region), + + /// `no`: Norwegian + #[doc(hidden)] + No(Region), + + /// `oc`: Occitan + #[doc(hidden)] + Oc(Region), + + /// `or`: Oriya + #[doc(hidden)] + Or(Region), + + /// `om`: Oromo, Afan + #[doc(hidden)] + Om(Region), + + /// `ps`: Pashto, Pushto + #[doc(hidden)] + Ps(Region), + + /// `fa`: Persian + #[doc(hidden)] + Fa(Region), + + /// `pl`: Polish + #[doc(hidden)] + Pl(Region), + + /// `pt`: Portuguese + #[doc(hidden)] + Pt(Region), + + /// `pa`: Punjabi + #[doc(hidden)] + Pa(Region), + + /// `qu`: Quechua + #[doc(hidden)] + Qu(Region), + + /// `rm`: Rhaeto-Romance + #[doc(hidden)] + Rm(Region), + + /// `ro`: Romanian + #[doc(hidden)] + Ro(Region), + + /// `ru`: Russian + #[doc(hidden)] + Ru(Region), + + /// `sm`: Samoan + #[doc(hidden)] + Sm(Region), + + /// `SG`: Sangro + #[doc(hidden)] + SG(Region), + + /// `sa`: Sanskrit + #[doc(hidden)] + Sa(Region), + + /// `sr`: Serbian + #[doc(hidden)] + Sr(Region), + + /// `sh`: Serbo-Croatian + #[doc(hidden)] + Sh(Region), + + /// `st`: Sesotho + #[doc(hidden)] + St(Region), + + /// `tn`: Setswana + #[doc(hidden)] + Tn(Region), + + /// `sn`: Shona + #[doc(hidden)] + Sn(Region), + + /// `sd`: Sindhi + #[doc(hidden)] + Sd(Region), + + /// `si`: Singhalese + #[doc(hidden)] + Si(Region), + + /// `ss`: Siswati + #[doc(hidden)] + Ss(Region), + + /// `sk`: Slovak + #[doc(hidden)] + Sk(Region), + + /// `sl`: Slovenian + #[doc(hidden)] + Sl(Region), + + /// `so`: Somali + #[doc(hidden)] + So(Region), + /// `es`: Spanish #[doc(hidden)] Es(Region), + + /// `su`: Sudanese + #[doc(hidden)] + Su(Region), + + /// `sw`: Swahili + #[doc(hidden)] + Sw(Region), + + /// `sv`: Swedish + #[doc(hidden)] + Sv(Region), + + /// `tl`: Tagalog + #[doc(hidden)] + Tl(Region), + + /// `tg`: Tajik + #[doc(hidden)] + Tg(Region), + + /// `ta`: Tamil + #[doc(hidden)] + Ta(Region), + + /// `tt`: Tatar + #[doc(hidden)] + Tt(Region), + + /// `te`: Tegulu + #[doc(hidden)] + Te(Region), + + /// `th`: Thai + #[doc(hidden)] + Th(Region), + + /// `bo`: Tibetan + #[doc(hidden)] + Bo(Region), + + /// `ti`: Tigrinya + #[doc(hidden)] + Ti(Region), + + /// `to`: Tonga + #[doc(hidden)] + To(Region), + + /// `ts`: Tsonga + #[doc(hidden)] + Ts(Region), + + /// `tr`: Turkish + #[doc(hidden)] + Tr(Region), + + /// `tk`: Turkmen + #[doc(hidden)] + Tk(Region), + + /// `tw`: Twi + #[doc(hidden)] + Tw(Region), + + /// `uk`: Ukrainian + #[doc(hidden)] + Uk(Region), + + /// `ur`: Urdu + #[doc(hidden)] + Ur(Region), + + /// `uz`: Uzbek + #[doc(hidden)] + Uz(Region), + + /// `Vi`: Vietnamese + #[doc(hidden)] + Vi(Region), + + /// `vo`: Volapuk + #[doc(hidden)] + Vo(Region), + + /// `cy`: Welsh + #[doc(hidden)] + Cy(Region), + + /// `wo`: Wolof + #[doc(hidden)] + Wo(Region), + + /// `Xh`: Xhosa + #[doc(hidden)] + Xh(Region), + + /// `ji`: Yiddish + #[doc(hidden)] + Ji(Region), + + /// `yo`: Yoruba + #[doc(hidden)] + Yo(Region), + + /// `zu`: Zulu + #[doc(hidden)] + Zu(Region), + } impl Language { @@ -1678,7 +2216,142 @@ impl Language { pub fn region(&self) -> Region { match self { Self::__(_) => Region::Any, - Self::En(region) | Self::Es(region) => *region, + Self::Ab(region) => *region, // Abkhazian AB + Self::Aa(region) => *region, // Afar AA + Self::Af(region) => *region, // Afrikaans AF + Self::Sq(region) => *region, // Albanian SQ + Self::Am(region) => *region, // Amharic AM + Self::Ar(region) => *region, // Arabic AR + Self::Hy(region) => *region, // Armenian HY + Self::As(region) => *region, // Assamese AS + Self::Ay(region) => *region, // Aymara AY + Self::Az(region) => *region, // Azerbaijani AZ + Self::Ba(region) => *region, // Bashkir BA + Self::Eu(region) => *region, // Basque EU + Self::Bn(region) => *region, // Bengali, Bangla BN + Self::Dz(region) => *region, // Bhutani DZ + Self::Bh(region) => *region, // Bihari BH + Self::BI(region) => *region, // Bislama BI + Self::Br(region) => *region, // Breton BR + Self::Bg(region) => *region, // Bulgarian BG + Self::My(region) => *region, // Burmese MY + Self::Be(region) => *region, // Byelorussian BE + Self::Km(region) => *region, // Cambodian KM + Self::Ca(region) => *region, // Catalan CA + Self::Zh(region) => *region, // Chinese ZH + Self::Co(region) => *region, // Corsican CO + Self::Hr(region) => *region, // Croatian HR + Self::Cs(region) => *region, // Czech CS + Self::Da(region) => *region, // Danish DA + Self::Nl(region) => *region, // Dutch NL + Self::En(region) => *region, // English, American EN + Self::Eo(region) => *region, // Esperanto EO + Self::Et(region) => *region, // Estonian ET + Self::Fo(region) => *region, // Faeroese FO + Self::Fj(region) => *region, // Fiji FJ + Self::Fi(region) => *region, // Finnish FI + Self::Fr(region) => *region, // French FR + Self::Fy(region) => *region, // Frisian FY + Self::Gd(region) => *region, // Gaelic (Scots Gaelic) GD + Self::Gl(region) => *region, // Galician GL + Self::Ka(region) => *region, // Georgian KA + Self::De(region) => *region, // German DE + Self::El(region) => *region, // Greek EL + Self::Kl(region) => *region, // Greenlandic KL + Self::Gn(region) => *region, // Guarani GN + Self::Gu(region) => *region, // Gujarati GU + Self::Ha(region) => *region, // Hausa HA + Self::Iw(region) => *region, // Hebrew IW + Self::Hi(region) => *region, // Hindi HI + Self::Hu(region) => *region, // Hungarian HU + Self::Is(region) => *region, // Icelandic IS + Self::In(region) => *region, // Indonesian IN + Self::Ia(region) => *region, // Interlingua IA + Self::Ie(region) => *region, // Interlingue IE + Self::Ik(region) => *region, // Inupiak IK + Self::Ga(region) => *region, // Irish GA + Self::It(region) => *region, // Italian IT + Self::Ja(region) => *region, // Japanese JA + Self::Jw(region) => *region, // Javanese JW + Self::Kn(region) => *region, // Kannada KN + Self::Ks(region) => *region, // Kashmiri KS + Self::Kk(region) => *region, // Kazakh KK + Self::Rw(region) => *region, // Kinyarwanda RW + Self::Ky(region) => *region, // Kirghiz KY + Self::Rn(region) => *region, // Kirundi RN + Self::Ko(region) => *region, // Korean KO + Self::Ku(region) => *region, // Kurdish KU + Self::Lo(region) => *region, // Laothian LO + Self::La(region) => *region, // Latin LA + Self::Lv(region) => *region, // Latvian, Lettish LV + Self::Ln(region) => *region, // Lingala LN + Self::Lt(region) => *region, // Lithuanian LT + Self::Mk(region) => *region, // Macedonian MK + Self::Mg(region) => *region, // Malagasy MG + Self::Ms(region) => *region, // Malay MS + Self::Ml(region) => *region, // Malayalam ML + Self::Mt(region) => *region, // Maltese MT + Self::Mi(region) => *region, // Maori MI + Self::Mr(region) => *region, // Marathi MR + Self::Mo(region) => *region, // Moldavian MO + Self::Mn(region) => *region, // Mongolian MN + Self::Na(region) => *region, // Nauru NA + Self::Ne(region) => *region, // Nepali NE + Self::No(region) => *region, // Norwegian NO + Self::Oc(region) => *region, // Occitan OC + Self::Or(region) => *region, // Oriya OR + Self::Om(region) => *region, // Oromo, Afan OM + Self::Ps(region) => *region, // Pashto, Pushto PS + Self::Fa(region) => *region, // Persian FA + Self::Pl(region) => *region, // Polish PL + Self::Pt(region) => *region, // Portuguese PT + Self::Pa(region) => *region, // Punjabi PA + Self::Qu(region) => *region, // Quechua QU + Self::Rm(region) => *region, // Rhaeto-Romance RM + Self::Ro(region) => *region, // Romanian RO + Self::Ru(region) => *region, // Russian RU + Self::Sm(region) => *region, // Samoan SM + Self::SG(region) => *region, // Sangro SG + Self::Sa(region) => *region, // Sanskrit SA + Self::Sr(region) => *region, // Serbian SR + Self::Sh(region) => *region, // Serbo-Croatian SH + Self::St(region) => *region, // Sesotho ST + Self::Tn(region) => *region, // Setswana TN + Self::Sn(region) => *region, // Shona SN + Self::Sd(region) => *region, // Sindhi SD + Self::Si(region) => *region, // Singhalese SI + Self::Ss(region) => *region, // Siswati SS + Self::Sk(region) => *region, // Slovak SK + Self::Sl(region) => *region, // Slovenian SL + Self::So(region) => *region, // Somali SO + Self::Es(region) => *region, // Spanish ES + Self::Su(region) => *region, // Sudanese SU + Self::Sw(region) => *region, // Swahili SW + Self::Sv(region) => *region, // Swedish SV + Self::Tl(region) => *region, // Tagalog TL + Self::Tg(region) => *region, // Tajik TG + Self::Ta(region) => *region, // Tamil TA + Self::Tt(region) => *region, // Tatar TT + Self::Te(region) => *region, // Tegulu TE + Self::Th(region) => *region, // Thai TH + Self::Bo(region) => *region, // Tibetan BO + Self::Ti(region) => *region, // Tigrinya TI + Self::To(region) => *region, // Tonga TO + Self::Ts(region) => *region, // Tsonga TS + Self::Tr(region) => *region, // Turkish TR + Self::Tk(region) => *region, // Turkmen TK + Self::Tw(region) => *region, // Twi TW + Self::Uk(region) => *region, // Ukrainian UK + Self::Ur(region) => *region, // Urdu UR + Self::Uz(region) => *region, // Uzbek UZ + Self::Vi(region) => *region, // Vietnamese VI + Self::Vo(region) => *region, // Volapuk VO + Self::Cy(region) => *region, // Welsh CY + Self::Wo(region) => *region, // Wolof WO + Self::Xh(region) => *region, // Xhosa XH + Self::Ji(region) => *region, // Yiddish JI + Self::Yo(region) => *region, // Yoruba YO + Self::Zu(region) => *region, // Zulu ZU } } } @@ -1703,6 +2376,9 @@ impl Display for Language { f.write_str("es") } } + _ => { + f.write_str("unknown language") + } } } } From 2b627c3fca1262b02c29f8f4253209af951d5436 Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Thu, 28 Dec 2023 01:59:06 +0200 Subject: [PATCH 6/9] added text for region & language --- output.txt | 1496 +++++++++++++++++++++++++++++++++++++++++++++++----- src/lib.rs | 1353 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 2707 insertions(+), 142 deletions(-) diff --git a/output.txt b/output.txt index 8c10974..461ada6 100644 --- a/output.txt +++ b/output.txt @@ -1,136 +1,1360 @@ -Self::AB(region) => *region, // Abkhazian AB -Self::AA(region) => *region, // Afar AA -Self::AF(region) => *region, // Afrikaans AF -Self::SQ(region) => *region, // Albanian SQ -Self::AM(region) => *region, // Amharic AM -Self::AR(region) => *region, // Arabic AR -Self::HY(region) => *region, // Armenian HY -Self::AS(region) => *region, // Assamese AS -Self::AY(region) => *region, // Aymara AY -Self::AZ(region) => *region, // Azerbaijani AZ -Self::BA(region) => *region, // Bashkir BA -Self::EU(region) => *region, // Basque EU -Self::BN(region) => *region, // Bengali, Bangla BN -Self::DZ(region) => *region, // Bhutani DZ -Self::BH(region) => *region, // Bihari BH -Self::BI(region) => *region, // Bislama BI -Self::BR(region) => *region, // Breton BR -Self::BG(region) => *region, // Bulgarian BG -Self::MY(region) => *region, // Burmese MY -Self::BE(region) => *region, // Byelorussian BE -Self::KM(region) => *region, // Cambodian KM -Self::CA(region) => *region, // Catalan CA -Self::ZH(region) => *region, // Chinese ZH -Self::CO(region) => *region, // Corsican CO -Self::HR(region) => *region, // Croatian HR -Self::CS(region) => *region, // Czech CS -Self::DA(region) => *region, // Danish DA -Self::NL(region) => *region, // Dutch NL -Self::EN(region) => *region, // English, American EN -Self::EO(region) => *region, // Esperanto EO -Self::ET(region) => *region, // Estonian ET -Self::FO(region) => *region, // Faeroese FO -Self::FJ(region) => *region, // Fiji FJ -Self::FI(region) => *region, // Finnish FI -Self::FR(region) => *region, // French FR -Self::FY(region) => *region, // Frisian FY -Self::GD(region) => *region, // Gaelic (Scots Gaelic) GD -Self::GL(region) => *region, // Galician GL -Self::KA(region) => *region, // Georgian KA -Self::DE(region) => *region, // German DE -Self::EL(region) => *region, // Greek EL -Self::KL(region) => *region, // Greenlandic KL -Self::GN(region) => *region, // Guarani GN -Self::GU(region) => *region, // Gujarati GU -Self::HA(region) => *region, // Hausa HA -Self::IW(region) => *region, // Hebrew IW -Self::HI(region) => *region, // Hindi HI -Self::HU(region) => *region, // Hungarian HU -Self::IS(region) => *region, // Icelandic IS -Self::IN(region) => *region, // Indonesian IN -Self::IA(region) => *region, // Interlingua IA -Self::IE(region) => *region, // Interlingue IE -Self::IK(region) => *region, // Inupiak IK -Self::GA(region) => *region, // Irish GA -Self::IT(region) => *region, // Italian IT -Self::JA(region) => *region, // Japanese JA -Self::JW(region) => *region, // Javanese JW -Self::KN(region) => *region, // Kannada KN -Self::KS(region) => *region, // Kashmiri KS -Self::KK(region) => *region, // Kazakh KK -Self::RW(region) => *region, // Kinyarwanda RW -Self::KY(region) => *region, // Kirghiz KY -Self::RN(region) => *region, // Kirundi RN -Self::KO(region) => *region, // Korean KO -Self::KU(region) => *region, // Kurdish KU -Self::LO(region) => *region, // Laothian LO -Self::LA(region) => *region, // Latin LA -Self::LV(region) => *region, // Latvian, Lettish LV -Self::LN(region) => *region, // Lingala LN -Self::LT(region) => *region, // Lithuanian LT -Self::MK(region) => *region, // Macedonian MK -Self::MG(region) => *region, // Malagasy MG -Self::MS(region) => *region, // Malay MS -Self::ML(region) => *region, // Malayalam ML -Self::MT(region) => *region, // Maltese MT -Self::MI(region) => *region, // Maori MI -Self::MR(region) => *region, // Marathi MR -Self::MO(region) => *region, // Moldavian MO -Self::MN(region) => *region, // Mongolian MN -Self::NA(region) => *region, // Nauru NA -Self::NE(region) => *region, // Nepali NE -Self::NO(region) => *region, // Norwegian NO -Self::OC(region) => *region, // Occitan OC -Self::OR(region) => *region, // Oriya OR -Self::OM(region) => *region, // Oromo, Afan OM -Self::PS(region) => *region, // Pashto, Pushto PS -Self::FA(region) => *region, // Persian FA -Self::PL(region) => *region, // Polish PL -Self::PT(region) => *region, // Portuguese PT -Self::PA(region) => *region, // Punjabi PA -Self::QU(region) => *region, // Quechua QU -Self::RM(region) => *region, // Rhaeto-Romance RM -Self::RO(region) => *region, // Romanian RO -Self::RU(region) => *region, // Russian RU -Self::SM(region) => *region, // Samoan SM -Self::SG(region) => *region, // Sangro SG -Self::SA(region) => *region, // Sanskrit SA -Self::SR(region) => *region, // Serbian SR -Self::SH(region) => *region, // Serbo-Croatian SH -Self::ST(region) => *region, // Sesotho ST -Self::TN(region) => *region, // Setswana TN -Self::SN(region) => *region, // Shona SN -Self::SD(region) => *region, // Sindhi SD -Self::SI(region) => *region, // Singhalese SI -Self::SS(region) => *region, // Siswati SS -Self::SK(region) => *region, // Slovak SK -Self::SL(region) => *region, // Slovenian SL -Self::SO(region) => *region, // Somali SO -Self::ES(region) => *region, // Spanish ES -Self::SU(region) => *region, // Sudanese SU -Self::SW(region) => *region, // Swahili SW -Self::SV(region) => *region, // Swedish SV -Self::TL(region) => *region, // Tagalog TL -Self::TG(region) => *region, // Tajik TG -Self::TA(region) => *region, // Tamil TA -Self::TT(region) => *region, // Tatar TT -Self::TE(region) => *region, // Tegulu TE -Self::TH(region) => *region, // Thai TH -Self::BO(region) => *region, // Tibetan BO -Self::TI(region) => *region, // Tigrinya TI -Self::TO(region) => *region, // Tonga TO -Self::TS(region) => *region, // Tsonga TS -Self::TR(region) => *region, // Turkish TR -Self::TK(region) => *region, // Turkmen TK -Self::TW(region) => *region, // Twi TW -Self::UK(region) => *region, // Ukrainian UK -Self::UR(region) => *region, // Urdu UR -Self::UZ(region) => *region, // Uzbek UZ -Self::VI(region) => *region, // Vietnamese VI -Self::VO(region) => *region, // Volapuk VO -Self::CY(region) => *region, // Welsh CY -Self::WO(region) => *region, // Wolof WO -Self::XH(region) => *region, // Xhosa XH -Self::JI(region) => *region, // Yiddish JI -Self::YO(region) => *region, // Yoruba YO -Self::ZU(region) => *region, // Zulu ZU +// Abkhazian AB +Self::AB(region) => { + if *region != Region::Any { + f.write_str("AB_")?; + ::fmt(region, f) + } else { + f.write_str("AB") + } +} + +// Afar AA +Self::AA(region) => { + if *region != Region::Any { + f.write_str("AA_")?; + ::fmt(region, f) + } else { + f.write_str("AA") + } +} + +// Afrikaans AF +Self::AF(region) => { + if *region != Region::Any { + f.write_str("AF_")?; + ::fmt(region, f) + } else { + f.write_str("AF") + } +} + +// Albanian SQ +Self::SQ(region) => { + if *region != Region::Any { + f.write_str("SQ_")?; + ::fmt(region, f) + } else { + f.write_str("SQ") + } +} + +// Amharic AM +Self::AM(region) => { + if *region != Region::Any { + f.write_str("AM_")?; + ::fmt(region, f) + } else { + f.write_str("AM") + } +} + +// Arabic AR +Self::AR(region) => { + if *region != Region::Any { + f.write_str("AR_")?; + ::fmt(region, f) + } else { + f.write_str("AR") + } +} + +// Armenian HY +Self::HY(region) => { + if *region != Region::Any { + f.write_str("HY_")?; + ::fmt(region, f) + } else { + f.write_str("HY") + } +} + +// Assamese AS +Self::AS(region) => { + if *region != Region::Any { + f.write_str("AS_")?; + ::fmt(region, f) + } else { + f.write_str("AS") + } +} + +// Aymara AY +Self::AY(region) => { + if *region != Region::Any { + f.write_str("AY_")?; + ::fmt(region, f) + } else { + f.write_str("AY") + } +} + +// Azerbaijani AZ +Self::AZ(region) => { + if *region != Region::Any { + f.write_str("AZ_")?; + ::fmt(region, f) + } else { + f.write_str("AZ") + } +} + +// Bashkir BA +Self::BA(region) => { + if *region != Region::Any { + f.write_str("BA_")?; + ::fmt(region, f) + } else { + f.write_str("BA") + } +} + +// Basque EU +Self::EU(region) => { + if *region != Region::Any { + f.write_str("EU_")?; + ::fmt(region, f) + } else { + f.write_str("EU") + } +} + +// Bengali, Bangla BN +Self::BN(region) => { + if *region != Region::Any { + f.write_str("BN_")?; + ::fmt(region, f) + } else { + f.write_str("BN") + } +} + +// Bhutani DZ +Self::DZ(region) => { + if *region != Region::Any { + f.write_str("DZ_")?; + ::fmt(region, f) + } else { + f.write_str("DZ") + } +} + +// Bihari BH +Self::BH(region) => { + if *region != Region::Any { + f.write_str("BH_")?; + ::fmt(region, f) + } else { + f.write_str("BH") + } +} + +// Bislama BI +Self::BI(region) => { + if *region != Region::Any { + f.write_str("BI_")?; + ::fmt(region, f) + } else { + f.write_str("BI") + } +} + +// Breton BR +Self::BR(region) => { + if *region != Region::Any { + f.write_str("BR_")?; + ::fmt(region, f) + } else { + f.write_str("BR") + } +} + +// Bulgarian BG +Self::BG(region) => { + if *region != Region::Any { + f.write_str("BG_")?; + ::fmt(region, f) + } else { + f.write_str("BG") + } +} + +// Burmese MY +Self::MY(region) => { + if *region != Region::Any { + f.write_str("MY_")?; + ::fmt(region, f) + } else { + f.write_str("MY") + } +} + +// Byelorussian BE +Self::BE(region) => { + if *region != Region::Any { + f.write_str("BE_")?; + ::fmt(region, f) + } else { + f.write_str("BE") + } +} + +// Cambodian KM +Self::KM(region) => { + if *region != Region::Any { + f.write_str("KM_")?; + ::fmt(region, f) + } else { + f.write_str("KM") + } +} + +// Catalan CA +Self::CA(region) => { + if *region != Region::Any { + f.write_str("CA_")?; + ::fmt(region, f) + } else { + f.write_str("CA") + } +} + +// Chinese ZH +Self::ZH(region) => { + if *region != Region::Any { + f.write_str("ZH_")?; + ::fmt(region, f) + } else { + f.write_str("ZH") + } +} + +// Corsican CO +Self::CO(region) => { + if *region != Region::Any { + f.write_str("CO_")?; + ::fmt(region, f) + } else { + f.write_str("CO") + } +} + +// Croatian HR +Self::HR(region) => { + if *region != Region::Any { + f.write_str("HR_")?; + ::fmt(region, f) + } else { + f.write_str("HR") + } +} + +// Czech CS +Self::CS(region) => { + if *region != Region::Any { + f.write_str("CS_")?; + ::fmt(region, f) + } else { + f.write_str("CS") + } +} + +// Danish DA +Self::DA(region) => { + if *region != Region::Any { + f.write_str("DA_")?; + ::fmt(region, f) + } else { + f.write_str("DA") + } +} + +// Dutch NL +Self::NL(region) => { + if *region != Region::Any { + f.write_str("NL_")?; + ::fmt(region, f) + } else { + f.write_str("NL") + } +} + +// English, American EN +Self::EN(region) => { + if *region != Region::Any { + f.write_str("EN_")?; + ::fmt(region, f) + } else { + f.write_str("EN") + } +} + +// Esperanto EO +Self::EO(region) => { + if *region != Region::Any { + f.write_str("EO_")?; + ::fmt(region, f) + } else { + f.write_str("EO") + } +} + +// Estonian ET +Self::ET(region) => { + if *region != Region::Any { + f.write_str("ET_")?; + ::fmt(region, f) + } else { + f.write_str("ET") + } +} + +// Faeroese FO +Self::FO(region) => { + if *region != Region::Any { + f.write_str("FO_")?; + ::fmt(region, f) + } else { + f.write_str("FO") + } +} + +// Fiji FJ +Self::FJ(region) => { + if *region != Region::Any { + f.write_str("FJ_")?; + ::fmt(region, f) + } else { + f.write_str("FJ") + } +} + +// Finnish FI +Self::FI(region) => { + if *region != Region::Any { + f.write_str("FI_")?; + ::fmt(region, f) + } else { + f.write_str("FI") + } +} + +// French FR +Self::FR(region) => { + if *region != Region::Any { + f.write_str("FR_")?; + ::fmt(region, f) + } else { + f.write_str("FR") + } +} + +// Frisian FY +Self::FY(region) => { + if *region != Region::Any { + f.write_str("FY_")?; + ::fmt(region, f) + } else { + f.write_str("FY") + } +} + +// Gaelic (Scots Gaelic) GD +Self::GD(region) => { + if *region != Region::Any { + f.write_str("GD_")?; + ::fmt(region, f) + } else { + f.write_str("GD") + } +} + +// Galician GL +Self::GL(region) => { + if *region != Region::Any { + f.write_str("GL_")?; + ::fmt(region, f) + } else { + f.write_str("GL") + } +} + +// Georgian KA +Self::KA(region) => { + if *region != Region::Any { + f.write_str("KA_")?; + ::fmt(region, f) + } else { + f.write_str("KA") + } +} + +// German DE +Self::DE(region) => { + if *region != Region::Any { + f.write_str("DE_")?; + ::fmt(region, f) + } else { + f.write_str("DE") + } +} + +// Greek EL +Self::EL(region) => { + if *region != Region::Any { + f.write_str("EL_")?; + ::fmt(region, f) + } else { + f.write_str("EL") + } +} + +// Greenlandic KL +Self::KL(region) => { + if *region != Region::Any { + f.write_str("KL_")?; + ::fmt(region, f) + } else { + f.write_str("KL") + } +} + +// Guarani GN +Self::GN(region) => { + if *region != Region::Any { + f.write_str("GN_")?; + ::fmt(region, f) + } else { + f.write_str("GN") + } +} + +// Gujarati GU +Self::GU(region) => { + if *region != Region::Any { + f.write_str("GU_")?; + ::fmt(region, f) + } else { + f.write_str("GU") + } +} + +// Hausa HA +Self::HA(region) => { + if *region != Region::Any { + f.write_str("HA_")?; + ::fmt(region, f) + } else { + f.write_str("HA") + } +} + +// Hebrew IW +Self::IW(region) => { + if *region != Region::Any { + f.write_str("IW_")?; + ::fmt(region, f) + } else { + f.write_str("IW") + } +} + +// Hindi HI +Self::HI(region) => { + if *region != Region::Any { + f.write_str("HI_")?; + ::fmt(region, f) + } else { + f.write_str("HI") + } +} + +// Hungarian HU +Self::HU(region) => { + if *region != Region::Any { + f.write_str("HU_")?; + ::fmt(region, f) + } else { + f.write_str("HU") + } +} + +// Icelandic IS +Self::IS(region) => { + if *region != Region::Any { + f.write_str("IS_")?; + ::fmt(region, f) + } else { + f.write_str("IS") + } +} + +// Indonesian IN +Self::IN(region) => { + if *region != Region::Any { + f.write_str("IN_")?; + ::fmt(region, f) + } else { + f.write_str("IN") + } +} + +// Interlingua IA +Self::IA(region) => { + if *region != Region::Any { + f.write_str("IA_")?; + ::fmt(region, f) + } else { + f.write_str("IA") + } +} + +// Interlingue IE +Self::IE(region) => { + if *region != Region::Any { + f.write_str("IE_")?; + ::fmt(region, f) + } else { + f.write_str("IE") + } +} + +// Inupiak IK +Self::IK(region) => { + if *region != Region::Any { + f.write_str("IK_")?; + ::fmt(region, f) + } else { + f.write_str("IK") + } +} + +// Irish GA +Self::GA(region) => { + if *region != Region::Any { + f.write_str("GA_")?; + ::fmt(region, f) + } else { + f.write_str("GA") + } +} + +// Italian IT +Self::IT(region) => { + if *region != Region::Any { + f.write_str("IT_")?; + ::fmt(region, f) + } else { + f.write_str("IT") + } +} + +// Japanese JA +Self::JA(region) => { + if *region != Region::Any { + f.write_str("JA_")?; + ::fmt(region, f) + } else { + f.write_str("JA") + } +} + +// Javanese JW +Self::JW(region) => { + if *region != Region::Any { + f.write_str("JW_")?; + ::fmt(region, f) + } else { + f.write_str("JW") + } +} + +// Kannada KN +Self::KN(region) => { + if *region != Region::Any { + f.write_str("KN_")?; + ::fmt(region, f) + } else { + f.write_str("KN") + } +} + +// Kashmiri KS +Self::KS(region) => { + if *region != Region::Any { + f.write_str("KS_")?; + ::fmt(region, f) + } else { + f.write_str("KS") + } +} + +// Kazakh KK +Self::KK(region) => { + if *region != Region::Any { + f.write_str("KK_")?; + ::fmt(region, f) + } else { + f.write_str("KK") + } +} + +// Kinyarwanda RW +Self::RW(region) => { + if *region != Region::Any { + f.write_str("RW_")?; + ::fmt(region, f) + } else { + f.write_str("RW") + } +} + +// Kirghiz KY +Self::KY(region) => { + if *region != Region::Any { + f.write_str("KY_")?; + ::fmt(region, f) + } else { + f.write_str("KY") + } +} + +// Kirundi RN +Self::RN(region) => { + if *region != Region::Any { + f.write_str("RN_")?; + ::fmt(region, f) + } else { + f.write_str("RN") + } +} + +// Korean KO +Self::KO(region) => { + if *region != Region::Any { + f.write_str("KO_")?; + ::fmt(region, f) + } else { + f.write_str("KO") + } +} + +// Kurdish KU +Self::KU(region) => { + if *region != Region::Any { + f.write_str("KU_")?; + ::fmt(region, f) + } else { + f.write_str("KU") + } +} + +// Laothian LO +Self::LO(region) => { + if *region != Region::Any { + f.write_str("LO_")?; + ::fmt(region, f) + } else { + f.write_str("LO") + } +} + +// Latin LA +Self::LA(region) => { + if *region != Region::Any { + f.write_str("LA_")?; + ::fmt(region, f) + } else { + f.write_str("LA") + } +} + +// Latvian, Lettish LV +Self::LV(region) => { + if *region != Region::Any { + f.write_str("LV_")?; + ::fmt(region, f) + } else { + f.write_str("LV") + } +} + +// Lingala LN +Self::LN(region) => { + if *region != Region::Any { + f.write_str("LN_")?; + ::fmt(region, f) + } else { + f.write_str("LN") + } +} + +// Lithuanian LT +Self::LT(region) => { + if *region != Region::Any { + f.write_str("LT_")?; + ::fmt(region, f) + } else { + f.write_str("LT") + } +} + +// Macedonian MK +Self::MK(region) => { + if *region != Region::Any { + f.write_str("MK_")?; + ::fmt(region, f) + } else { + f.write_str("MK") + } +} + +// Malagasy MG +Self::MG(region) => { + if *region != Region::Any { + f.write_str("MG_")?; + ::fmt(region, f) + } else { + f.write_str("MG") + } +} + +// Malay MS +Self::MS(region) => { + if *region != Region::Any { + f.write_str("MS_")?; + ::fmt(region, f) + } else { + f.write_str("MS") + } +} + +// Malayalam ML +Self::ML(region) => { + if *region != Region::Any { + f.write_str("ML_")?; + ::fmt(region, f) + } else { + f.write_str("ML") + } +} + +// Maltese MT +Self::MT(region) => { + if *region != Region::Any { + f.write_str("MT_")?; + ::fmt(region, f) + } else { + f.write_str("MT") + } +} + +// Maori MI +Self::MI(region) => { + if *region != Region::Any { + f.write_str("MI_")?; + ::fmt(region, f) + } else { + f.write_str("MI") + } +} + +// Marathi MR +Self::MR(region) => { + if *region != Region::Any { + f.write_str("MR_")?; + ::fmt(region, f) + } else { + f.write_str("MR") + } +} + +// Moldavian MO +Self::MO(region) => { + if *region != Region::Any { + f.write_str("MO_")?; + ::fmt(region, f) + } else { + f.write_str("MO") + } +} + +// Mongolian MN +Self::MN(region) => { + if *region != Region::Any { + f.write_str("MN_")?; + ::fmt(region, f) + } else { + f.write_str("MN") + } +} + +// Nauru NA +Self::NA(region) => { + if *region != Region::Any { + f.write_str("NA_")?; + ::fmt(region, f) + } else { + f.write_str("NA") + } +} + +// Nepali NE +Self::NE(region) => { + if *region != Region::Any { + f.write_str("NE_")?; + ::fmt(region, f) + } else { + f.write_str("NE") + } +} + +// Norwegian NO +Self::NO(region) => { + if *region != Region::Any { + f.write_str("NO_")?; + ::fmt(region, f) + } else { + f.write_str("NO") + } +} + +// Occitan OC +Self::OC(region) => { + if *region != Region::Any { + f.write_str("OC_")?; + ::fmt(region, f) + } else { + f.write_str("OC") + } +} + +// Oriya OR +Self::OR(region) => { + if *region != Region::Any { + f.write_str("OR_")?; + ::fmt(region, f) + } else { + f.write_str("OR") + } +} + +// Oromo, Afan OM +Self::OM(region) => { + if *region != Region::Any { + f.write_str("OM_")?; + ::fmt(region, f) + } else { + f.write_str("OM") + } +} + +// Pashto, Pushto PS +Self::PS(region) => { + if *region != Region::Any { + f.write_str("PS_")?; + ::fmt(region, f) + } else { + f.write_str("PS") + } +} + +// Persian FA +Self::FA(region) => { + if *region != Region::Any { + f.write_str("FA_")?; + ::fmt(region, f) + } else { + f.write_str("FA") + } +} + +// Polish PL +Self::PL(region) => { + if *region != Region::Any { + f.write_str("PL_")?; + ::fmt(region, f) + } else { + f.write_str("PL") + } +} + +// Portuguese PT +Self::PT(region) => { + if *region != Region::Any { + f.write_str("PT_")?; + ::fmt(region, f) + } else { + f.write_str("PT") + } +} + +// Punjabi PA +Self::PA(region) => { + if *region != Region::Any { + f.write_str("PA_")?; + ::fmt(region, f) + } else { + f.write_str("PA") + } +} + +// Quechua QU +Self::QU(region) => { + if *region != Region::Any { + f.write_str("QU_")?; + ::fmt(region, f) + } else { + f.write_str("QU") + } +} + +// Rhaeto-Romance RM +Self::RM(region) => { + if *region != Region::Any { + f.write_str("RM_")?; + ::fmt(region, f) + } else { + f.write_str("RM") + } +} + +// Romanian RO +Self::RO(region) => { + if *region != Region::Any { + f.write_str("RO_")?; + ::fmt(region, f) + } else { + f.write_str("RO") + } +} + +// Russian RU +Self::RU(region) => { + if *region != Region::Any { + f.write_str("RU_")?; + ::fmt(region, f) + } else { + f.write_str("RU") + } +} + +// Samoan SM +Self::SM(region) => { + if *region != Region::Any { + f.write_str("SM_")?; + ::fmt(region, f) + } else { + f.write_str("SM") + } +} + +// Sangro SG +Self::SG(region) => { + if *region != Region::Any { + f.write_str("SG_")?; + ::fmt(region, f) + } else { + f.write_str("SG") + } +} + +// Sanskrit SA +Self::SA(region) => { + if *region != Region::Any { + f.write_str("SA_")?; + ::fmt(region, f) + } else { + f.write_str("SA") + } +} + +// Serbian SR +Self::SR(region) => { + if *region != Region::Any { + f.write_str("SR_")?; + ::fmt(region, f) + } else { + f.write_str("SR") + } +} + +// Serbo-Croatian SH +Self::SH(region) => { + if *region != Region::Any { + f.write_str("SH_")?; + ::fmt(region, f) + } else { + f.write_str("SH") + } +} + +// Sesotho ST +Self::ST(region) => { + if *region != Region::Any { + f.write_str("ST_")?; + ::fmt(region, f) + } else { + f.write_str("ST") + } +} + +// Setswana TN +Self::TN(region) => { + if *region != Region::Any { + f.write_str("TN_")?; + ::fmt(region, f) + } else { + f.write_str("TN") + } +} + +// Shona SN +Self::SN(region) => { + if *region != Region::Any { + f.write_str("SN_")?; + ::fmt(region, f) + } else { + f.write_str("SN") + } +} + +// Sindhi SD +Self::SD(region) => { + if *region != Region::Any { + f.write_str("SD_")?; + ::fmt(region, f) + } else { + f.write_str("SD") + } +} + +// Singhalese SI +Self::SI(region) => { + if *region != Region::Any { + f.write_str("SI_")?; + ::fmt(region, f) + } else { + f.write_str("SI") + } +} + +// Siswati SS +Self::SS(region) => { + if *region != Region::Any { + f.write_str("SS_")?; + ::fmt(region, f) + } else { + f.write_str("SS") + } +} + +// Slovak SK +Self::SK(region) => { + if *region != Region::Any { + f.write_str("SK_")?; + ::fmt(region, f) + } else { + f.write_str("SK") + } +} + +// Slovenian SL +Self::SL(region) => { + if *region != Region::Any { + f.write_str("SL_")?; + ::fmt(region, f) + } else { + f.write_str("SL") + } +} + +// Somali SO +Self::SO(region) => { + if *region != Region::Any { + f.write_str("SO_")?; + ::fmt(region, f) + } else { + f.write_str("SO") + } +} + +// Spanish ES +Self::ES(region) => { + if *region != Region::Any { + f.write_str("ES_")?; + ::fmt(region, f) + } else { + f.write_str("ES") + } +} + +// Sudanese SU +Self::SU(region) => { + if *region != Region::Any { + f.write_str("SU_")?; + ::fmt(region, f) + } else { + f.write_str("SU") + } +} + +// Swahili SW +Self::SW(region) => { + if *region != Region::Any { + f.write_str("SW_")?; + ::fmt(region, f) + } else { + f.write_str("SW") + } +} + +// Swedish SV +Self::SV(region) => { + if *region != Region::Any { + f.write_str("SV_")?; + ::fmt(region, f) + } else { + f.write_str("SV") + } +} + +// Tagalog TL +Self::TL(region) => { + if *region != Region::Any { + f.write_str("TL_")?; + ::fmt(region, f) + } else { + f.write_str("TL") + } +} + +// Tajik TG +Self::TG(region) => { + if *region != Region::Any { + f.write_str("TG_")?; + ::fmt(region, f) + } else { + f.write_str("TG") + } +} + +// Tamil TA +Self::TA(region) => { + if *region != Region::Any { + f.write_str("TA_")?; + ::fmt(region, f) + } else { + f.write_str("TA") + } +} + +// Tatar TT +Self::TT(region) => { + if *region != Region::Any { + f.write_str("TT_")?; + ::fmt(region, f) + } else { + f.write_str("TT") + } +} + +// Tegulu TE +Self::TE(region) => { + if *region != Region::Any { + f.write_str("TE_")?; + ::fmt(region, f) + } else { + f.write_str("TE") + } +} + +// Thai TH +Self::TH(region) => { + if *region != Region::Any { + f.write_str("TH_")?; + ::fmt(region, f) + } else { + f.write_str("TH") + } +} + +// Tibetan BO +Self::BO(region) => { + if *region != Region::Any { + f.write_str("BO_")?; + ::fmt(region, f) + } else { + f.write_str("BO") + } +} + +// Tigrinya TI +Self::TI(region) => { + if *region != Region::Any { + f.write_str("TI_")?; + ::fmt(region, f) + } else { + f.write_str("TI") + } +} + +// Tonga TO +Self::TO(region) => { + if *region != Region::Any { + f.write_str("TO_")?; + ::fmt(region, f) + } else { + f.write_str("TO") + } +} + +// Tsonga TS +Self::TS(region) => { + if *region != Region::Any { + f.write_str("TS_")?; + ::fmt(region, f) + } else { + f.write_str("TS") + } +} + +// Turkish TR +Self::TR(region) => { + if *region != Region::Any { + f.write_str("TR_")?; + ::fmt(region, f) + } else { + f.write_str("TR") + } +} + +// Turkmen TK +Self::TK(region) => { + if *region != Region::Any { + f.write_str("TK_")?; + ::fmt(region, f) + } else { + f.write_str("TK") + } +} + +// Twi TW +Self::TW(region) => { + if *region != Region::Any { + f.write_str("TW_")?; + ::fmt(region, f) + } else { + f.write_str("TW") + } +} + +// Ukrainian UK +Self::UK(region) => { + if *region != Region::Any { + f.write_str("UK_")?; + ::fmt(region, f) + } else { + f.write_str("UK") + } +} + +// Urdu UR +Self::UR(region) => { + if *region != Region::Any { + f.write_str("UR_")?; + ::fmt(region, f) + } else { + f.write_str("UR") + } +} + +// Uzbek UZ +Self::UZ(region) => { + if *region != Region::Any { + f.write_str("UZ_")?; + ::fmt(region, f) + } else { + f.write_str("UZ") + } +} + +// Vietnamese VI +Self::VI(region) => { + if *region != Region::Any { + f.write_str("VI_")?; + ::fmt(region, f) + } else { + f.write_str("VI") + } +} + +// Volapuk VO +Self::VO(region) => { + if *region != Region::Any { + f.write_str("VO_")?; + ::fmt(region, f) + } else { + f.write_str("VO") + } +} + +// Welsh CY +Self::CY(region) => { + if *region != Region::Any { + f.write_str("CY_")?; + ::fmt(region, f) + } else { + f.write_str("CY") + } +} + +// Wolof WO +Self::WO(region) => { + if *region != Region::Any { + f.write_str("WO_")?; + ::fmt(region, f) + } else { + f.write_str("WO") + } +} + +// Xhosa XH +Self::XH(region) => { + if *region != Region::Any { + f.write_str("XH_")?; + ::fmt(region, f) + } else { + f.write_str("XH") + } +} + +// Yiddish JI +Self::JI(region) => { + if *region != Region::Any { + f.write_str("JI_")?; + ::fmt(region, f) + } else { + f.write_str("JI") + } +} + +// Yoruba YO +Self::YO(region) => { + if *region != Region::Any { + f.write_str("YO_")?; + ::fmt(region, f) + } else { + f.write_str("YO") + } +} + +// Zulu ZU +Self::ZU(region) => { + if *region != Region::Any { + f.write_str("ZU_")?; + ::fmt(region, f) + } else { + f.write_str("ZU") + } +} + diff --git a/src/lib.rs b/src/lib.rs index 8240624..8a256d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2047,7 +2047,7 @@ pub enum Language { /// `SG`: Sangro #[doc(hidden)] - SG(Region), + Sg(Region), /// `sa`: Sanskrit #[doc(hidden)] @@ -2311,7 +2311,7 @@ impl Language { Self::Ro(region) => *region, // Romanian RO Self::Ru(region) => *region, // Russian RU Self::Sm(region) => *region, // Samoan SM - Self::SG(region) => *region, // Sangro SG + Self::Sg(region) => *region, // Sangro SG Self::Sa(region) => *region, // Sanskrit SA Self::Sr(region) => *region, // Serbian SR Self::Sh(region) => *region, // Serbo-Croatian SH @@ -2360,14 +2360,1088 @@ impl Display for Language { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { Self::__(code) => f.write_str(code.as_str()), + + // Abkhazian AB + Self::Ab(region) => { + if *region != Region::Any { + f.write_str("ab_")?; + ::fmt(region, f) + } else { + f.write_str("ab") + } + } + + // Afar AA + Self::Aa(region) => { + if *region != Region::Any { + f.write_str("aa_")?; + ::fmt(region, f) + } else { + f.write_str("aa") + } + } + + // Afrikaans AF + Self::Af(region) => { + if *region != Region::Any { + f.write_str("af_")?; + ::fmt(region, f) + } else { + f.write_str("af") + } + } + + // Albanian SQ + Self::Sq(region) => { + if *region != Region::Any { + f.write_str("sq_")?; + ::fmt(region, f) + } else { + f.write_str("sq") + } + } + + // Amharic AM + Self::Am(region) => { + if *region != Region::Any { + f.write_str("am_")?; + ::fmt(region, f) + } else { + f.write_str("am") + } + } + + // Arabic AR + Self::Ar(region) => { + if *region != Region::Any { + f.write_str("ar_")?; + ::fmt(region, f) + } else { + f.write_str("ar") + } + } + + // Armenian HY + Self::Hy(region) => { + if *region != Region::Any { + f.write_str("hy_")?; + ::fmt(region, f) + } else { + f.write_str("hy") + } + } + + // Assamese AS + Self::As(region) => { + if *region != Region::Any { + f.write_str("as_")?; + ::fmt(region, f) + } else { + f.write_str("as") + } + } + + // Aymara AY + Self::Ay(region) => { + if *region != Region::Any { + f.write_str("ay_")?; + ::fmt(region, f) + } else { + f.write_str("ay") + } + } + + // Azerbaijani AZ + Self::Az(region) => { + if *region != Region::Any { + f.write_str("az_")?; + ::fmt(region, f) + } else { + f.write_str("az") + } + } + + // Bashkir BA + Self::Ba(region) => { + if *region != Region::Any { + f.write_str("ba_")?; + ::fmt(region, f) + } else { + f.write_str("ba") + } + } + + // Basque EU + Self::Eu(region) => { + if *region != Region::Any { + f.write_str("eu_")?; + ::fmt(region, f) + } else { + f.write_str("eu") + } + } + + // Bengali, Bangla BN + Self::Bn(region) => { + if *region != Region::Any { + f.write_str("bn_")?; + ::fmt(region, f) + } else { + f.write_str("bn") + } + } + + // Bhutani DZ + Self::Dz(region) => { + if *region != Region::Any { + f.write_str("dz_")?; + ::fmt(region, f) + } else { + f.write_str("dz") + } + } + + // Bihari BH + Self::Bh(region) => { + if *region != Region::Any { + f.write_str("bh_")?; + ::fmt(region, f) + } else { + f.write_str("bh") + } + } + + // Bislama BI + Self::BI(region) => { + if *region != Region::Any { + f.write_str("bi_")?; + ::fmt(region, f) + } else { + f.write_str("bi") + } + } + + // Breton BR + Self::Br(region) => { + if *region != Region::Any { + f.write_str("br_")?; + ::fmt(region, f) + } else { + f.write_str("br") + } + } + + // Bulgarian BG + Self::Bg(region) => { + if *region != Region::Any { + f.write_str("bg_")?; + ::fmt(region, f) + } else { + f.write_str("bg") + } + } + + // Burmese MY + Self::My(region) => { + if *region != Region::Any { + f.write_str("my_")?; + ::fmt(region, f) + } else { + f.write_str("my") + } + } + + // Byelorussian BE + Self::Be(region) => { + if *region != Region::Any { + f.write_str("be_")?; + ::fmt(region, f) + } else { + f.write_str("be") + } + } + + // Cambodian KM + Self::Km(region) => { + if *region != Region::Any { + f.write_str("km_")?; + ::fmt(region, f) + } else { + f.write_str("km") + } + } + + // Catalan CA + Self::Ca(region) => { + if *region != Region::Any { + f.write_str("ca_")?; + ::fmt(region, f) + } else { + f.write_str("ca") + } + } + + // Chinese ZH + Self::Zh(region) => { + if *region != Region::Any { + f.write_str("zh_")?; + ::fmt(region, f) + } else { + f.write_str("zh") + } + } + + // Corsican CO + Self::Co(region) => { + if *region != Region::Any { + f.write_str("co_")?; + ::fmt(region, f) + } else { + f.write_str("co") + } + } + + // Croatian HR + Self::Hr(region) => { + if *region != Region::Any { + f.write_str("hr_")?; + ::fmt(region, f) + } else { + f.write_str("hr") + } + } + + // Czech CS + Self::Cs(region) => { + if *region != Region::Any { + f.write_str("cs_")?; + ::fmt(region, f) + } else { + f.write_str("cs") + } + } + + // Danish DA + Self::Da(region) => { + if *region != Region::Any { + f.write_str("da_")?; + ::fmt(region, f) + } else { + f.write_str("da") + } + } + + // Dutch NL + Self::Nl(region) => { + if *region != Region::Any { + f.write_str("nl_")?; + ::fmt(region, f) + } else { + f.write_str("nl") + } + } + + // English, American EN Self::En(region) => { if *region != Region::Any { - f.write_str("en_")?; + f.write_str("en_")?; + ::fmt(region, f) + } else { + f.write_str("en") + } + } + + // Esperanto EO + Self::Eo(region) => { + if *region != Region::Any { + f.write_str("eo_")?; + ::fmt(region, f) + } else { + f.write_str("eo") + } + } + + // Estonian ET + Self::Et(region) => { + if *region != Region::Any { + f.write_str("et_")?; + ::fmt(region, f) + } else { + f.write_str("et") + } + } + + // Faeroese FO + Self::Fo(region) => { + if *region != Region::Any { + f.write_str("fo_")?; + ::fmt(region, f) + } else { + f.write_str("fo") + } + } + + // Fiji FJ + Self::Fj(region) => { + if *region != Region::Any { + f.write_str("fj_")?; + ::fmt(region, f) + } else { + f.write_str("fj") + } + } + + // Finnish FI + Self::Fi(region) => { + if *region != Region::Any { + f.write_str("fi_")?; + ::fmt(region, f) + } else { + f.write_str("fi") + } + } + + // French FR + Self::Fr(region) => { + if *region != Region::Any { + f.write_str("fr_")?; + ::fmt(region, f) + } else { + f.write_str("fr") + } + } + + // Frisian FY + Self::Fy(region) => { + if *region != Region::Any { + f.write_str("fy_")?; + ::fmt(region, f) + } else { + f.write_str("fy") + } + } + + // Gaelic (Scots Gaelic) GD + Self::Gd(region) => { + if *region != Region::Any { + f.write_str("gd_")?; + ::fmt(region, f) + } else { + f.write_str("gd") + } + } + + // Galician GL + Self::Gl(region) => { + if *region != Region::Any { + f.write_str("gl_")?; + ::fmt(region, f) + } else { + f.write_str("gl") + } + } + + // Georgian KA + Self::Ka(region) => { + if *region != Region::Any { + f.write_str("ka_")?; + ::fmt(region, f) + } else { + f.write_str("ka") + } + } + + // German DE + Self::De(region) => { + if *region != Region::Any { + f.write_str("de_")?; + ::fmt(region, f) + } else { + f.write_str("de") + } + } + + // Greek EL + Self::El(region) => { + if *region != Region::Any { + f.write_str("el_")?; + ::fmt(region, f) + } else { + f.write_str("el") + } + } + + // Greenlandic KL + Self::Kl(region) => { + if *region != Region::Any { + f.write_str("kl_")?; + ::fmt(region, f) + } else { + f.write_str("kl") + } + } + + // Guarani GN + Self::Gn(region) => { + if *region != Region::Any { + f.write_str("gn_")?; + ::fmt(region, f) + } else { + f.write_str("gn") + } + } + + // Gujarati GU + Self::Gu(region) => { + if *region != Region::Any { + f.write_str("gu_")?; + ::fmt(region, f) + } else { + f.write_str("gu") + } + } + + // Hausa HA + Self::Ha(region) => { + if *region != Region::Any { + f.write_str("ha_")?; + ::fmt(region, f) + } else { + f.write_str("ha") + } + } + + // Hebrew IW + Self::Iw(region) => { + if *region != Region::Any { + f.write_str("iw_")?; + ::fmt(region, f) + } else { + f.write_str("iw") + } + } + + // Hindi HI + Self::Hi(region) => { + if *region != Region::Any { + f.write_str("hi_")?; + ::fmt(region, f) + } else { + f.write_str("hi") + } + } + + // Hungarian HU + Self::Hu(region) => { + if *region != Region::Any { + f.write_str("hu_")?; + ::fmt(region, f) + } else { + f.write_str("hu") + } + } + + // Icelandic IS + Self::Is(region) => { + if *region != Region::Any { + f.write_str("is_")?; + ::fmt(region, f) + } else { + f.write_str("is") + } + } + + // Indonesian IN + Self::In(region) => { + if *region != Region::Any { + f.write_str("in_")?; + ::fmt(region, f) + } else { + f.write_str("in") + } + } + + // Interlingua IA + Self::Ia(region) => { + if *region != Region::Any { + f.write_str("ia_")?; + ::fmt(region, f) + } else { + f.write_str("ia") + } + } + + // Interlingue IE + Self::Ie(region) => { + if *region != Region::Any { + f.write_str("ie_")?; + ::fmt(region, f) + } else { + f.write_str("ie") + } + } + + // Inupiak IK + Self::Ik(region) => { + if *region != Region::Any { + f.write_str("ik_")?; + ::fmt(region, f) + } else { + f.write_str("ik") + } + } + + // Irish GA + Self::Ga(region) => { + if *region != Region::Any { + f.write_str("ga_")?; + ::fmt(region, f) + } else { + f.write_str("ga") + } + } + + // Italian IT + Self::It(region) => { + if *region != Region::Any { + f.write_str("it_")?; + ::fmt(region, f) + } else { + f.write_str("it") + } + } + + // Japanese JA + Self::Ja(region) => { + if *region != Region::Any { + f.write_str("ja_")?; + ::fmt(region, f) + } else { + f.write_str("ja") + } + } + + // Javanese JW + Self::Jw(region) => { + if *region != Region::Any { + f.write_str("jw_")?; + ::fmt(region, f) + } else { + f.write_str("jw") + } + } + + // Kannada KN + Self::Kn(region) => { + if *region != Region::Any { + f.write_str("kn_")?; + ::fmt(region, f) + } else { + f.write_str("kn") + } + } + + // Kashmiri KS + Self::Ks(region) => { + if *region != Region::Any { + f.write_str("ks_")?; + ::fmt(region, f) + } else { + f.write_str("ks") + } + } + + // Kazakh KK + Self::Kk(region) => { + if *region != Region::Any { + f.write_str("kk_")?; + ::fmt(region, f) + } else { + f.write_str("kk") + } + } + + // Kinyarwanda RW + Self::Rw(region) => { + if *region != Region::Any { + f.write_str("rw_")?; + ::fmt(region, f) + } else { + f.write_str("rw") + } + } + + // Kirghiz KY + Self::Ky(region) => { + if *region != Region::Any { + f.write_str("ky_")?; + ::fmt(region, f) + } else { + f.write_str("ky") + } + } + + // Kirundi RN + Self::Rn(region) => { + if *region != Region::Any { + f.write_str("rn_")?; + ::fmt(region, f) + } else { + f.write_str("rn") + } + } + + // Korean KO + Self::Ko(region) => { + if *region != Region::Any { + f.write_str("ko_")?; + ::fmt(region, f) + } else { + f.write_str("ko") + } + } + + // Kurdish KU + Self::Ku(region) => { + if *region != Region::Any { + f.write_str("ku_")?; + ::fmt(region, f) + } else { + f.write_str("ku") + } + } + + // Laothian LO + Self::Lo(region) => { + if *region != Region::Any { + f.write_str("lo_")?; + ::fmt(region, f) + } else { + f.write_str("lo") + } + } + + // Latin LA + Self::La(region) => { + if *region != Region::Any { + f.write_str("la_")?; + ::fmt(region, f) + } else { + f.write_str("la") + } + } + + // Latvian, Lettish LV + Self::Lv(region) => { + if *region != Region::Any { + f.write_str("lv_")?; + ::fmt(region, f) + } else { + f.write_str("lv") + } + } + + // Lingala LN + Self::Ln(region) => { + if *region != Region::Any { + f.write_str("ln_")?; + ::fmt(region, f) + } else { + f.write_str("ln") + } + } + + // Lithuanian LT + Self::Lt(region) => { + if *region != Region::Any { + f.write_str("lt_")?; + ::fmt(region, f) + } else { + f.write_str("lt") + } + } + + // Macedonian MK + Self::Mk(region) => { + if *region != Region::Any { + f.write_str("mk_")?; + ::fmt(region, f) + } else { + f.write_str("mk") + } + } + + // Malagasy MG + Self::Mg(region) => { + if *region != Region::Any { + f.write_str("mg_")?; + ::fmt(region, f) + } else { + f.write_str("mg") + } + } + + // Malay MS + Self::Ms(region) => { + if *region != Region::Any { + f.write_str("ms_")?; + ::fmt(region, f) + } else { + f.write_str("ms") + } + } + + // Malayalam ML + Self::Ml(region) => { + if *region != Region::Any { + f.write_str("ml_")?; + ::fmt(region, f) + } else { + f.write_str("ml") + } + } + + // Maltese MT + Self::Mt(region) => { + if *region != Region::Any { + f.write_str("mt_")?; + ::fmt(region, f) + } else { + f.write_str("mt") + } + } + + // Maori MI + Self::Mi(region) => { + if *region != Region::Any { + f.write_str("mi_")?; + ::fmt(region, f) + } else { + f.write_str("mi") + } + } + + // Marathi MR + Self::Mr(region) => { + if *region != Region::Any { + f.write_str("mr_")?; + ::fmt(region, f) + } else { + f.write_str("mr") + } + } + + // Moldavian MO + Self::Mo(region) => { + if *region != Region::Any { + f.write_str("mo_")?; + ::fmt(region, f) + } else { + f.write_str("mo") + } + } + + // Mongolian MN + Self::Mn(region) => { + if *region != Region::Any { + f.write_str("mn_")?; + ::fmt(region, f) + } else { + f.write_str("mn") + } + } + + // Nauru NA + Self::Na(region) => { + if *region != Region::Any { + f.write_str("na_")?; + ::fmt(region, f) + } else { + f.write_str("na") + } + } + + // Nepali NE + Self::Ne(region) => { + if *region != Region::Any { + f.write_str("ne_")?; + ::fmt(region, f) + } else { + f.write_str("ne") + } + } + + // Norwegian NO + Self::No(region) => { + if *region != Region::Any { + f.write_str("no_")?; + ::fmt(region, f) + } else { + f.write_str("no") + } + } + + // Occitan OC + Self::Oc(region) => { + if *region != Region::Any { + f.write_str("oc_")?; + ::fmt(region, f) + } else { + f.write_str("oc") + } + } + + // Oriya OR + Self::Or(region) => { + if *region != Region::Any { + f.write_str("or_")?; + ::fmt(region, f) + } else { + f.write_str("or") + } + } + + // Oromo, Afan OM + Self::Om(region) => { + if *region != Region::Any { + f.write_str("om_")?; + ::fmt(region, f) + } else { + f.write_str("om") + } + } + + // Pashto, Pushto PS + Self::Ps(region) => { + if *region != Region::Any { + f.write_str("ps_")?; + ::fmt(region, f) + } else { + f.write_str("ps") + } + } + + // Persian FA + Self::Fa(region) => { + if *region != Region::Any { + f.write_str("fa_")?; + ::fmt(region, f) + } else { + f.write_str("fa") + } + } + + // Polish PL + Self::Pl(region) => { + if *region != Region::Any { + f.write_str("pl_")?; + ::fmt(region, f) + } else { + f.write_str("pl") + } + } + + // Portuguese PT + Self::Pt(region) => { + if *region != Region::Any { + f.write_str("pt_")?; + ::fmt(region, f) + } else { + f.write_str("pt") + } + } + + // Punjabi PA + Self::Pa(region) => { + if *region != Region::Any { + f.write_str("pd_")?; + ::fmt(region, f) + } else { + f.write_str("pa") + } + } + + // Quechua QU + Self::Qu(region) => { + if *region != Region::Any { + f.write_str("qu_")?; + ::fmt(region, f) + } else { + f.write_str("qu") + } + } + + // Rhaeto-Romance RM + Self::Rm(region) => { + if *region != Region::Any { + f.write_str("rm_")?; + ::fmt(region, f) + } else { + f.write_str("rm") + } + } + + // Romanian RO + Self::Ro(region) => { + if *region != Region::Any { + f.write_str("ro_")?; ::fmt(region, f) } else { - f.write_str("en") + f.write_str("ro") + } + } + + // Russian RU + Self::Ru(region) => { + if *region != Region::Any { + f.write_str("ru_")?; + ::fmt(region, f) + } else { + f.write_str("ru") + } + } + + // Samoan SM + Self::Sm(region) => { + if *region != Region::Any { + f.write_str("sm_")?; + ::fmt(region, f) + } else { + f.write_str("sm") + } + } + + // Sangro SG + Self::Sg(region) => { + if *region != Region::Any { + f.write_str("sg_")?; + ::fmt(region, f) + } else { + f.write_str("sg") + } + } + + // Sanskrit SA + Self::Sa(region) => { + if *region != Region::Any { + f.write_str("sa_")?; + ::fmt(region, f) + } else { + f.write_str("sa") + } + } + + // Serbian SR + Self::Sr(region) => { + if *region != Region::Any { + f.write_str("sr_")?; + ::fmt(region, f) + } else { + f.write_str("sr") + } + } + + // Serbo-Croatian SH + Self::Sh(region) => { + if *region != Region::Any { + f.write_str("sh_")?; + ::fmt(region, f) + } else { + f.write_str("sh") + } + } + + // Sesotho ST + Self::St(region) => { + if *region != Region::Any { + f.write_str("st_")?; + ::fmt(region, f) + } else { + f.write_str("st") + } + } + + // Setswana TN + Self::Tn(region) => { + if *region != Region::Any { + f.write_str("tn_")?; + ::fmt(region, f) + } else { + f.write_str("tn") + } + } + + // Shona SN + Self::Sn(region) => { + if *region != Region::Any { + f.write_str("sn_")?; + ::fmt(region, f) + } else { + f.write_str("sn") + } + } + + // Sindhi SD + Self::Sd(region) => { + if *region != Region::Any { + f.write_str("sd_")?; + ::fmt(region, f) + } else { + f.write_str("sd") } } + + // Singhalese SI + Self::Si(region) => { + if *region != Region::Any { + f.write_str("si_")?; + ::fmt(region, f) + } else { + f.write_str("si") + } + } + + // Siswati SS + Self::Ss(region) => { + if *region != Region::Any { + f.write_str("ss_")?; + ::fmt(region, f) + } else { + f.write_str("ss") + } + } + + // Slovak SK + Self::Sk(region) => { + if *region != Region::Any { + f.write_str("sk_")?; + ::fmt(region, f) + } else { + f.write_str("sk") + } + } + + // Slovenian SL + Self::Sl(region) => { + if *region != Region::Any { + f.write_str("Sl_")?; + ::fmt(region, f) + } else { + f.write_str("Sl") + } + } + + // Somali SO + Self::So(region) => { + if *region != Region::Any { + f.write_str("so_")?; + ::fmt(region, f) + } else { + f.write_str("so") + } + } + + // Spanish ES Self::Es(region) => { if *region != Region::Any { f.write_str("es_")?; @@ -2376,8 +3450,275 @@ impl Display for Language { f.write_str("es") } } - _ => { - f.write_str("unknown language") + + // Sudanese SU + Self::Su(region) => { + if *region != Region::Any { + f.write_str("su_")?; + ::fmt(region, f) + } else { + f.write_str("su") + } + } + + // Swahili SW + Self::Sw(region) => { + if *region != Region::Any { + f.write_str("sw_")?; + ::fmt(region, f) + } else { + f.write_str("sw") + } + } + + // Swedish SV + Self::Sv(region) => { + if *region != Region::Any { + f.write_str("sv_")?; + ::fmt(region, f) + } else { + f.write_str("sv") + } + } + + // Tagalog TL + Self::Tl(region) => { + if *region != Region::Any { + f.write_str("tl_")?; + ::fmt(region, f) + } else { + f.write_str("tl") + } + } + + // Tajik TG + Self::Tg(region) => { + if *region != Region::Any { + f.write_str("tg_")?; + ::fmt(region, f) + } else { + f.write_str("tg") + } + } + + // Tamil TA + Self::Ta(region) => { + if *region != Region::Any { + f.write_str("ta_")?; + ::fmt(region, f) + } else { + f.write_str("ta") + } + } + + // Tatar TT + Self::Tt(region) => { + if *region != Region::Any { + f.write_str("tt_")?; + ::fmt(region, f) + } else { + f.write_str("tt") + } + } + + // Tegulu TE + Self::Te(region) => { + if *region != Region::Any { + f.write_str("te_")?; + ::fmt(region, f) + } else { + f.write_str("te") + } + } + + // Thai TH + Self::Th(region) => { + if *region != Region::Any { + f.write_str("th_")?; + ::fmt(region, f) + } else { + f.write_str("th") + } + } + + // Tibetan BO + Self::Bo(region) => { + if *region != Region::Any { + f.write_str("bo_")?; + ::fmt(region, f) + } else { + f.write_str("bo") + } + } + + // Tigrinya TI + Self::Ti(region) => { + if *region != Region::Any { + f.write_str("ti_")?; + ::fmt(region, f) + } else { + f.write_str("ti") + } + } + + // Tonga TO + Self::To(region) => { + if *region != Region::Any { + f.write_str("to_")?; + ::fmt(region, f) + } else { + f.write_str("to") + } + } + + // Tsonga TS + Self::Ts(region) => { + if *region != Region::Any { + f.write_str("ts_")?; + ::fmt(region, f) + } else { + f.write_str("ts") + } + } + + // Turkish TR + Self::Tr(region) => { + if *region != Region::Any { + f.write_str("tr_")?; + ::fmt(region, f) + } else { + f.write_str("tr") + } + } + + // Turkmen TK + Self::Tk(region) => { + if *region != Region::Any { + f.write_str("tk_")?; + ::fmt(region, f) + } else { + f.write_str("tk") + } + } + + // Twi TW + Self::Tw(region) => { + if *region != Region::Any { + f.write_str("tw_")?; + ::fmt(region, f) + } else { + f.write_str("tw") + } + } + + // Ukrainian UK + Self::Uk(region) => { + if *region != Region::Any { + f.write_str("uk_")?; + ::fmt(region, f) + } else { + f.write_str("uk") + } + } + + // Urdu UR + Self::Ur(region) => { + if *region != Region::Any { + f.write_str("ur_")?; + ::fmt(region, f) + } else { + f.write_str("ur") + } + } + + // Uzbek UZ + Self::Uz(region) => { + if *region != Region::Any { + f.write_str("uz_")?; + ::fmt(region, f) + } else { + f.write_str("uz") + } + } + + // Vietnamese VI + Self::Vi(region) => { + if *region != Region::Any { + f.write_str("vi_")?; + ::fmt(region, f) + } else { + f.write_str("vi") + } + } + + // Volapuk VO + Self::Vo(region) => { + if *region != Region::Any { + f.write_str("vo_")?; + ::fmt(region, f) + } else { + f.write_str("vo") + } + } + + // Welsh CY + Self::Cy(region) => { + if *region != Region::Any { + f.write_str("cy_")?; + ::fmt(region, f) + } else { + f.write_str("cy") + } + } + + // Wolof WO + Self::Wo(region) => { + if *region != Region::Any { + f.write_str("wo_")?; + ::fmt(region, f) + } else { + f.write_str("wo") + } + } + + // Xhosa XH + Self::Xh(region) => { + if *region != Region::Any { + f.write_str("xh_")?; + ::fmt(region, f) + } else { + f.write_str("xh") + } + } + + // Yiddish JI + Self::Ji(region) => { + if *region != Region::Any { + f.write_str("ji_")?; + ::fmt(region, f) + } else { + f.write_str("ji") + } + } + + // Yoruba YO + Self::Yo(region) => { + if *region != Region::Any { + f.write_str("yo_")?; + ::fmt(region, f) + } else { + f.write_str("yo") + } + } + + // Zulu ZU + Self::Zu(region) => { + if *region != Region::Any { + f.write_str("zu_")?; + ::fmt(region, f) + } else { + f.write_str("zu") + } } } } From a614c051b5e7e5b91b058a6d1fec8d824cdccad0 Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Fri, 29 Dec 2023 15:32:48 +0200 Subject: [PATCH 7/9] language and region detection --- output.txt | 1360 ---------------------- rearanged.txt => rearanged_countries.txt | 0 src/lib.rs | 848 +++++++++++++- 3 files changed, 842 insertions(+), 1366 deletions(-) delete mode 100644 output.txt rename rearanged.txt => rearanged_countries.txt (100%) diff --git a/output.txt b/output.txt deleted file mode 100644 index 461ada6..0000000 --- a/output.txt +++ /dev/null @@ -1,1360 +0,0 @@ -// Abkhazian AB -Self::AB(region) => { - if *region != Region::Any { - f.write_str("AB_")?; - ::fmt(region, f) - } else { - f.write_str("AB") - } -} - -// Afar AA -Self::AA(region) => { - if *region != Region::Any { - f.write_str("AA_")?; - ::fmt(region, f) - } else { - f.write_str("AA") - } -} - -// Afrikaans AF -Self::AF(region) => { - if *region != Region::Any { - f.write_str("AF_")?; - ::fmt(region, f) - } else { - f.write_str("AF") - } -} - -// Albanian SQ -Self::SQ(region) => { - if *region != Region::Any { - f.write_str("SQ_")?; - ::fmt(region, f) - } else { - f.write_str("SQ") - } -} - -// Amharic AM -Self::AM(region) => { - if *region != Region::Any { - f.write_str("AM_")?; - ::fmt(region, f) - } else { - f.write_str("AM") - } -} - -// Arabic AR -Self::AR(region) => { - if *region != Region::Any { - f.write_str("AR_")?; - ::fmt(region, f) - } else { - f.write_str("AR") - } -} - -// Armenian HY -Self::HY(region) => { - if *region != Region::Any { - f.write_str("HY_")?; - ::fmt(region, f) - } else { - f.write_str("HY") - } -} - -// Assamese AS -Self::AS(region) => { - if *region != Region::Any { - f.write_str("AS_")?; - ::fmt(region, f) - } else { - f.write_str("AS") - } -} - -// Aymara AY -Self::AY(region) => { - if *region != Region::Any { - f.write_str("AY_")?; - ::fmt(region, f) - } else { - f.write_str("AY") - } -} - -// Azerbaijani AZ -Self::AZ(region) => { - if *region != Region::Any { - f.write_str("AZ_")?; - ::fmt(region, f) - } else { - f.write_str("AZ") - } -} - -// Bashkir BA -Self::BA(region) => { - if *region != Region::Any { - f.write_str("BA_")?; - ::fmt(region, f) - } else { - f.write_str("BA") - } -} - -// Basque EU -Self::EU(region) => { - if *region != Region::Any { - f.write_str("EU_")?; - ::fmt(region, f) - } else { - f.write_str("EU") - } -} - -// Bengali, Bangla BN -Self::BN(region) => { - if *region != Region::Any { - f.write_str("BN_")?; - ::fmt(region, f) - } else { - f.write_str("BN") - } -} - -// Bhutani DZ -Self::DZ(region) => { - if *region != Region::Any { - f.write_str("DZ_")?; - ::fmt(region, f) - } else { - f.write_str("DZ") - } -} - -// Bihari BH -Self::BH(region) => { - if *region != Region::Any { - f.write_str("BH_")?; - ::fmt(region, f) - } else { - f.write_str("BH") - } -} - -// Bislama BI -Self::BI(region) => { - if *region != Region::Any { - f.write_str("BI_")?; - ::fmt(region, f) - } else { - f.write_str("BI") - } -} - -// Breton BR -Self::BR(region) => { - if *region != Region::Any { - f.write_str("BR_")?; - ::fmt(region, f) - } else { - f.write_str("BR") - } -} - -// Bulgarian BG -Self::BG(region) => { - if *region != Region::Any { - f.write_str("BG_")?; - ::fmt(region, f) - } else { - f.write_str("BG") - } -} - -// Burmese MY -Self::MY(region) => { - if *region != Region::Any { - f.write_str("MY_")?; - ::fmt(region, f) - } else { - f.write_str("MY") - } -} - -// Byelorussian BE -Self::BE(region) => { - if *region != Region::Any { - f.write_str("BE_")?; - ::fmt(region, f) - } else { - f.write_str("BE") - } -} - -// Cambodian KM -Self::KM(region) => { - if *region != Region::Any { - f.write_str("KM_")?; - ::fmt(region, f) - } else { - f.write_str("KM") - } -} - -// Catalan CA -Self::CA(region) => { - if *region != Region::Any { - f.write_str("CA_")?; - ::fmt(region, f) - } else { - f.write_str("CA") - } -} - -// Chinese ZH -Self::ZH(region) => { - if *region != Region::Any { - f.write_str("ZH_")?; - ::fmt(region, f) - } else { - f.write_str("ZH") - } -} - -// Corsican CO -Self::CO(region) => { - if *region != Region::Any { - f.write_str("CO_")?; - ::fmt(region, f) - } else { - f.write_str("CO") - } -} - -// Croatian HR -Self::HR(region) => { - if *region != Region::Any { - f.write_str("HR_")?; - ::fmt(region, f) - } else { - f.write_str("HR") - } -} - -// Czech CS -Self::CS(region) => { - if *region != Region::Any { - f.write_str("CS_")?; - ::fmt(region, f) - } else { - f.write_str("CS") - } -} - -// Danish DA -Self::DA(region) => { - if *region != Region::Any { - f.write_str("DA_")?; - ::fmt(region, f) - } else { - f.write_str("DA") - } -} - -// Dutch NL -Self::NL(region) => { - if *region != Region::Any { - f.write_str("NL_")?; - ::fmt(region, f) - } else { - f.write_str("NL") - } -} - -// English, American EN -Self::EN(region) => { - if *region != Region::Any { - f.write_str("EN_")?; - ::fmt(region, f) - } else { - f.write_str("EN") - } -} - -// Esperanto EO -Self::EO(region) => { - if *region != Region::Any { - f.write_str("EO_")?; - ::fmt(region, f) - } else { - f.write_str("EO") - } -} - -// Estonian ET -Self::ET(region) => { - if *region != Region::Any { - f.write_str("ET_")?; - ::fmt(region, f) - } else { - f.write_str("ET") - } -} - -// Faeroese FO -Self::FO(region) => { - if *region != Region::Any { - f.write_str("FO_")?; - ::fmt(region, f) - } else { - f.write_str("FO") - } -} - -// Fiji FJ -Self::FJ(region) => { - if *region != Region::Any { - f.write_str("FJ_")?; - ::fmt(region, f) - } else { - f.write_str("FJ") - } -} - -// Finnish FI -Self::FI(region) => { - if *region != Region::Any { - f.write_str("FI_")?; - ::fmt(region, f) - } else { - f.write_str("FI") - } -} - -// French FR -Self::FR(region) => { - if *region != Region::Any { - f.write_str("FR_")?; - ::fmt(region, f) - } else { - f.write_str("FR") - } -} - -// Frisian FY -Self::FY(region) => { - if *region != Region::Any { - f.write_str("FY_")?; - ::fmt(region, f) - } else { - f.write_str("FY") - } -} - -// Gaelic (Scots Gaelic) GD -Self::GD(region) => { - if *region != Region::Any { - f.write_str("GD_")?; - ::fmt(region, f) - } else { - f.write_str("GD") - } -} - -// Galician GL -Self::GL(region) => { - if *region != Region::Any { - f.write_str("GL_")?; - ::fmt(region, f) - } else { - f.write_str("GL") - } -} - -// Georgian KA -Self::KA(region) => { - if *region != Region::Any { - f.write_str("KA_")?; - ::fmt(region, f) - } else { - f.write_str("KA") - } -} - -// German DE -Self::DE(region) => { - if *region != Region::Any { - f.write_str("DE_")?; - ::fmt(region, f) - } else { - f.write_str("DE") - } -} - -// Greek EL -Self::EL(region) => { - if *region != Region::Any { - f.write_str("EL_")?; - ::fmt(region, f) - } else { - f.write_str("EL") - } -} - -// Greenlandic KL -Self::KL(region) => { - if *region != Region::Any { - f.write_str("KL_")?; - ::fmt(region, f) - } else { - f.write_str("KL") - } -} - -// Guarani GN -Self::GN(region) => { - if *region != Region::Any { - f.write_str("GN_")?; - ::fmt(region, f) - } else { - f.write_str("GN") - } -} - -// Gujarati GU -Self::GU(region) => { - if *region != Region::Any { - f.write_str("GU_")?; - ::fmt(region, f) - } else { - f.write_str("GU") - } -} - -// Hausa HA -Self::HA(region) => { - if *region != Region::Any { - f.write_str("HA_")?; - ::fmt(region, f) - } else { - f.write_str("HA") - } -} - -// Hebrew IW -Self::IW(region) => { - if *region != Region::Any { - f.write_str("IW_")?; - ::fmt(region, f) - } else { - f.write_str("IW") - } -} - -// Hindi HI -Self::HI(region) => { - if *region != Region::Any { - f.write_str("HI_")?; - ::fmt(region, f) - } else { - f.write_str("HI") - } -} - -// Hungarian HU -Self::HU(region) => { - if *region != Region::Any { - f.write_str("HU_")?; - ::fmt(region, f) - } else { - f.write_str("HU") - } -} - -// Icelandic IS -Self::IS(region) => { - if *region != Region::Any { - f.write_str("IS_")?; - ::fmt(region, f) - } else { - f.write_str("IS") - } -} - -// Indonesian IN -Self::IN(region) => { - if *region != Region::Any { - f.write_str("IN_")?; - ::fmt(region, f) - } else { - f.write_str("IN") - } -} - -// Interlingua IA -Self::IA(region) => { - if *region != Region::Any { - f.write_str("IA_")?; - ::fmt(region, f) - } else { - f.write_str("IA") - } -} - -// Interlingue IE -Self::IE(region) => { - if *region != Region::Any { - f.write_str("IE_")?; - ::fmt(region, f) - } else { - f.write_str("IE") - } -} - -// Inupiak IK -Self::IK(region) => { - if *region != Region::Any { - f.write_str("IK_")?; - ::fmt(region, f) - } else { - f.write_str("IK") - } -} - -// Irish GA -Self::GA(region) => { - if *region != Region::Any { - f.write_str("GA_")?; - ::fmt(region, f) - } else { - f.write_str("GA") - } -} - -// Italian IT -Self::IT(region) => { - if *region != Region::Any { - f.write_str("IT_")?; - ::fmt(region, f) - } else { - f.write_str("IT") - } -} - -// Japanese JA -Self::JA(region) => { - if *region != Region::Any { - f.write_str("JA_")?; - ::fmt(region, f) - } else { - f.write_str("JA") - } -} - -// Javanese JW -Self::JW(region) => { - if *region != Region::Any { - f.write_str("JW_")?; - ::fmt(region, f) - } else { - f.write_str("JW") - } -} - -// Kannada KN -Self::KN(region) => { - if *region != Region::Any { - f.write_str("KN_")?; - ::fmt(region, f) - } else { - f.write_str("KN") - } -} - -// Kashmiri KS -Self::KS(region) => { - if *region != Region::Any { - f.write_str("KS_")?; - ::fmt(region, f) - } else { - f.write_str("KS") - } -} - -// Kazakh KK -Self::KK(region) => { - if *region != Region::Any { - f.write_str("KK_")?; - ::fmt(region, f) - } else { - f.write_str("KK") - } -} - -// Kinyarwanda RW -Self::RW(region) => { - if *region != Region::Any { - f.write_str("RW_")?; - ::fmt(region, f) - } else { - f.write_str("RW") - } -} - -// Kirghiz KY -Self::KY(region) => { - if *region != Region::Any { - f.write_str("KY_")?; - ::fmt(region, f) - } else { - f.write_str("KY") - } -} - -// Kirundi RN -Self::RN(region) => { - if *region != Region::Any { - f.write_str("RN_")?; - ::fmt(region, f) - } else { - f.write_str("RN") - } -} - -// Korean KO -Self::KO(region) => { - if *region != Region::Any { - f.write_str("KO_")?; - ::fmt(region, f) - } else { - f.write_str("KO") - } -} - -// Kurdish KU -Self::KU(region) => { - if *region != Region::Any { - f.write_str("KU_")?; - ::fmt(region, f) - } else { - f.write_str("KU") - } -} - -// Laothian LO -Self::LO(region) => { - if *region != Region::Any { - f.write_str("LO_")?; - ::fmt(region, f) - } else { - f.write_str("LO") - } -} - -// Latin LA -Self::LA(region) => { - if *region != Region::Any { - f.write_str("LA_")?; - ::fmt(region, f) - } else { - f.write_str("LA") - } -} - -// Latvian, Lettish LV -Self::LV(region) => { - if *region != Region::Any { - f.write_str("LV_")?; - ::fmt(region, f) - } else { - f.write_str("LV") - } -} - -// Lingala LN -Self::LN(region) => { - if *region != Region::Any { - f.write_str("LN_")?; - ::fmt(region, f) - } else { - f.write_str("LN") - } -} - -// Lithuanian LT -Self::LT(region) => { - if *region != Region::Any { - f.write_str("LT_")?; - ::fmt(region, f) - } else { - f.write_str("LT") - } -} - -// Macedonian MK -Self::MK(region) => { - if *region != Region::Any { - f.write_str("MK_")?; - ::fmt(region, f) - } else { - f.write_str("MK") - } -} - -// Malagasy MG -Self::MG(region) => { - if *region != Region::Any { - f.write_str("MG_")?; - ::fmt(region, f) - } else { - f.write_str("MG") - } -} - -// Malay MS -Self::MS(region) => { - if *region != Region::Any { - f.write_str("MS_")?; - ::fmt(region, f) - } else { - f.write_str("MS") - } -} - -// Malayalam ML -Self::ML(region) => { - if *region != Region::Any { - f.write_str("ML_")?; - ::fmt(region, f) - } else { - f.write_str("ML") - } -} - -// Maltese MT -Self::MT(region) => { - if *region != Region::Any { - f.write_str("MT_")?; - ::fmt(region, f) - } else { - f.write_str("MT") - } -} - -// Maori MI -Self::MI(region) => { - if *region != Region::Any { - f.write_str("MI_")?; - ::fmt(region, f) - } else { - f.write_str("MI") - } -} - -// Marathi MR -Self::MR(region) => { - if *region != Region::Any { - f.write_str("MR_")?; - ::fmt(region, f) - } else { - f.write_str("MR") - } -} - -// Moldavian MO -Self::MO(region) => { - if *region != Region::Any { - f.write_str("MO_")?; - ::fmt(region, f) - } else { - f.write_str("MO") - } -} - -// Mongolian MN -Self::MN(region) => { - if *region != Region::Any { - f.write_str("MN_")?; - ::fmt(region, f) - } else { - f.write_str("MN") - } -} - -// Nauru NA -Self::NA(region) => { - if *region != Region::Any { - f.write_str("NA_")?; - ::fmt(region, f) - } else { - f.write_str("NA") - } -} - -// Nepali NE -Self::NE(region) => { - if *region != Region::Any { - f.write_str("NE_")?; - ::fmt(region, f) - } else { - f.write_str("NE") - } -} - -// Norwegian NO -Self::NO(region) => { - if *region != Region::Any { - f.write_str("NO_")?; - ::fmt(region, f) - } else { - f.write_str("NO") - } -} - -// Occitan OC -Self::OC(region) => { - if *region != Region::Any { - f.write_str("OC_")?; - ::fmt(region, f) - } else { - f.write_str("OC") - } -} - -// Oriya OR -Self::OR(region) => { - if *region != Region::Any { - f.write_str("OR_")?; - ::fmt(region, f) - } else { - f.write_str("OR") - } -} - -// Oromo, Afan OM -Self::OM(region) => { - if *region != Region::Any { - f.write_str("OM_")?; - ::fmt(region, f) - } else { - f.write_str("OM") - } -} - -// Pashto, Pushto PS -Self::PS(region) => { - if *region != Region::Any { - f.write_str("PS_")?; - ::fmt(region, f) - } else { - f.write_str("PS") - } -} - -// Persian FA -Self::FA(region) => { - if *region != Region::Any { - f.write_str("FA_")?; - ::fmt(region, f) - } else { - f.write_str("FA") - } -} - -// Polish PL -Self::PL(region) => { - if *region != Region::Any { - f.write_str("PL_")?; - ::fmt(region, f) - } else { - f.write_str("PL") - } -} - -// Portuguese PT -Self::PT(region) => { - if *region != Region::Any { - f.write_str("PT_")?; - ::fmt(region, f) - } else { - f.write_str("PT") - } -} - -// Punjabi PA -Self::PA(region) => { - if *region != Region::Any { - f.write_str("PA_")?; - ::fmt(region, f) - } else { - f.write_str("PA") - } -} - -// Quechua QU -Self::QU(region) => { - if *region != Region::Any { - f.write_str("QU_")?; - ::fmt(region, f) - } else { - f.write_str("QU") - } -} - -// Rhaeto-Romance RM -Self::RM(region) => { - if *region != Region::Any { - f.write_str("RM_")?; - ::fmt(region, f) - } else { - f.write_str("RM") - } -} - -// Romanian RO -Self::RO(region) => { - if *region != Region::Any { - f.write_str("RO_")?; - ::fmt(region, f) - } else { - f.write_str("RO") - } -} - -// Russian RU -Self::RU(region) => { - if *region != Region::Any { - f.write_str("RU_")?; - ::fmt(region, f) - } else { - f.write_str("RU") - } -} - -// Samoan SM -Self::SM(region) => { - if *region != Region::Any { - f.write_str("SM_")?; - ::fmt(region, f) - } else { - f.write_str("SM") - } -} - -// Sangro SG -Self::SG(region) => { - if *region != Region::Any { - f.write_str("SG_")?; - ::fmt(region, f) - } else { - f.write_str("SG") - } -} - -// Sanskrit SA -Self::SA(region) => { - if *region != Region::Any { - f.write_str("SA_")?; - ::fmt(region, f) - } else { - f.write_str("SA") - } -} - -// Serbian SR -Self::SR(region) => { - if *region != Region::Any { - f.write_str("SR_")?; - ::fmt(region, f) - } else { - f.write_str("SR") - } -} - -// Serbo-Croatian SH -Self::SH(region) => { - if *region != Region::Any { - f.write_str("SH_")?; - ::fmt(region, f) - } else { - f.write_str("SH") - } -} - -// Sesotho ST -Self::ST(region) => { - if *region != Region::Any { - f.write_str("ST_")?; - ::fmt(region, f) - } else { - f.write_str("ST") - } -} - -// Setswana TN -Self::TN(region) => { - if *region != Region::Any { - f.write_str("TN_")?; - ::fmt(region, f) - } else { - f.write_str("TN") - } -} - -// Shona SN -Self::SN(region) => { - if *region != Region::Any { - f.write_str("SN_")?; - ::fmt(region, f) - } else { - f.write_str("SN") - } -} - -// Sindhi SD -Self::SD(region) => { - if *region != Region::Any { - f.write_str("SD_")?; - ::fmt(region, f) - } else { - f.write_str("SD") - } -} - -// Singhalese SI -Self::SI(region) => { - if *region != Region::Any { - f.write_str("SI_")?; - ::fmt(region, f) - } else { - f.write_str("SI") - } -} - -// Siswati SS -Self::SS(region) => { - if *region != Region::Any { - f.write_str("SS_")?; - ::fmt(region, f) - } else { - f.write_str("SS") - } -} - -// Slovak SK -Self::SK(region) => { - if *region != Region::Any { - f.write_str("SK_")?; - ::fmt(region, f) - } else { - f.write_str("SK") - } -} - -// Slovenian SL -Self::SL(region) => { - if *region != Region::Any { - f.write_str("SL_")?; - ::fmt(region, f) - } else { - f.write_str("SL") - } -} - -// Somali SO -Self::SO(region) => { - if *region != Region::Any { - f.write_str("SO_")?; - ::fmt(region, f) - } else { - f.write_str("SO") - } -} - -// Spanish ES -Self::ES(region) => { - if *region != Region::Any { - f.write_str("ES_")?; - ::fmt(region, f) - } else { - f.write_str("ES") - } -} - -// Sudanese SU -Self::SU(region) => { - if *region != Region::Any { - f.write_str("SU_")?; - ::fmt(region, f) - } else { - f.write_str("SU") - } -} - -// Swahili SW -Self::SW(region) => { - if *region != Region::Any { - f.write_str("SW_")?; - ::fmt(region, f) - } else { - f.write_str("SW") - } -} - -// Swedish SV -Self::SV(region) => { - if *region != Region::Any { - f.write_str("SV_")?; - ::fmt(region, f) - } else { - f.write_str("SV") - } -} - -// Tagalog TL -Self::TL(region) => { - if *region != Region::Any { - f.write_str("TL_")?; - ::fmt(region, f) - } else { - f.write_str("TL") - } -} - -// Tajik TG -Self::TG(region) => { - if *region != Region::Any { - f.write_str("TG_")?; - ::fmt(region, f) - } else { - f.write_str("TG") - } -} - -// Tamil TA -Self::TA(region) => { - if *region != Region::Any { - f.write_str("TA_")?; - ::fmt(region, f) - } else { - f.write_str("TA") - } -} - -// Tatar TT -Self::TT(region) => { - if *region != Region::Any { - f.write_str("TT_")?; - ::fmt(region, f) - } else { - f.write_str("TT") - } -} - -// Tegulu TE -Self::TE(region) => { - if *region != Region::Any { - f.write_str("TE_")?; - ::fmt(region, f) - } else { - f.write_str("TE") - } -} - -// Thai TH -Self::TH(region) => { - if *region != Region::Any { - f.write_str("TH_")?; - ::fmt(region, f) - } else { - f.write_str("TH") - } -} - -// Tibetan BO -Self::BO(region) => { - if *region != Region::Any { - f.write_str("BO_")?; - ::fmt(region, f) - } else { - f.write_str("BO") - } -} - -// Tigrinya TI -Self::TI(region) => { - if *region != Region::Any { - f.write_str("TI_")?; - ::fmt(region, f) - } else { - f.write_str("TI") - } -} - -// Tonga TO -Self::TO(region) => { - if *region != Region::Any { - f.write_str("TO_")?; - ::fmt(region, f) - } else { - f.write_str("TO") - } -} - -// Tsonga TS -Self::TS(region) => { - if *region != Region::Any { - f.write_str("TS_")?; - ::fmt(region, f) - } else { - f.write_str("TS") - } -} - -// Turkish TR -Self::TR(region) => { - if *region != Region::Any { - f.write_str("TR_")?; - ::fmt(region, f) - } else { - f.write_str("TR") - } -} - -// Turkmen TK -Self::TK(region) => { - if *region != Region::Any { - f.write_str("TK_")?; - ::fmt(region, f) - } else { - f.write_str("TK") - } -} - -// Twi TW -Self::TW(region) => { - if *region != Region::Any { - f.write_str("TW_")?; - ::fmt(region, f) - } else { - f.write_str("TW") - } -} - -// Ukrainian UK -Self::UK(region) => { - if *region != Region::Any { - f.write_str("UK_")?; - ::fmt(region, f) - } else { - f.write_str("UK") - } -} - -// Urdu UR -Self::UR(region) => { - if *region != Region::Any { - f.write_str("UR_")?; - ::fmt(region, f) - } else { - f.write_str("UR") - } -} - -// Uzbek UZ -Self::UZ(region) => { - if *region != Region::Any { - f.write_str("UZ_")?; - ::fmt(region, f) - } else { - f.write_str("UZ") - } -} - -// Vietnamese VI -Self::VI(region) => { - if *region != Region::Any { - f.write_str("VI_")?; - ::fmt(region, f) - } else { - f.write_str("VI") - } -} - -// Volapuk VO -Self::VO(region) => { - if *region != Region::Any { - f.write_str("VO_")?; - ::fmt(region, f) - } else { - f.write_str("VO") - } -} - -// Welsh CY -Self::CY(region) => { - if *region != Region::Any { - f.write_str("CY_")?; - ::fmt(region, f) - } else { - f.write_str("CY") - } -} - -// Wolof WO -Self::WO(region) => { - if *region != Region::Any { - f.write_str("WO_")?; - ::fmt(region, f) - } else { - f.write_str("WO") - } -} - -// Xhosa XH -Self::XH(region) => { - if *region != Region::Any { - f.write_str("XH_")?; - ::fmt(region, f) - } else { - f.write_str("XH") - } -} - -// Yiddish JI -Self::JI(region) => { - if *region != Region::Any { - f.write_str("JI_")?; - ::fmt(region, f) - } else { - f.write_str("JI") - } -} - -// Yoruba YO -Self::YO(region) => { - if *region != Region::Any { - f.write_str("YO_")?; - ::fmt(region, f) - } else { - f.write_str("YO") - } -} - -// Zulu ZU -Self::ZU(region) => { - if *region != Region::Any { - f.write_str("ZU_")?; - ::fmt(region, f) - } else { - f.write_str("ZU") - } -} - diff --git a/rearanged.txt b/rearanged_countries.txt similarity index 100% rename from rearanged.txt rename to rearanged_countries.txt diff --git a/src/lib.rs b/src/lib.rs index 8a256d9..89d1ffd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,8 +114,27 @@ use std::{ ffi::OsString, fmt::{self, Display, Formatter}, io::{Error, ErrorKind}, + env, // for environment variables (LANG, LC_ALL) }; +/// output : en_US.UTF-8 +/// en : language +/// US : country +fn get_language_and_country() -> String { + if let Some(language) = env::var("LC_ALL").ok() { + // possible output : en_US.UTF-8 + return language; + } else if let Some(language) = env::var("LANG").ok() { + // possible output : en_US.UTF-8 + return language; + } else if let Some(language) = env::var("LANGUAGE").ok() { + // possible output : en_US.UTF-8 + return language; + } + return String::new(); +} + + /// This crate's convenience type alias for [`Result`](std::result::Result)s pub type Result = std::result::Result; @@ -1135,6 +1154,7 @@ pub enum Region { Ax } + impl Display for Region { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.write_str(match self { @@ -1651,6 +1671,524 @@ impl Display for Region { } } +/// the `function get_language_and_country` returns a String +/// `en_US.UTF-8` : `language_country.textencoding` +/// the two uppercase letters between the underscore `_` and `.UTF-8` +/// represent the `country` +impl Region { + fn get() -> Self { + let var_env: String = get_language_and_country(); + // output : en_US.UTF-8 + // en : language + // US : country (region) + + // the country is written in uppercase + if var_env.is_empty() { + return Region::Any; + } else if var_env.contains("AF") { + return Region::Af; + } else if var_env.contains("AL") { + return Region::Al; + } else if var_env.contains("DZ") { + return Region::Dz; + } else if var_env.contains("AS") { + return Region::As; + } else if var_env.contains("AD") { + return Region::Ad; + } else if var_env.contains("AO") { + return Region::Ao; + } else if var_env.contains("AI") { + return Region::Ai; + } else if var_env.contains("AQ") { + return Region::Aq; + } else if var_env.contains("AG") { + return Region::Ag; + } else if var_env.contains("AR") { + return Region::Ar; + } else if var_env.contains("AM") { + return Region::Am; + } else if var_env.contains("AW") { + return Region::Aw; + } else if var_env.contains("AU") { + return Region::Au; + } else if var_env.contains("AT") { + return Region::At; + } else if var_env.contains("AZ") { + return Region::Az; + } else if var_env.contains("BS") { + return Region::Bs; + } else if var_env.contains("BH") { + return Region::Bh; + } else if var_env.contains("BD") { + return Region::Bd; + } else if var_env.contains("BB") { + return Region::Bb; + } else if var_env.contains("BY") { + return Region::By; + } else if var_env.contains("BE") { + return Region::Be; + } else if var_env.contains("BZ") { + return Region::Bz; + } else if var_env.contains("BJ") { + return Region::Bj; + } else if var_env.contains("BM") { + return Region::Bm; + } else if var_env.contains("BT") { + return Region::Bt; + } else if var_env.contains("BO") { + return Region::Bo; + } else if var_env.contains("BQ") { + return Region::Bq; + } else if var_env.contains("BA") { + return Region::Ba; + } else if var_env.contains("BW") { + return Region::Bw; + } else if var_env.contains("BV") { + return Region::Bv; + } else if var_env.contains("BR") { + return Region::Br; + } else if var_env.contains("IO") { + return Region::Io; + } else if var_env.contains("BN") { + return Region::Bn; + } else if var_env.contains("BG") { + return Region::Bg; + } else if var_env.contains("BF") { + return Region::Bf; + } else if var_env.contains("BI") { + return Region::Bi; + } else if var_env.contains("CV") { + return Region::Cv; + } else if var_env.contains("KH") { + return Region::Kh; + } else if var_env.contains("CM") { + return Region::Cm; + } else if var_env.contains("CA") { + return Region::Ca; + } else if var_env.contains("KY") { + return Region::Ky; + } else if var_env.contains("CF") { + return Region::Cf; + } else if var_env.contains("TD") { + return Region::Td; + } else if var_env.contains("CL") { + return Region::Cl; + } else if var_env.contains("CN") { + return Region::Cn; + } else if var_env.contains("CX") { + return Region::Cx; + } else if var_env.contains("CC") { + return Region::Cc; + } else if var_env.contains("CO") { + return Region::Cd; + } else if var_env.contains("KM") { + return Region::Km; + } else if var_env.contains("CD") { + return Region::Cd; + } else if var_env.contains("CG") { + return Region::Cg; + } else if var_env.contains("CK") { + return Region::Ck; + } else if var_env.contains("CR") { + return Region::Cr; + } else if var_env.contains("HR") { + return Region::Hr; + } else if var_env.contains("CU") { + return Region::Cu; + } else if var_env.contains("CW") { + return Region::Cw; + } else if var_env.contains("CY") { + return Region::Cy; + } else if var_env.contains("CZ") { + return Region::Cz; + } else if var_env.contains("CI") { + return Region::Ci; + } else if var_env.contains("DK") { + return Region::Dk; + } else if var_env.contains("DJ") { + return Region::Dj; + } else if var_env.contains("DM") { + return Region::Dm; + } else if var_env.contains("DO") { + return Region::Do; + } else if var_env.contains("EC") { + return Region::Ec; + } else if var_env.contains("EG") { + return Region::Eg; + } else if var_env.contains("SV") { + return Region::Sv; + } else if var_env.contains("GQ") { + return Region::Gq; + } else if var_env.contains("ER") { + return Region::Er; + } else if var_env.contains("EE") { + return Region::Ee; + } else if var_env.contains("SZ") { + return Region::Sz; + } else if var_env.contains("ET") { + return Region::Et; + } else if var_env.contains("FK") { + return Region::Fk; + } else if var_env.contains("FO") { + return Region::Fo; + } else if var_env.contains("FJ") { + return Region::Fj; + } else if var_env.contains("FI") { + return Region::Fi; + } else if var_env.contains("FR") { + return Region::Fr; + } else if var_env.contains("GF") { + return Region::Gf; + } else if var_env.contains("PF") { + return Region::Pf; + } else if var_env.contains("TF") { + return Region::Tf; + } else if var_env.contains("GA") { + return Region::Ga; + } else if var_env.contains("GM") { + return Region::Gm; + } else if var_env.contains("GE") { + return Region::Ge; + } else if var_env.contains("DE") { + return Region::De; + } else if var_env.contains("GH") { + return Region::Gh; + } else if var_env.contains("GI") { + return Region::Gi; + } else if var_env.contains("GR") { + return Region::Gr; + } else if var_env.contains("GL") { + return Region::Gl; + } else if var_env.contains("GD") { + return Region::Gd; + } else if var_env.contains("GP") { + return Region::Gp; + } else if var_env.contains("GU") { + return Region::Gu; + } else if var_env.contains("GT") { + return Region::Gt; + } else if var_env.contains("GG") { + return Region::Gg; + } else if var_env.contains("GN") { + return Region::Gn; + } else if var_env.contains("GW") { + return Region::Gw; + } else if var_env.contains("GY") { + return Region::Gy; + } else if var_env.contains("HT") { + return Region::Ht; + } else if var_env.contains("HM") { + return Region::Hm; + } else if var_env.contains("VA") { + return Region::Va; + } else if var_env.contains("HN") { + return Region::Hn; + } else if var_env.contains("HK") { + return Region::Hk; + } else if var_env.contains("HU") { + return Region::Hu; + } else if var_env.contains("IS") { + return Region::Is; + } else if var_env.contains("IN") { + return Region::In; + } else if var_env.contains("ID") { + return Region::Id; + } else if var_env.contains("IR") { + return Region::Ir; + } else if var_env.contains("IQ") { + return Region::Iq; + } else if var_env.contains("IE") { + return Region::Ie; + } else if var_env.contains("IM") { + return Region::Im; + } else if var_env.contains("IL") { + return Region::Il; + } else if var_env.contains("IT") { + return Region::It; + } else if var_env.contains("JM") { + return Region::Jm; + } else if var_env.contains("JP") { + return Region::Jp; + } else if var_env.contains("JE") { + return Region::Je; + } else if var_env.contains("JO") { + return Region::Jo; + } else if var_env.contains("KZ") { + return Region::Kz; + } else if var_env.contains("KE") { + return Region::Ke; + } else if var_env.contains("KI") { + return Region::Ki; + } else if var_env.contains("KP") { + return Region::Kp; + } else if var_env.contains("KR") { + return Region::Kr; + } else if var_env.contains("KW") { + return Region::Kw; + } else if var_env.contains("KG") { + return Region::Kg; + } else if var_env.contains("LA") { + return Region::La; + } else if var_env.contains("LV") { + return Region::Lv; + } else if var_env.contains("LB") { + return Region::Lb; + } else if var_env.contains("LS") { + return Region::Ls; + } else if var_env.contains("LR") { + return Region::Lr; + } else if var_env.contains("LY") { + return Region::Ly; + } else if var_env.contains("LI") { + return Region::Li; + } else if var_env.contains("LT") { + return Region::Lt; + } else if var_env.contains("LU") { + return Region::Lu; + } else if var_env.contains("MO") { + return Region::Mo; + } else if var_env.contains("MG") { + return Region::Mg; + } else if var_env.contains("MW") { + return Region::Mw; + } else if var_env.contains("MY") { + return Region::My; + } else if var_env.contains("MV") { + return Region::Mv; + } else if var_env.contains("ML") { + return Region::Ml; + } else if var_env.contains("MT") { + return Region::Mt; + } else if var_env.contains("MH") { + return Region::Mh; + } else if var_env.contains("MQ") { + return Region::Mq; + } else if var_env.contains("MR") { + return Region::Mr; + } else if var_env.contains("MU") { + return Region::Mu; + } else if var_env.contains("YT") { + return Region::Yt; + } else if var_env.contains("MX") { + return Region::Mx; + } else if var_env.contains("FM") { + return Region::Fm; + } else if var_env.contains("MD") { + return Region::Md; + } else if var_env.contains("MC") { + return Region::Mc; + } else if var_env.contains("MN") { + return Region::Mn; + } else if var_env.contains("ME") { + return Region::Me; + } else if var_env.contains("MS") { + return Region::Ms; + } else if var_env.contains("MA") { + return Region::Ma; + } else if var_env.contains("MZ") { + return Region::Mz; + } else if var_env.contains("MM") { + return Region::Mm; + } else if var_env.contains("NA") { + return Region::Na; + } else if var_env.contains("NR") { + return Region::Nr; + } else if var_env.contains("NP") { + return Region::Np; + } else if var_env.contains("NL") { + return Region::Nl; + } else if var_env.contains("NC") { + return Region::Nc; + } else if var_env.contains("NZ") { + return Region::Nz; + } else if var_env.contains("NI") { + return Region::Ni; + } else if var_env.contains("NE") { + return Region::Ne; + } else if var_env.contains("NG") { + return Region::Ng; + } else if var_env.contains("NU") { + return Region::Nu; + } else if var_env.contains("NF") { + return Region::Nf; + } else if var_env.contains("MP") { + return Region::Mp; + } else if var_env.contains("NO") { + return Region::No; + } else if var_env.contains("OM") { + return Region::Om; + } else if var_env.contains("PK") { + return Region::Pk; + } else if var_env.contains("PW") { + return Region::Pw; + } else if var_env.contains("PS") { + return Region::Ps; + } else if var_env.contains("PA") { + return Region::Pa; + } else if var_env.contains("PG") { + return Region::Pg; + } else if var_env.contains("PY") { + return Region::Py; + } else if var_env.contains("PE") { + return Region::Pe; + } else if var_env.contains("PH") { + return Region::Ph; + } else if var_env.contains("PN") { + return Region::Pn; + } else if var_env.contains("PL") { + return Region::Pl; + } else if var_env.contains("PT") { + return Region::Pt; + } else if var_env.contains("PR") { + return Region::Pr; + } else if var_env.contains("QA") { + return Region::Qa; + } else if var_env.contains("MK") { + return Region::Mk; + } else if var_env.contains("RO") { + return Region::Ro; + } else if var_env.contains("RU") { + return Region::Ru; + } else if var_env.contains("RW") { + return Region::Rw; + } else if var_env.contains("RE") { + return Region::Re; + } else if var_env.contains("BL") { + return Region::Bl; + } else if var_env.contains("SH") { + return Region::Sh; + } else if var_env.contains("KN") { + return Region::Kn; + } else if var_env.contains("LC") { + return Region::Lc; + } else if var_env.contains("MF") { + return Region::Mf; + } else if var_env.contains("PM") { + return Region::Pm; + } else if var_env.contains("VC") { + return Region::Vc; + } else if var_env.contains("WS") { + return Region::Ws; + } else if var_env.contains("SM") { + return Region::Sm; + } else if var_env.contains("ST") { + return Region::St; + } else if var_env.contains("SA") { + return Region::Sa; + } else if var_env.contains("SN") { + return Region::Sn; + } else if var_env.contains("RS") { + return Region::Rs; + } else if var_env.contains("SC") { + return Region::Sc; + } else if var_env.contains("SL") { + return Region::Sl; + } else if var_env.contains("SG") { + return Region::Sg; + } else if var_env.contains("SX") { + return Region::Sx; + } else if var_env.contains("SK") { + return Region::Sk; + } else if var_env.contains("SI") { + return Region::Si; + } else if var_env.contains("SB") { + return Region::Sb; + } else if var_env.contains("SO") { + return Region::So; + } else if var_env.contains("ZA") { + return Region::Za; + } else if var_env.contains("GS") { + return Region::Gs; + } else if var_env.contains("SS") { + return Region::Ss; + } else if var_env.contains("ES") { + return Region::Es; + } else if var_env.contains("LK") { + return Region::Lk; + } else if var_env.contains("SD") { + return Region::Sd; + } else if var_env.contains("SR") { + return Region::Sr; + } else if var_env.contains("SJ") { + return Region::Sj; + } else if var_env.contains("SE") { + return Region::Se; + } else if var_env.contains("CH") { + return Region::Ch; + } else if var_env.contains("SY") { + return Region::Sy; + } else if var_env.contains("TW") { + return Region::Tw; + } else if var_env.contains("TJ") { + return Region::Tj; + } else if var_env.contains("TZ") { + return Region::Tz; + } else if var_env.contains("TH") { + return Region::Th; + } else if var_env.contains("TL") { + return Region::Tl; + } else if var_env.contains("TG") { + return Region::Tg; + } else if var_env.contains("TK") { + return Region::Tk; + } else if var_env.contains("TO") { + return Region::To; + } else if var_env.contains("TT") { + return Region::Tt; + } else if var_env.contains("TN") { + return Region::Tn; + } else if var_env.contains("TR") { + return Region::Tr; + } else if var_env.contains("TM") { + return Region::Tm; + } else if var_env.contains("TC") { + return Region::Tc; + } else if var_env.contains("TV") { + return Region::Tv; + } else if var_env.contains("UG") { + return Region::Ug; + } else if var_env.contains("UA") { + return Region::Ua; + } else if var_env.contains("AE") { + return Region::Ae; + } else if var_env.contains("GB") { + return Region::Gb; + } else if var_env.contains("UM") { + return Region::Um; + } else if var_env.contains("US") { + return Region::Us; + } else if var_env.contains("UY") { + return Region::Uy; + } else if var_env.contains("UZ") { + return Region::Uz; + } else if var_env.contains("VU") { + return Region::Vu; + } else if var_env.contains("VE") { + return Region::Ve; + } else if var_env.contains("VN") { + return Region::Vn; + } else if var_env.contains("VG") { + return Region::Vg; + } else if var_env.contains("VI") { + return Region::Vi; + } else if var_env.contains("WF") { + return Region::Wf; + } else if var_env.contains("EH") { + return Region::Eh; + } else if var_env.contains("YE") { + return Region::Ye; + } else if var_env.contains("ZM") { + return Region::Zm; + } else if var_env.contains("ZW") { + return Region::Zw; + } else if var_env.contains("AX") { + return Region::Ax; + } + + return Region::Any; + } +} + /// A spoken language /// /// Use [`ToString::to_string()`] to convert to string of two letter lowercase @@ -1725,9 +2263,9 @@ pub enum Language { #[doc(hidden)] Bh(Region), - /// `BI`: Bislama + /// `bi`: Bislama #[doc(hidden)] - BI(Region), + Bi(Region), /// `br`: Breton #[doc(hidden)] @@ -2211,6 +2749,7 @@ pub enum Language { } + impl Language { /// Retrieve the region code for this language dialect. pub fn region(&self) -> Region { @@ -2231,7 +2770,7 @@ impl Language { Self::Bn(region) => *region, // Bengali, Bangla BN Self::Dz(region) => *region, // Bhutani DZ Self::Bh(region) => *region, // Bihari BH - Self::BI(region) => *region, // Bislama BI + Self::Bi(region) => *region, // Bislama BI Self::Br(region) => *region, // Breton BR Self::Bg(region) => *region, // Bulgarian BG Self::My(region) => *region, // Burmese MY @@ -2512,7 +3051,7 @@ impl Display for Language { } // Bislama BI - Self::BI(region) => { + Self::Bi(region) => { if *region != Region::Any { f.write_str("bi_")?; ::fmt(region, f) @@ -3724,12 +4263,311 @@ impl Display for Language { } } + + +/// the `function get_language_and_country` returns a String +/// `en_US.UTF-8` : `language_country.textencoding` +/// the two lowercase letters before the underscore `_` +/// represents the `language` +impl Language { + fn get() -> Self { + let var_env: String = get_language_and_country(); + // output : en_US.UTF-8 + // en : language + // US : country (region) + + let region: Region = Region::get(); + + // the language is written with two lowercase characters + if var_env.contains("ab") { + return Language::Ab(region); + } else if var_env.contains("aa") { + return Language::Aa(region); + } else if var_env.contains("af") { + return Language::Af(region); + } else if var_env.contains("sq") { + return Language::Sq(region); + } else if var_env.contains("am") { + return Language::Am(region); + } else if var_env.contains("ar") { + return Language::Ar(region); + } else if var_env.contains("hy") { + return Language::Hy(region); + } else if var_env.contains("as") { + return Language::As(region); + } else if var_env.contains("ay") { + return Language::Ay(region); + } else if var_env.contains("az") { + return Language::Az(region); + } else if var_env.contains("ba") { + return Language::Ba(region); + } else if var_env.contains("eu") { + return Language::Eu(region); + } else if var_env.contains("bn") { + return Language::Bn(region); + } else if var_env.contains("dz") { + return Language::Dz(region); + } else if var_env.contains("bh") { + return Language::Bh(region); + } else if var_env.contains("bi") { + return Language::Bi(region); + } else if var_env.contains("br") { + return Language::Br(region); + } else if var_env.contains("bg") { + return Language::Bg(region); + } else if var_env.contains("my") { + return Language::My(region); + } else if var_env.contains("be") { + return Language::Be(region); + } else if var_env.contains("km") { + return Language::Km(region); + } else if var_env.contains("ca") { + return Language::Ca(region); + } else if var_env.contains("zh") { + return Language::Zh(region); + } else if var_env.contains("co") { + return Language::Co(region); + } else if var_env.contains("hr") { + return Language::Hr(region); + } else if var_env.contains("cs") { + return Language::Cs(region); + } else if var_env.contains("da") { + return Language::Da(region); + } else if var_env.contains("nl") { + return Language::Nl(region); + } else if var_env.contains("en") { + return Language::En(region); + } else if var_env.contains("eo") { + return Language::Eo(region); + } else if var_env.contains("et") { + return Language::Et(region); + } else if var_env.contains("fo") { + return Language::Fo(region); + } else if var_env.contains("fj") { + return Language::Fj(region); + } else if var_env.contains("fi") { + return Language::Fi(region); + } else if var_env.contains("fr") { + return Language::Fr(region); + } else if var_env.contains("fy") { + return Language::Fy(region); + } else if var_env.contains("gd") { + return Language::Gd(region); + } else if var_env.contains("gl") { + return Language::Gl(region); + } else if var_env.contains("ka") { + return Language::Ka(region); + } else if var_env.contains("de") { + return Language::De(region); + } else if var_env.contains("el") { + return Language::El(region); + } else if var_env.contains("kl") { + return Language::Kl(region); + } else if var_env.contains("gn") { + return Language::Gn(region); + } else if var_env.contains("gu") { + return Language::Gu(region); + } else if var_env.contains("ha") { + return Language::Ha(region); + } else if var_env.contains("iw") { + return Language::Iw(region); + } else if var_env.contains("hi") { + return Language::Hi(region); + } else if var_env.contains("hu") { + return Language::Hu(region); + } else if var_env.contains("is") { + return Language::Is(region); + } else if var_env.contains("in") { + return Language::In(region); + } else if var_env.contains("ia") { + return Language::Ia(region); + } else if var_env.contains("ie") { + return Language::Ie(region); + } else if var_env.contains("ik") { + return Language::Ik(region); + } else if var_env.contains("ga") { + return Language::Ga(region); + } else if var_env.contains("it") { + return Language::It(region); + } else if var_env.contains("ja") { + return Language::Ja(region); + } else if var_env.contains("jw") { + return Language::Jw(region); + } else if var_env.contains("kn") { + return Language::Kn(region); + } else if var_env.contains("ks") { + return Language::Ks(region); + } else if var_env.contains("kk") { + return Language::Kk(region); + } else if var_env.contains("rw") { + return Language::Rw(region); + } else if var_env.contains("ky") { + return Language::Ky(region); + } else if var_env.contains("rn") { + return Language::Rn(region); + } else if var_env.contains("ko") { + return Language::Ko(region); + } else if var_env.contains("ku") { + return Language::Ku(region); + } else if var_env.contains("lo") { + return Language::Lo(region); + } else if var_env.contains("la") { + return Language::La(region); + } else if var_env.contains("lv") { + return Language::Lv(region); + } else if var_env.contains("ln") { + return Language::Ln(region); + } else if var_env.contains("lt") { + return Language::Lt(region); + } else if var_env.contains("mk") { + return Language::Mk(region); + } else if var_env.contains("mg") { + return Language::Mg(region); + } else if var_env.contains("ms") { + return Language::Ms(region); + } else if var_env.contains("ml") { + return Language::Ml(region); + } else if var_env.contains("mt") { + return Language::Mt(region); + } else if var_env.contains("mi") { + return Language::Mi(region); + } else if var_env.contains("mr") { + return Language::Mr(region); + } else if var_env.contains("mo") { + return Language::Mo(region); + } else if var_env.contains("mn") { + return Language::Mn(region); + } else if var_env.contains("na") { + return Language::Na(region); + } else if var_env.contains("ne") { + return Language::Ne(region); + } else if var_env.contains("no") { + return Language::No(region); + } else if var_env.contains("oc") { + return Language::Oc(region); + } else if var_env.contains("or") { + return Language::Or(region); + } else if var_env.contains("om") { + return Language::Om(region); + } else if var_env.contains("ps") { + return Language::Ps(region); + } else if var_env.contains("fa") { + return Language::Fa(region); + } else if var_env.contains("pl") { + return Language::Pl(region); + } else if var_env.contains("pt") { + return Language::Pt(region); + } else if var_env.contains("pa") { + return Language::Pa(region); + } else if var_env.contains("qu") { + return Language::Qu(region); + } else if var_env.contains("rm") { + return Language::Rm(region); + } else if var_env.contains("ro") { + return Language::Ro(region); + } else if var_env.contains("ru") { + return Language::Ru(region); + } else if var_env.contains("sm") { + return Language::Sm(region); + } else if var_env.contains("sg") { + return Language::Sg(region); + } else if var_env.contains("sa") { + return Language::Sa(region); + } else if var_env.contains("sr") { + return Language::Sr(region); + } else if var_env.contains("sh") { + return Language::Sh(region); + } else if var_env.contains("st") { + return Language::St(region); + } else if var_env.contains("tn") { + return Language::Tn(region); + } else if var_env.contains("sn") { + return Language::Sn(region); + } else if var_env.contains("sd") { + return Language::Sd(region); + } else if var_env.contains("si") { + return Language::Si(region); + } else if var_env.contains("ss") { + return Language::Ss(region); + } else if var_env.contains("sk") { + return Language::Sk(region); + } else if var_env.contains("sl") { + return Language::Sl(region); + } else if var_env.contains("so") { + return Language::So(region); + } else if var_env.contains("es") { + return Language::Es(region); + } else if var_env.contains("su") { + return Language::Su(region); + } else if var_env.contains("sw") { + return Language::Sw(region); + } else if var_env.contains("sv") { + return Language::Sv(region); + } else if var_env.contains("tl") { + return Language::Tl(region); + } else if var_env.contains("tg") { + return Language::Tg(region); + } else if var_env.contains("ta") { + return Language::Ta(region); + } else if var_env.contains("tt") { + return Language::Tt(region); + } else if var_env.contains("te") { + return Language::Te(region); + } else if var_env.contains("th") { + return Language::Th(region); + } else if var_env.contains("bo") { + return Language::Bo(region); + } else if var_env.contains("ti") { + return Language::Ti(region); + } else if var_env.contains("to") { + return Language::To(region); + } else if var_env.contains("ts") { + return Language::Ts(region); + } else if var_env.contains("tr") { + return Language::Tr(region); + } else if var_env.contains("tk") { + return Language::Tk(region); + } else if var_env.contains("tw") { + return Language::Tw(region); + } else if var_env.contains("uk") { + return Language::Uk(region); + } else if var_env.contains("ur") { + return Language::Ur(region); + } else if var_env.contains("uz") { + return Language::Uz(region); + } else if var_env.contains("vi") { + return Language::Vi(region); + } else if var_env.contains("vo") { + return Language::Vo(region); + } else if var_env.contains("cy") { + return Language::Cy(region); + } else if var_env.contains("wo") { + return Language::Wo(region); + } else if var_env.contains("xh") { + return Language::Xh(region); + } else if var_env.contains("ji") { + return Language::Ji(region); + } else if var_env.contains("yo") { + return Language::Yo(region); + } else if var_env.contains("zu") { + return Language::Zu(region); + } + + // unknown language + return Language::En(Region::Any); + } +} + + // FIXME: V2: Move `Unknown` variants to the top of the enum. /// The desktop environment of a system #[derive(Debug, PartialEq, Eq, Clone)] #[non_exhaustive] pub enum DesktopEnv { + /// Unknown desktop environment + Unknown(String), + /// Popular GTK-based desktop environment on Linux Gnome, /// One of the desktop environments for a specific version of Windows @@ -3765,8 +4603,6 @@ pub enum DesktopEnv { Ermine, /// Default desktop environment for Redox Orbital, - /// Unknown desktop environment - Unknown(String), } impl Display for DesktopEnv { From b0302a32ba34a969f2ae118d8856268a9c26676c Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Tue, 9 Jan 2024 01:35:49 +0200 Subject: [PATCH 8/9] fixed some cognitive complexity warnings --- src/lib.rs | 1586 ++++++++++++++++++++++++++++------------------------ 1 file changed, 848 insertions(+), 738 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 89d1ffd..e132739 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,18 +120,19 @@ use std::{ /// output : en_US.UTF-8 /// en : language /// US : country +#[allow(dead_code)] fn get_language_and_country() -> String { - if let Some(language) = env::var("LC_ALL").ok() { + if let Ok(language) = env::var("LC_ALL") { // possible output : en_US.UTF-8 return language; - } else if let Some(language) = env::var("LANG").ok() { + } else if let Ok(language) = env::var("LANG") { // possible output : en_US.UTF-8 return language; - } else if let Some(language) = env::var("LANGUAGE").ok() { + } else if let Ok(language) = env::var("LANGUAGE") { // possible output : en_US.UTF-8 return language; } - return String::new(); + String::new() } @@ -1672,10 +1673,11 @@ impl Display for Region { } /// the `function get_language_and_country` returns a String -/// `en_US.UTF-8` : `language_country.textencoding` +/// `en_US.UTF-8` : `language_country.text_encoding` /// the two uppercase letters between the underscore `_` and `.UTF-8` /// represent the `country` impl Region { + #[allow(dead_code)] fn get() -> Self { let var_env: String = get_language_and_country(); // output : en_US.UTF-8 @@ -1685,151 +1687,171 @@ impl Region { // the country is written in uppercase if var_env.is_empty() { return Region::Any; - } else if var_env.contains("AF") { - return Region::Af; - } else if var_env.contains("AL") { - return Region::Al; - } else if var_env.contains("DZ") { - return Region::Dz; - } else if var_env.contains("AS") { - return Region::As; - } else if var_env.contains("AD") { - return Region::Ad; - } else if var_env.contains("AO") { - return Region::Ao; - } else if var_env.contains("AI") { - return Region::Ai; - } else if var_env.contains("AQ") { - return Region::Aq; - } else if var_env.contains("AG") { - return Region::Ag; - } else if var_env.contains("AR") { - return Region::Ar; - } else if var_env.contains("AM") { - return Region::Am; - } else if var_env.contains("AW") { - return Region::Aw; - } else if var_env.contains("AU") { - return Region::Au; - } else if var_env.contains("AT") { - return Region::At; - } else if var_env.contains("AZ") { - return Region::Az; - } else if var_env.contains("BS") { - return Region::Bs; - } else if var_env.contains("BH") { - return Region::Bh; - } else if var_env.contains("BD") { - return Region::Bd; - } else if var_env.contains("BB") { - return Region::Bb; - } else if var_env.contains("BY") { - return Region::By; - } else if var_env.contains("BE") { - return Region::Be; - } else if var_env.contains("BZ") { - return Region::Bz; - } else if var_env.contains("BJ") { - return Region::Bj; - } else if var_env.contains("BM") { - return Region::Bm; - } else if var_env.contains("BT") { - return Region::Bt; - } else if var_env.contains("BO") { - return Region::Bo; - } else if var_env.contains("BQ") { - return Region::Bq; - } else if var_env.contains("BA") { - return Region::Ba; - } else if var_env.contains("BW") { - return Region::Bw; - } else if var_env.contains("BV") { - return Region::Bv; - } else if var_env.contains("BR") { - return Region::Br; - } else if var_env.contains("IO") { - return Region::Io; - } else if var_env.contains("BN") { - return Region::Bn; - } else if var_env.contains("BG") { - return Region::Bg; - } else if var_env.contains("BF") { - return Region::Bf; - } else if var_env.contains("BI") { - return Region::Bi; - } else if var_env.contains("CV") { - return Region::Cv; - } else if var_env.contains("KH") { - return Region::Kh; - } else if var_env.contains("CM") { - return Region::Cm; - } else if var_env.contains("CA") { - return Region::Ca; - } else if var_env.contains("KY") { - return Region::Ky; - } else if var_env.contains("CF") { - return Region::Cf; - } else if var_env.contains("TD") { - return Region::Td; - } else if var_env.contains("CL") { - return Region::Cl; - } else if var_env.contains("CN") { - return Region::Cn; - } else if var_env.contains("CX") { - return Region::Cx; - } else if var_env.contains("CC") { - return Region::Cc; - } else if var_env.contains("CO") { - return Region::Cd; - } else if var_env.contains("KM") { - return Region::Km; - } else if var_env.contains("CD") { - return Region::Cd; - } else if var_env.contains("CG") { - return Region::Cg; - } else if var_env.contains("CK") { - return Region::Ck; - } else if var_env.contains("CR") { - return Region::Cr; - } else if var_env.contains("HR") { - return Region::Hr; - } else if var_env.contains("CU") { - return Region::Cu; - } else if var_env.contains("CW") { - return Region::Cw; - } else if var_env.contains("CY") { - return Region::Cy; - } else if var_env.contains("CZ") { - return Region::Cz; - } else if var_env.contains("CI") { - return Region::Ci; - } else if var_env.contains("DK") { - return Region::Dk; - } else if var_env.contains("DJ") { - return Region::Dj; - } else if var_env.contains("DM") { - return Region::Dm; - } else if var_env.contains("DO") { - return Region::Do; - } else if var_env.contains("EC") { - return Region::Ec; - } else if var_env.contains("EG") { - return Region::Eg; - } else if var_env.contains("SV") { - return Region::Sv; - } else if var_env.contains("GQ") { - return Region::Gq; - } else if var_env.contains("ER") { - return Region::Er; - } else if var_env.contains("EE") { - return Region::Ee; - } else if var_env.contains("SZ") { - return Region::Sz; - } else if var_env.contains("ET") { - return Region::Et; - } else if var_env.contains("FK") { - return Region::Fk; - } else if var_env.contains("FO") { + } + + get_region_helper() + } +} + +fn get_region_helper() -> Region { + let var_env: String = get_language_and_country(); + + if var_env.contains("AF") { + return Region::Af; + } else if var_env.contains("AL") { + return Region::Al; + } else if var_env.contains("DZ") { + return Region::Dz; + } else if var_env.contains("AS") { + return Region::As; + } else if var_env.contains("AD") { + return Region::Ad; + } else if var_env.contains("AO") { + return Region::Ao; + } else if var_env.contains("AI") { + return Region::Ai; + } else if var_env.contains("AQ") { + return Region::Aq; + } else if var_env.contains("AG") { + return Region::Ag; + } else if var_env.contains("AR") { + return Region::Ar; + } else if var_env.contains("AM") { + return Region::Am; + } else if var_env.contains("AW") { + return Region::Aw; + } else if var_env.contains("AU") { + return Region::Au; + } else if var_env.contains("AT") { + return Region::At; + } else if var_env.contains("AZ") { + return Region::Az; + } else if var_env.contains("BS") { + return Region::Bs; + } else if var_env.contains("BH") { + return Region::Bh; + } else if var_env.contains("BD") { + return Region::Bd; + } else if var_env.contains("BB") { + return Region::Bb; + } else if var_env.contains("BY") { + return Region::By; + } else if var_env.contains("BE") { + return Region::Be; + } else if var_env.contains("BZ") { + return Region::Bz; + } else if var_env.contains("BJ") { + return Region::Bj; + } else if var_env.contains("BM") { + return Region::Bm; + } else if var_env.contains("BT") { + return Region::Bt; + } else if var_env.contains("BO") { + return Region::Bo; + } else if var_env.contains("BQ") { + return Region::Bq; + } else if var_env.contains("BA") { + return Region::Ba; + } else if var_env.contains("BW") { + return Region::Bw; + } else if var_env.contains("BV") { + return Region::Bv; + } else if var_env.contains("BR") { + return Region::Br; + } else if var_env.contains("IO") { + return Region::Io; + } else if var_env.contains("BN") { + return Region::Bn; + } else if var_env.contains("BG") { + return Region::Bg; + } else if var_env.contains("BF") { + return Region::Bf; + } else if var_env.contains("BI") { + return Region::Bi; + } else if var_env.contains("CV") { + return Region::Cv; + } else if var_env.contains("KH") { + return Region::Kh; + } else if var_env.contains("CM") { + return Region::Cm; + } else if var_env.contains("CA") { + return Region::Ca; + } else if var_env.contains("KY") { + return Region::Ky; + } else if var_env.contains("CF") { + return Region::Cf; + } else if var_env.contains("TD") { + return Region::Td; + } else if var_env.contains("CL") { + return Region::Cl; + } else if var_env.contains("CN") { + return Region::Cn; + } else if var_env.contains("CX") { + return Region::Cx; + } else if var_env.contains("CC") { + return Region::Cc; + } else if var_env.contains("CO") { + return Region::Cd; + } + second_get_region_helper(var_env) +} + +fn second_get_region_helper(var_env: String) -> Region { + if var_env.contains("KM") { + return Region::Km; + } else if var_env.contains("CD") { + return Region::Cd; + } else if var_env.contains("CG") { + return Region::Cg; + } else if var_env.contains("CK") { + return Region::Ck; + } else if var_env.contains("CR") { + return Region::Cr; + } else if var_env.contains("HR") { + return Region::Hr; + } else if var_env.contains("CU") { + return Region::Cu; + } else if var_env.contains("CW") { + return Region::Cw; + } else if var_env.contains("CY") { + return Region::Cy; + } else if var_env.contains("CZ") { + return Region::Cz; + } else if var_env.contains("CI") { + return Region::Ci; + } else if var_env.contains("DK") { + return Region::Dk; + } else if var_env.contains("DJ") { + return Region::Dj; + } else if var_env.contains("DM") { + return Region::Dm; + } else if var_env.contains("DO") { + return Region::Do; + } else if var_env.contains("EC") { + return Region::Ec; + } else if var_env.contains("EG") { + return Region::Eg; + } else if var_env.contains("SV") { + return Region::Sv; + } else if var_env.contains("GQ") { + return Region::Gq; + } else if var_env.contains("ER") { + return Region::Er; + } else if var_env.contains("EE") { + return Region::Ee; + } else if var_env.contains("SZ") { + return Region::Sz; + } else if var_env.contains("ET") { + return Region::Et; + } else if var_env.contains("FK") { + return Region::Fk; + } + + third_get_region_helper(var_env) +} + + fn third_get_region_helper(var_env: String) -> Region { + if var_env.contains("FO") { return Region::Fo; } else if var_env.contains("FJ") { return Region::Fj; @@ -1877,316 +1899,351 @@ impl Region { return Region::Gy; } else if var_env.contains("HT") { return Region::Ht; - } else if var_env.contains("HM") { - return Region::Hm; - } else if var_env.contains("VA") { - return Region::Va; - } else if var_env.contains("HN") { - return Region::Hn; - } else if var_env.contains("HK") { - return Region::Hk; - } else if var_env.contains("HU") { - return Region::Hu; - } else if var_env.contains("IS") { - return Region::Is; - } else if var_env.contains("IN") { - return Region::In; - } else if var_env.contains("ID") { - return Region::Id; - } else if var_env.contains("IR") { - return Region::Ir; - } else if var_env.contains("IQ") { - return Region::Iq; - } else if var_env.contains("IE") { - return Region::Ie; - } else if var_env.contains("IM") { - return Region::Im; - } else if var_env.contains("IL") { - return Region::Il; - } else if var_env.contains("IT") { - return Region::It; - } else if var_env.contains("JM") { - return Region::Jm; - } else if var_env.contains("JP") { - return Region::Jp; - } else if var_env.contains("JE") { - return Region::Je; - } else if var_env.contains("JO") { - return Region::Jo; - } else if var_env.contains("KZ") { - return Region::Kz; - } else if var_env.contains("KE") { - return Region::Ke; - } else if var_env.contains("KI") { - return Region::Ki; - } else if var_env.contains("KP") { - return Region::Kp; - } else if var_env.contains("KR") { - return Region::Kr; - } else if var_env.contains("KW") { - return Region::Kw; - } else if var_env.contains("KG") { - return Region::Kg; - } else if var_env.contains("LA") { - return Region::La; - } else if var_env.contains("LV") { - return Region::Lv; - } else if var_env.contains("LB") { - return Region::Lb; - } else if var_env.contains("LS") { - return Region::Ls; - } else if var_env.contains("LR") { - return Region::Lr; - } else if var_env.contains("LY") { - return Region::Ly; - } else if var_env.contains("LI") { - return Region::Li; - } else if var_env.contains("LT") { - return Region::Lt; - } else if var_env.contains("LU") { - return Region::Lu; - } else if var_env.contains("MO") { - return Region::Mo; - } else if var_env.contains("MG") { - return Region::Mg; - } else if var_env.contains("MW") { - return Region::Mw; - } else if var_env.contains("MY") { - return Region::My; - } else if var_env.contains("MV") { - return Region::Mv; - } else if var_env.contains("ML") { - return Region::Ml; - } else if var_env.contains("MT") { - return Region::Mt; - } else if var_env.contains("MH") { - return Region::Mh; - } else if var_env.contains("MQ") { - return Region::Mq; - } else if var_env.contains("MR") { - return Region::Mr; - } else if var_env.contains("MU") { - return Region::Mu; - } else if var_env.contains("YT") { - return Region::Yt; - } else if var_env.contains("MX") { - return Region::Mx; - } else if var_env.contains("FM") { - return Region::Fm; - } else if var_env.contains("MD") { - return Region::Md; - } else if var_env.contains("MC") { - return Region::Mc; - } else if var_env.contains("MN") { - return Region::Mn; - } else if var_env.contains("ME") { - return Region::Me; - } else if var_env.contains("MS") { - return Region::Ms; - } else if var_env.contains("MA") { - return Region::Ma; - } else if var_env.contains("MZ") { - return Region::Mz; - } else if var_env.contains("MM") { - return Region::Mm; - } else if var_env.contains("NA") { - return Region::Na; - } else if var_env.contains("NR") { - return Region::Nr; - } else if var_env.contains("NP") { - return Region::Np; - } else if var_env.contains("NL") { - return Region::Nl; - } else if var_env.contains("NC") { - return Region::Nc; - } else if var_env.contains("NZ") { - return Region::Nz; - } else if var_env.contains("NI") { - return Region::Ni; - } else if var_env.contains("NE") { - return Region::Ne; - } else if var_env.contains("NG") { - return Region::Ng; - } else if var_env.contains("NU") { - return Region::Nu; - } else if var_env.contains("NF") { - return Region::Nf; - } else if var_env.contains("MP") { - return Region::Mp; - } else if var_env.contains("NO") { - return Region::No; - } else if var_env.contains("OM") { - return Region::Om; - } else if var_env.contains("PK") { - return Region::Pk; - } else if var_env.contains("PW") { - return Region::Pw; - } else if var_env.contains("PS") { - return Region::Ps; - } else if var_env.contains("PA") { - return Region::Pa; - } else if var_env.contains("PG") { - return Region::Pg; - } else if var_env.contains("PY") { - return Region::Py; - } else if var_env.contains("PE") { - return Region::Pe; - } else if var_env.contains("PH") { - return Region::Ph; - } else if var_env.contains("PN") { - return Region::Pn; - } else if var_env.contains("PL") { - return Region::Pl; - } else if var_env.contains("PT") { - return Region::Pt; - } else if var_env.contains("PR") { - return Region::Pr; - } else if var_env.contains("QA") { - return Region::Qa; - } else if var_env.contains("MK") { - return Region::Mk; - } else if var_env.contains("RO") { - return Region::Ro; - } else if var_env.contains("RU") { - return Region::Ru; - } else if var_env.contains("RW") { - return Region::Rw; - } else if var_env.contains("RE") { - return Region::Re; - } else if var_env.contains("BL") { - return Region::Bl; - } else if var_env.contains("SH") { - return Region::Sh; - } else if var_env.contains("KN") { - return Region::Kn; - } else if var_env.contains("LC") { - return Region::Lc; - } else if var_env.contains("MF") { - return Region::Mf; - } else if var_env.contains("PM") { - return Region::Pm; - } else if var_env.contains("VC") { - return Region::Vc; - } else if var_env.contains("WS") { - return Region::Ws; - } else if var_env.contains("SM") { - return Region::Sm; - } else if var_env.contains("ST") { - return Region::St; - } else if var_env.contains("SA") { - return Region::Sa; - } else if var_env.contains("SN") { - return Region::Sn; - } else if var_env.contains("RS") { - return Region::Rs; - } else if var_env.contains("SC") { - return Region::Sc; - } else if var_env.contains("SL") { - return Region::Sl; - } else if var_env.contains("SG") { - return Region::Sg; - } else if var_env.contains("SX") { - return Region::Sx; - } else if var_env.contains("SK") { - return Region::Sk; - } else if var_env.contains("SI") { - return Region::Si; - } else if var_env.contains("SB") { - return Region::Sb; - } else if var_env.contains("SO") { - return Region::So; - } else if var_env.contains("ZA") { - return Region::Za; - } else if var_env.contains("GS") { - return Region::Gs; - } else if var_env.contains("SS") { - return Region::Ss; - } else if var_env.contains("ES") { - return Region::Es; - } else if var_env.contains("LK") { - return Region::Lk; - } else if var_env.contains("SD") { - return Region::Sd; - } else if var_env.contains("SR") { - return Region::Sr; - } else if var_env.contains("SJ") { - return Region::Sj; - } else if var_env.contains("SE") { - return Region::Se; - } else if var_env.contains("CH") { - return Region::Ch; - } else if var_env.contains("SY") { - return Region::Sy; - } else if var_env.contains("TW") { - return Region::Tw; - } else if var_env.contains("TJ") { - return Region::Tj; - } else if var_env.contains("TZ") { - return Region::Tz; - } else if var_env.contains("TH") { - return Region::Th; - } else if var_env.contains("TL") { - return Region::Tl; - } else if var_env.contains("TG") { - return Region::Tg; - } else if var_env.contains("TK") { - return Region::Tk; - } else if var_env.contains("TO") { - return Region::To; - } else if var_env.contains("TT") { - return Region::Tt; - } else if var_env.contains("TN") { - return Region::Tn; - } else if var_env.contains("TR") { - return Region::Tr; - } else if var_env.contains("TM") { - return Region::Tm; - } else if var_env.contains("TC") { - return Region::Tc; - } else if var_env.contains("TV") { - return Region::Tv; - } else if var_env.contains("UG") { - return Region::Ug; - } else if var_env.contains("UA") { - return Region::Ua; - } else if var_env.contains("AE") { - return Region::Ae; - } else if var_env.contains("GB") { - return Region::Gb; - } else if var_env.contains("UM") { - return Region::Um; - } else if var_env.contains("US") { - return Region::Us; - } else if var_env.contains("UY") { - return Region::Uy; - } else if var_env.contains("UZ") { - return Region::Uz; - } else if var_env.contains("VU") { - return Region::Vu; - } else if var_env.contains("VE") { - return Region::Ve; - } else if var_env.contains("VN") { - return Region::Vn; - } else if var_env.contains("VG") { - return Region::Vg; - } else if var_env.contains("VI") { - return Region::Vi; - } else if var_env.contains("WF") { - return Region::Wf; - } else if var_env.contains("EH") { - return Region::Eh; - } else if var_env.contains("YE") { - return Region::Ye; - } else if var_env.contains("ZM") { - return Region::Zm; - } else if var_env.contains("ZW") { - return Region::Zw; - } else if var_env.contains("AX") { - return Region::Ax; } - return Region::Any; + forth_get_region_helper(var_env) + } + +fn forth_get_region_helper(var_env: String) -> Region { + if var_env.contains("HM") { + return Region::Hm; + } else if var_env.contains("VA") { + return Region::Va; + } else if var_env.contains("HN") { + return Region::Hn; + } else if var_env.contains("HK") { + return Region::Hk; + } else if var_env.contains("HU") { + return Region::Hu; + } else if var_env.contains("IS") { + return Region::Is; + } else if var_env.contains("IN") { + return Region::In; + } else if var_env.contains("ID") { + return Region::Id; + } else if var_env.contains("IR") { + return Region::Ir; + } else if var_env.contains("IQ") { + return Region::Iq; + } else if var_env.contains("IE") { + return Region::Ie; + } else if var_env.contains("IM") { + return Region::Im; + } else if var_env.contains("IL") { + return Region::Il; + } else if var_env.contains("IT") { + return Region::It; + } else if var_env.contains("JM") { + return Region::Jm; + } else if var_env.contains("JP") { + return Region::Jp; + } else if var_env.contains("JE") { + return Region::Je; + } else if var_env.contains("JO") { + return Region::Jo; + } else if var_env.contains("KZ") { + return Region::Kz; + } else if var_env.contains("KE") { + return Region::Ke; + } else if var_env.contains("KI") { + return Region::Ki; + } else if var_env.contains("KP") { + return Region::Kp; + } else if var_env.contains("KR") { + return Region::Kr; + } else if var_env.contains("KW") { + return Region::Kw; + } + + fifth_get_region_helper(var_env) +} + +fn fifth_get_region_helper(var_env: String) -> Region { + if var_env.contains("KG") { + return Region::Kg; + } else if var_env.contains("LA") { + return Region::La; + } else if var_env.contains("LV") { + return Region::Lv; + } else if var_env.contains("LB") { + return Region::Lb; + } else if var_env.contains("LS") { + return Region::Ls; + } else if var_env.contains("LR") { + return Region::Lr; + } else if var_env.contains("LY") { + return Region::Ly; + } else if var_env.contains("LI") { + return Region::Li; + } else if var_env.contains("LT") { + return Region::Lt; + } else if var_env.contains("LU") { + return Region::Lu; + } else if var_env.contains("MO") { + return Region::Mo; + } else if var_env.contains("MG") { + return Region::Mg; + } else if var_env.contains("MW") { + return Region::Mw; + } else if var_env.contains("MY") { + return Region::My; + } else if var_env.contains("MV") { + return Region::Mv; + } else if var_env.contains("ML") { + return Region::Ml; + } else if var_env.contains("MT") { + return Region::Mt; + } else if var_env.contains("MH") { + return Region::Mh; + } else if var_env.contains("MQ") { + return Region::Mq; + } else if var_env.contains("MR") { + return Region::Mr; + } else if var_env.contains("MU") { + return Region::Mu; + } else if var_env.contains("YT") { + return Region::Yt; + } else if var_env.contains("MX") { + return Region::Mx; + } else if var_env.contains("FM") { + return Region::Fm; + } + + sixth_get_region_helper(var_env) +} + +fn sixth_get_region_helper(var_env: String) -> Region { + if var_env.contains("MD") { + return Region::Md; + } else if var_env.contains("MC") { + return Region::Mc; + } else if var_env.contains("MN") { + return Region::Mn; + } else if var_env.contains("ME") { + return Region::Me; + } else if var_env.contains("MS") { + return Region::Ms; + } else if var_env.contains("MA") { + return Region::Ma; + } else if var_env.contains("MZ") { + return Region::Mz; + } else if var_env.contains("MM") { + return Region::Mm; + } else if var_env.contains("NA") { + return Region::Na; + } else if var_env.contains("NR") { + return Region::Nr; + } else if var_env.contains("NP") { + return Region::Np; + } else if var_env.contains("NL") { + return Region::Nl; + } else if var_env.contains("NC") { + return Region::Nc; + } else if var_env.contains("NZ") { + return Region::Nz; + } else if var_env.contains("NI") { + return Region::Ni; + } else if var_env.contains("NE") { + return Region::Ne; + } else if var_env.contains("NG") { + return Region::Ng; + } else if var_env.contains("NU") { + return Region::Nu; + } else if var_env.contains("NF") { + return Region::Nf; + } else if var_env.contains("MP") { + return Region::Mp; + } else if var_env.contains("NO") { + return Region::No; + } else if var_env.contains("OM") { + return Region::Om; + } else if var_env.contains("PK") { + return Region::Pk; + } else if var_env.contains("PW") { + return Region::Pw; + } + + seventh_get_region_helper(var_env) +} + + +fn seventh_get_region_helper(var_env: String) -> Region { + if var_env.contains("PS") { + return Region::Ps; + } else if var_env.contains("PA") { + return Region::Pa; + } else if var_env.contains("PG") { + return Region::Pg; + } else if var_env.contains("PY") { + return Region::Py; + } else if var_env.contains("PE") { + return Region::Pe; + } else if var_env.contains("PH") { + return Region::Ph; + } else if var_env.contains("PN") { + return Region::Pn; + } else if var_env.contains("PL") { + return Region::Pl; + } else if var_env.contains("PT") { + return Region::Pt; + } else if var_env.contains("PR") { + return Region::Pr; + } else if var_env.contains("QA") { + return Region::Qa; + } else if var_env.contains("MK") { + return Region::Mk; + } else if var_env.contains("RO") { + return Region::Ro; + } else if var_env.contains("RU") { + return Region::Ru; + } else if var_env.contains("RW") { + return Region::Rw; + } else if var_env.contains("RE") { + return Region::Re; + } else if var_env.contains("BL") { + return Region::Bl; + } else if var_env.contains("SH") { + return Region::Sh; + } else if var_env.contains("KN") { + return Region::Kn; + } else if var_env.contains("LC") { + return Region::Lc; + } else if var_env.contains("MF") { + return Region::Mf; + } else if var_env.contains("PM") { + return Region::Pm; + } else if var_env.contains("VC") { + return Region::Vc; + } else if var_env.contains("WS") { + return Region::Ws; + } + + eight_get_region_helper(var_env) +} + +fn eight_get_region_helper(var_env: String) -> Region { + if var_env.contains("SM") { + return Region::Sm; + } else if var_env.contains("ST") { + return Region::St; + } else if var_env.contains("SA") { + return Region::Sa; + } else if var_env.contains("SN") { + return Region::Sn; + } else if var_env.contains("RS") { + return Region::Rs; + } else if var_env.contains("SC") { + return Region::Sc; + } else if var_env.contains("SL") { + return Region::Sl; + } else if var_env.contains("SG") { + return Region::Sg; + } else if var_env.contains("SX") { + return Region::Sx; + } else if var_env.contains("SK") { + return Region::Sk; + } else if var_env.contains("SI") { + return Region::Si; + } else if var_env.contains("SB") { + return Region::Sb; + } else if var_env.contains("SO") { + return Region::So; + } else if var_env.contains("ZA") { + return Region::Za; + } else if var_env.contains("GS") { + return Region::Gs; + } else if var_env.contains("SS") { + return Region::Ss; + } else if var_env.contains("ES") { + return Region::Es; + } else if var_env.contains("LK") { + return Region::Lk; + } else if var_env.contains("SD") { + return Region::Sd; + } else if var_env.contains("SR") { + return Region::Sr; + } else if var_env.contains("SJ") { + return Region::Sj; + } else if var_env.contains("SE") { + return Region::Se; + } else if var_env.contains("CH") { + return Region::Ch; + } else if var_env.contains("SY") { + return Region::Sy; + } + + ninth_get_region_helper(var_env) +} + +fn ninth_get_region_helper(var_env: String) -> Region { + if var_env.contains("TW") { + return Region::Tw; + } else if var_env.contains("TJ") { + return Region::Tj; + } else if var_env.contains("TZ") { + return Region::Tz; + } else if var_env.contains("TH") { + return Region::Th; + } else if var_env.contains("TL") { + return Region::Tl; + } else if var_env.contains("TG") { + return Region::Tg; + } else if var_env.contains("TK") { + return Region::Tk; + } else if var_env.contains("TO") { + return Region::To; + } else if var_env.contains("TT") { + return Region::Tt; + } else if var_env.contains("TN") { + return Region::Tn; + } else if var_env.contains("TR") { + return Region::Tr; + } else if var_env.contains("TM") { + return Region::Tm; + } else if var_env.contains("TC") { + return Region::Tc; + } else if var_env.contains("TV") { + return Region::Tv; + } else if var_env.contains("UG") { + return Region::Ug; + } else if var_env.contains("UA") { + return Region::Ua; + } else if var_env.contains("AE") { + return Region::Ae; + } else if var_env.contains("GB") { + return Region::Gb; + } else if var_env.contains("UM") { + return Region::Um; + } else if var_env.contains("US") { + return Region::Us; + } else if var_env.contains("UY") { + return Region::Uy; + } else if var_env.contains("UZ") { + return Region::Uz; + } else if var_env.contains("VU") { + return Region::Vu; + } else if var_env.contains("VE") { + return Region::Ve; + } else if var_env.contains("VN") { + return Region::Vn; + } else if var_env.contains("VG") { + return Region::Vg; + } else if var_env.contains("VI") { + return Region::Vi; + } else if var_env.contains("WF") { + return Region::Wf; + } else if var_env.contains("EH") { + return Region::Eh; + } else if var_env.contains("YE") { + return Region::Ye; + } else if var_env.contains("ZM") { + return Region::Zm; + } else if var_env.contains("ZW") { + return Region::Zw; + } else if var_env.contains("AX") { + return Region::Ax; } + Region::Any } /// A spoken language @@ -2896,6 +2953,7 @@ impl Language { } impl Display for Language { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { Self::__(code) => f.write_str(code.as_str()), @@ -4265,299 +4323,351 @@ impl Display for Language { + + /// the `function get_language_and_country` returns a String /// `en_US.UTF-8` : `language_country.textencoding` /// the two lowercase letters before the underscore `_` /// represents the `language` impl Language { + #[allow(dead_code)] fn get() -> Self { - let var_env: String = get_language_and_country(); - // output : en_US.UTF-8 - // en : language - // US : country (region) - - let region: Region = Region::get(); // the language is written with two lowercase characters - if var_env.contains("ab") { - return Language::Ab(region); - } else if var_env.contains("aa") { - return Language::Aa(region); - } else if var_env.contains("af") { - return Language::Af(region); - } else if var_env.contains("sq") { - return Language::Sq(region); - } else if var_env.contains("am") { - return Language::Am(region); - } else if var_env.contains("ar") { - return Language::Ar(region); - } else if var_env.contains("hy") { - return Language::Hy(region); - } else if var_env.contains("as") { - return Language::As(region); - } else if var_env.contains("ay") { - return Language::Ay(region); - } else if var_env.contains("az") { - return Language::Az(region); - } else if var_env.contains("ba") { - return Language::Ba(region); - } else if var_env.contains("eu") { - return Language::Eu(region); - } else if var_env.contains("bn") { - return Language::Bn(region); - } else if var_env.contains("dz") { - return Language::Dz(region); - } else if var_env.contains("bh") { - return Language::Bh(region); - } else if var_env.contains("bi") { - return Language::Bi(region); - } else if var_env.contains("br") { - return Language::Br(region); - } else if var_env.contains("bg") { - return Language::Bg(region); - } else if var_env.contains("my") { - return Language::My(region); - } else if var_env.contains("be") { - return Language::Be(region); - } else if var_env.contains("km") { - return Language::Km(region); - } else if var_env.contains("ca") { - return Language::Ca(region); - } else if var_env.contains("zh") { - return Language::Zh(region); - } else if var_env.contains("co") { - return Language::Co(region); - } else if var_env.contains("hr") { - return Language::Hr(region); - } else if var_env.contains("cs") { - return Language::Cs(region); - } else if var_env.contains("da") { - return Language::Da(region); - } else if var_env.contains("nl") { - return Language::Nl(region); - } else if var_env.contains("en") { - return Language::En(region); - } else if var_env.contains("eo") { - return Language::Eo(region); - } else if var_env.contains("et") { - return Language::Et(region); - } else if var_env.contains("fo") { - return Language::Fo(region); - } else if var_env.contains("fj") { - return Language::Fj(region); - } else if var_env.contains("fi") { - return Language::Fi(region); - } else if var_env.contains("fr") { - return Language::Fr(region); - } else if var_env.contains("fy") { - return Language::Fy(region); - } else if var_env.contains("gd") { - return Language::Gd(region); - } else if var_env.contains("gl") { - return Language::Gl(region); - } else if var_env.contains("ka") { - return Language::Ka(region); - } else if var_env.contains("de") { - return Language::De(region); - } else if var_env.contains("el") { - return Language::El(region); - } else if var_env.contains("kl") { - return Language::Kl(region); - } else if var_env.contains("gn") { - return Language::Gn(region); - } else if var_env.contains("gu") { - return Language::Gu(region); - } else if var_env.contains("ha") { - return Language::Ha(region); - } else if var_env.contains("iw") { - return Language::Iw(region); - } else if var_env.contains("hi") { - return Language::Hi(region); - } else if var_env.contains("hu") { - return Language::Hu(region); - } else if var_env.contains("is") { - return Language::Is(region); - } else if var_env.contains("in") { - return Language::In(region); - } else if var_env.contains("ia") { - return Language::Ia(region); - } else if var_env.contains("ie") { - return Language::Ie(region); - } else if var_env.contains("ik") { - return Language::Ik(region); - } else if var_env.contains("ga") { - return Language::Ga(region); - } else if var_env.contains("it") { - return Language::It(region); - } else if var_env.contains("ja") { - return Language::Ja(region); - } else if var_env.contains("jw") { - return Language::Jw(region); - } else if var_env.contains("kn") { - return Language::Kn(region); - } else if var_env.contains("ks") { - return Language::Ks(region); - } else if var_env.contains("kk") { - return Language::Kk(region); - } else if var_env.contains("rw") { - return Language::Rw(region); - } else if var_env.contains("ky") { - return Language::Ky(region); - } else if var_env.contains("rn") { - return Language::Rn(region); - } else if var_env.contains("ko") { - return Language::Ko(region); - } else if var_env.contains("ku") { - return Language::Ku(region); - } else if var_env.contains("lo") { - return Language::Lo(region); - } else if var_env.contains("la") { - return Language::La(region); - } else if var_env.contains("lv") { - return Language::Lv(region); - } else if var_env.contains("ln") { - return Language::Ln(region); - } else if var_env.contains("lt") { - return Language::Lt(region); - } else if var_env.contains("mk") { - return Language::Mk(region); - } else if var_env.contains("mg") { - return Language::Mg(region); - } else if var_env.contains("ms") { - return Language::Ms(region); - } else if var_env.contains("ml") { - return Language::Ml(region); - } else if var_env.contains("mt") { - return Language::Mt(region); - } else if var_env.contains("mi") { - return Language::Mi(region); - } else if var_env.contains("mr") { - return Language::Mr(region); - } else if var_env.contains("mo") { - return Language::Mo(region); - } else if var_env.contains("mn") { - return Language::Mn(region); - } else if var_env.contains("na") { - return Language::Na(region); - } else if var_env.contains("ne") { - return Language::Ne(region); - } else if var_env.contains("no") { - return Language::No(region); - } else if var_env.contains("oc") { - return Language::Oc(region); - } else if var_env.contains("or") { - return Language::Or(region); - } else if var_env.contains("om") { - return Language::Om(region); - } else if var_env.contains("ps") { - return Language::Ps(region); - } else if var_env.contains("fa") { - return Language::Fa(region); - } else if var_env.contains("pl") { - return Language::Pl(region); - } else if var_env.contains("pt") { - return Language::Pt(region); - } else if var_env.contains("pa") { - return Language::Pa(region); - } else if var_env.contains("qu") { - return Language::Qu(region); - } else if var_env.contains("rm") { - return Language::Rm(region); - } else if var_env.contains("ro") { - return Language::Ro(region); - } else if var_env.contains("ru") { - return Language::Ru(region); - } else if var_env.contains("sm") { - return Language::Sm(region); - } else if var_env.contains("sg") { - return Language::Sg(region); - } else if var_env.contains("sa") { - return Language::Sa(region); - } else if var_env.contains("sr") { - return Language::Sr(region); - } else if var_env.contains("sh") { - return Language::Sh(region); - } else if var_env.contains("st") { - return Language::St(region); - } else if var_env.contains("tn") { - return Language::Tn(region); - } else if var_env.contains("sn") { - return Language::Sn(region); - } else if var_env.contains("sd") { - return Language::Sd(region); - } else if var_env.contains("si") { - return Language::Si(region); - } else if var_env.contains("ss") { - return Language::Ss(region); - } else if var_env.contains("sk") { - return Language::Sk(region); - } else if var_env.contains("sl") { - return Language::Sl(region); - } else if var_env.contains("so") { - return Language::So(region); - } else if var_env.contains("es") { - return Language::Es(region); - } else if var_env.contains("su") { - return Language::Su(region); - } else if var_env.contains("sw") { - return Language::Sw(region); - } else if var_env.contains("sv") { - return Language::Sv(region); - } else if var_env.contains("tl") { - return Language::Tl(region); - } else if var_env.contains("tg") { - return Language::Tg(region); - } else if var_env.contains("ta") { - return Language::Ta(region); - } else if var_env.contains("tt") { - return Language::Tt(region); - } else if var_env.contains("te") { - return Language::Te(region); - } else if var_env.contains("th") { - return Language::Th(region); - } else if var_env.contains("bo") { - return Language::Bo(region); - } else if var_env.contains("ti") { - return Language::Ti(region); - } else if var_env.contains("to") { - return Language::To(region); - } else if var_env.contains("ts") { - return Language::Ts(region); - } else if var_env.contains("tr") { - return Language::Tr(region); - } else if var_env.contains("tk") { - return Language::Tk(region); - } else if var_env.contains("tw") { - return Language::Tw(region); - } else if var_env.contains("uk") { - return Language::Uk(region); - } else if var_env.contains("ur") { - return Language::Ur(region); - } else if var_env.contains("uz") { - return Language::Uz(region); - } else if var_env.contains("vi") { - return Language::Vi(region); - } else if var_env.contains("vo") { - return Language::Vo(region); - } else if var_env.contains("cy") { - return Language::Cy(region); - } else if var_env.contains("wo") { - return Language::Wo(region); - } else if var_env.contains("xh") { - return Language::Xh(region); - } else if var_env.contains("ji") { - return Language::Ji(region); - } else if var_env.contains("yo") { - return Language::Yo(region); - } else if var_env.contains("zu") { - return Language::Zu(region); - } + get_language_helper() + } +} - // unknown language - return Language::En(Region::Any); +fn get_language_helper() -> Language { + let var_env: String = get_language_and_country(); + let region: Region = Region::get(); + + if var_env.contains("ab") { + return Language::Ab(region); + } else if var_env.contains("aa") { + return Language::Aa(region); + } else if var_env.contains("af") { + return Language::Af(region); + } else if var_env.contains("sq") { + return Language::Sq(region); + } else if var_env.contains("am") { + return Language::Am(region); + } else if var_env.contains("ar") { + return Language::Ar(region); + } else if var_env.contains("hy") { + return Language::Hy(region); + } else if var_env.contains("as") { + return Language::As(region); + } else if var_env.contains("ay") { + return Language::Ay(region); + } else if var_env.contains("az") { + return Language::Az(region); + } else if var_env.contains("ba") { + return Language::Ba(region); + } else if var_env.contains("eu") { + return Language::Eu(region); + } else if var_env.contains("bn") { + return Language::Bn(region); + } else if var_env.contains("dz") { + return Language::Dz(region); + } else if var_env.contains("bh") { + return Language::Bh(region); + } else if var_env.contains("bi") { + return Language::Bi(region); + } else if var_env.contains("br") { + return Language::Br(region); + } else if var_env.contains("bg") { + return Language::Bg(region); + } else if var_env.contains("my") { + return Language::My(region); + } else if var_env.contains("be") { + return Language::Be(region); + } else if var_env.contains("km") { + return Language::Km(region); + } else if var_env.contains("ca") { + return Language::Ca(region); + } else if var_env.contains("zh") { + return Language::Zh(region); + } else if var_env.contains("co") { + return Language::Co(region); } + + second_get_language_helper() } +fn second_get_language_helper() -> Language { + let var_env: String = get_language_and_country(); + let region: Region = Region::get(); + + if var_env.contains("hr") { + return Language::Hr(region); + } else if var_env.contains("cs") { + return Language::Cs(region); + } else if var_env.contains("da") { + return Language::Da(region); + } else if var_env.contains("nl") { + return Language::Nl(region); + } else if var_env.contains("en") { + return Language::En(region); + } else if var_env.contains("eo") { + return Language::Eo(region); + } else if var_env.contains("et") { + return Language::Et(region); + } else if var_env.contains("fo") { + return Language::Fo(region); + } else if var_env.contains("fj") { + return Language::Fj(region); + } else if var_env.contains("fi") { + return Language::Fi(region); + } else if var_env.contains("fr") { + return Language::Fr(region); + } else if var_env.contains("fy") { + return Language::Fy(region); + } else if var_env.contains("gd") { + return Language::Gd(region); + } else if var_env.contains("gl") { + return Language::Gl(region); + } else if var_env.contains("ka") { + return Language::Ka(region); + } else if var_env.contains("de") { + return Language::De(region); + } else if var_env.contains("el") { + return Language::El(region); + } else if var_env.contains("kl") { + return Language::Kl(region); + } else if var_env.contains("gn") { + return Language::Gn(region); + } else if var_env.contains("gu") { + return Language::Gu(region); + } else if var_env.contains("ha") { + return Language::Ha(region); + } else if var_env.contains("iw") { + return Language::Iw(region); + } else if var_env.contains("hi") { + return Language::Hi(region); + } else if var_env.contains("hu") { + return Language::Hu(region); + } + + third_get_language_helper() +} + + +fn third_get_language_helper() -> Language { + let var_env: String = get_language_and_country(); + let region: Region = Region::get(); + + if var_env.contains("is") { + return Language::Is(region); + } else if var_env.contains("in") { + return Language::In(region); + } else if var_env.contains("ia") { + return Language::Ia(region); + } else if var_env.contains("ie") { + return Language::Ie(region); + } else if var_env.contains("ik") { + return Language::Ik(region); + } else if var_env.contains("ga") { + return Language::Ga(region); + } else if var_env.contains("it") { + return Language::It(region); + } else if var_env.contains("ja") { + return Language::Ja(region); + } else if var_env.contains("jw") { + return Language::Jw(region); + } else if var_env.contains("kn") { + return Language::Kn(region); + } else if var_env.contains("ks") { + return Language::Ks(region); + } else if var_env.contains("kk") { + return Language::Kk(region); + } else if var_env.contains("rw") { + return Language::Rw(region); + } else if var_env.contains("ky") { + return Language::Ky(region); + } else if var_env.contains("rn") { + return Language::Rn(region); + } else if var_env.contains("ko") { + return Language::Ko(region); + } else if var_env.contains("ku") { + return Language::Ku(region); + } else if var_env.contains("lo") { + return Language::Lo(region); + } else if var_env.contains("la") { + return Language::La(region); + } else if var_env.contains("lv") { + return Language::Lv(region); + } else if var_env.contains("ln") { + return Language::Ln(region); + } else if var_env.contains("lt") { + return Language::Lt(region); + } else if var_env.contains("mk") { + return Language::Mk(region); + } else if var_env.contains("mg") { + return Language::Mg(region); + } + + forth_get_language_helper() +} + + +fn forth_get_language_helper() -> Language { + let var_env: String = get_language_and_country(); + let region: Region = Region::get(); + + if var_env.contains("ms") { + return Language::Ms(region); + } else if var_env.contains("ml") { + return Language::Ml(region); + } else if var_env.contains("mt") { + return Language::Mt(region); + } else if var_env.contains("mi") { + return Language::Mi(region); + } else if var_env.contains("mr") { + return Language::Mr(region); + } else if var_env.contains("mo") { + return Language::Mo(region); + } else if var_env.contains("mn") { + return Language::Mn(region); + } else if var_env.contains("na") { + return Language::Na(region); + } else if var_env.contains("ne") { + return Language::Ne(region); + } else if var_env.contains("no") { + return Language::No(region); + } else if var_env.contains("oc") { + return Language::Oc(region); + } else if var_env.contains("or") { + return Language::Or(region); + } else if var_env.contains("om") { + return Language::Om(region); + } else if var_env.contains("ps") { + return Language::Ps(region); + } else if var_env.contains("fa") { + return Language::Fa(region); + } else if var_env.contains("pl") { + return Language::Pl(region); + } else if var_env.contains("pt") { + return Language::Pt(region); + } else if var_env.contains("pa") { + return Language::Pa(region); + } else if var_env.contains("qu") { + return Language::Qu(region); + } else if var_env.contains("rm") { + return Language::Rm(region); + } else if var_env.contains("ro") { + return Language::Ro(region); + } else if var_env.contains("ru") { + return Language::Ru(region); + } else if var_env.contains("sm") { + return Language::Sm(region); + } else if var_env.contains("sg") { + return Language::Sg(region); + } + + fifth_get_language_helper() +} + + +fn fifth_get_language_helper() -> Language { + let var_env: String = get_language_and_country(); + let region: Region = Region::get(); + + if var_env.contains("sa") { + return Language::Sa(region); + } else if var_env.contains("sr") { + return Language::Sr(region); + } else if var_env.contains("sh") { + return Language::Sh(region); + } else if var_env.contains("st") { + return Language::St(region); + } else if var_env.contains("tn") { + return Language::Tn(region); + } else if var_env.contains("sn") { + return Language::Sn(region); + } else if var_env.contains("sd") { + return Language::Sd(region); + } else if var_env.contains("si") { + return Language::Si(region); + } else if var_env.contains("ss") { + return Language::Ss(region); + } else if var_env.contains("sk") { + return Language::Sk(region); + } else if var_env.contains("sl") { + return Language::Sl(region); + } else if var_env.contains("so") { + return Language::So(region); + } else if var_env.contains("es") { + return Language::Es(region); + } else if var_env.contains("su") { + return Language::Su(region); + } else if var_env.contains("sw") { + return Language::Sw(region); + } else if var_env.contains("sv") { + return Language::Sv(region); + } else if var_env.contains("tl") { + return Language::Tl(region); + } else if var_env.contains("tg") { + return Language::Tg(region); + } else if var_env.contains("ta") { + return Language::Ta(region); + } else if var_env.contains("tt") { + return Language::Tt(region); + } else if var_env.contains("te") { + return Language::Te(region); + } else if var_env.contains("th") { + return Language::Th(region); + } else if var_env.contains("bo") { + return Language::Bo(region); + } else if var_env.contains("ti") { + return Language::Ti(region); + } + + sixth_get_language_helper() +} + + +fn sixth_get_language_helper() -> Language { + let var_env: String = get_language_and_country(); + let region: Region = Region::get(); + + if var_env.contains("to") { + return Language::To(region); + } else if var_env.contains("ts") { + return Language::Ts(region); + } else if var_env.contains("tr") { + return Language::Tr(region); + } else if var_env.contains("tk") { + return Language::Tk(region); + } else if var_env.contains("tw") { + return Language::Tw(region); + } else if var_env.contains("uk") { + return Language::Uk(region); + } else if var_env.contains("ur") { + return Language::Ur(region); + } else if var_env.contains("uz") { + return Language::Uz(region); + } else if var_env.contains("vi") { + return Language::Vi(region); + } else if var_env.contains("vo") { + return Language::Vo(region); + } else if var_env.contains("cy") { + return Language::Cy(region); + } else if var_env.contains("wo") { + return Language::Wo(region); + } else if var_env.contains("xh") { + return Language::Xh(region); + } else if var_env.contains("ji") { + return Language::Ji(region); + } else if var_env.contains("yo") { + return Language::Yo(region); + } else if var_env.contains("zu") { + return Language::Zu(region); + } + + // unknown language + Language::En(Region::Any) +} // FIXME: V2: Move `Unknown` variants to the top of the enum. From d72a79fb9ea748b97e28c56a6071334fd5385eb4 Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Tue, 9 Jan 2024 09:33:36 +0200 Subject: [PATCH 9/9] cargo clippy has no errors --- .idea/.gitignore | 8 - .idea/modules.xml | 8 - .idea/vcs.xml | 6 - .idea/whoami.iml | 8 - src/lib.rs | 1240 ++++++--------------------------------------- 5 files changed, 150 insertions(+), 1120 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/whoami.iml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 285cd1e..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/whoami.iml b/.idea/whoami.iml deleted file mode 100644 index 6102194..0000000 --- a/.idea/whoami.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index e132739..3307af5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2959,1369 +2959,429 @@ impl Display for Language { Self::__(code) => f.write_str(code.as_str()), // Abkhazian AB - Self::Ab(region) => { - if *region != Region::Any { - f.write_str("ab_")?; - ::fmt(region, f) - } else { - f.write_str("ab") - } - } + Self::Ab(region) => language_display_helper(*region, f, "ab".to_string()), // Afar AA - Self::Aa(region) => { - if *region != Region::Any { - f.write_str("aa_")?; - ::fmt(region, f) - } else { - f.write_str("aa") - } - } + Self::Aa(region) => language_display_helper(*region, f, "aa".to_string()), // Afrikaans AF - Self::Af(region) => { - if *region != Region::Any { - f.write_str("af_")?; - ::fmt(region, f) - } else { - f.write_str("af") - } - } + Self::Af(region) => language_display_helper(*region, f, "af".to_string()), // Albanian SQ - Self::Sq(region) => { - if *region != Region::Any { - f.write_str("sq_")?; - ::fmt(region, f) - } else { - f.write_str("sq") - } - } + Self::Sq(region) => language_display_helper(*region, f, "sq".to_string()), // Amharic AM - Self::Am(region) => { - if *region != Region::Any { - f.write_str("am_")?; - ::fmt(region, f) - } else { - f.write_str("am") - } - } + Self::Am(region) => language_display_helper(*region, f, "am".to_string()), // Arabic AR - Self::Ar(region) => { - if *region != Region::Any { - f.write_str("ar_")?; - ::fmt(region, f) - } else { - f.write_str("ar") - } - } + Self::Ar(region) => language_display_helper(*region, f, "ar".to_string()), // Armenian HY - Self::Hy(region) => { - if *region != Region::Any { - f.write_str("hy_")?; - ::fmt(region, f) - } else { - f.write_str("hy") - } - } + Self::Hy(region) => language_display_helper(*region, f, "hy".to_string()), // Assamese AS - Self::As(region) => { - if *region != Region::Any { - f.write_str("as_")?; - ::fmt(region, f) - } else { - f.write_str("as") - } - } + Self::As(region) => language_display_helper(*region, f, "as".to_string()), // Aymara AY - Self::Ay(region) => { - if *region != Region::Any { - f.write_str("ay_")?; - ::fmt(region, f) - } else { - f.write_str("ay") - } - } + Self::Ay(region) => language_display_helper(*region, f, "ay".to_string()), // Azerbaijani AZ - Self::Az(region) => { - if *region != Region::Any { - f.write_str("az_")?; - ::fmt(region, f) - } else { - f.write_str("az") - } - } + Self::Az(region) => language_display_helper(*region, f, "az".to_string()), // Bashkir BA - Self::Ba(region) => { - if *region != Region::Any { - f.write_str("ba_")?; - ::fmt(region, f) - } else { - f.write_str("ba") - } - } + Self::Ba(region) => language_display_helper(*region, f, "ba".to_string()), // Basque EU - Self::Eu(region) => { - if *region != Region::Any { - f.write_str("eu_")?; - ::fmt(region, f) - } else { - f.write_str("eu") - } - } + Self::Eu(region) => language_display_helper(*region, f, "eu".to_string()), // Bengali, Bangla BN - Self::Bn(region) => { - if *region != Region::Any { - f.write_str("bn_")?; - ::fmt(region, f) - } else { - f.write_str("bn") - } - } + Self::Bn(region) => language_display_helper(*region, f, "bn".to_string()), // Bhutani DZ - Self::Dz(region) => { - if *region != Region::Any { - f.write_str("dz_")?; - ::fmt(region, f) - } else { - f.write_str("dz") - } - } + Self::Dz(region) => language_display_helper(*region, f, "dz".to_string()), // Bihari BH - Self::Bh(region) => { - if *region != Region::Any { - f.write_str("bh_")?; - ::fmt(region, f) - } else { - f.write_str("bh") - } - } + Self::Bh(region) => language_display_helper(*region, f, "bh".to_string()), // Bislama BI - Self::Bi(region) => { - if *region != Region::Any { - f.write_str("bi_")?; - ::fmt(region, f) - } else { - f.write_str("bi") - } - } + Self::Bi(region) => language_display_helper(*region, f, "bi".to_string()), // Breton BR - Self::Br(region) => { - if *region != Region::Any { - f.write_str("br_")?; - ::fmt(region, f) - } else { - f.write_str("br") - } - } + Self::Br(region) => language_display_helper(*region, f, "br".to_string()), - // Bulgarian BG - Self::Bg(region) => { - if *region != Region::Any { - f.write_str("bg_")?; - ::fmt(region, f) - } else { - f.write_str("bg") - } - } + // Bulgarian BG + Self::Bg(region) => language_display_helper(*region, f, "bg".to_string()), // Burmese MY - Self::My(region) => { - if *region != Region::Any { - f.write_str("my_")?; - ::fmt(region, f) - } else { - f.write_str("my") - } - } + Self::My(region) => language_display_helper(*region, f, "my".to_string()), // Byelorussian BE - Self::Be(region) => { - if *region != Region::Any { - f.write_str("be_")?; - ::fmt(region, f) - } else { - f.write_str("be") - } - } + Self::Be(region) => language_display_helper(*region, f, "be".to_string()), // Cambodian KM - Self::Km(region) => { - if *region != Region::Any { - f.write_str("km_")?; - ::fmt(region, f) - } else { - f.write_str("km") - } - } + Self::Km(region) => language_display_helper(*region, f, "km".to_string()), // Catalan CA - Self::Ca(region) => { - if *region != Region::Any { - f.write_str("ca_")?; - ::fmt(region, f) - } else { - f.write_str("ca") - } - } + Self::Ca(region) => language_display_helper(*region, f, "ca".to_string()), // Chinese ZH - Self::Zh(region) => { - if *region != Region::Any { - f.write_str("zh_")?; - ::fmt(region, f) - } else { - f.write_str("zh") - } - } + Self::Zh(region) => language_display_helper(*region, f, "zh".to_string()), // Corsican CO - Self::Co(region) => { - if *region != Region::Any { - f.write_str("co_")?; - ::fmt(region, f) - } else { - f.write_str("co") - } - } + Self::Co(region) => language_display_helper(*region, f, "co".to_string()), // Croatian HR - Self::Hr(region) => { - if *region != Region::Any { - f.write_str("hr_")?; - ::fmt(region, f) - } else { - f.write_str("hr") - } - } + Self::Hr(region) => language_display_helper(*region, f, "hr".to_string()), // Czech CS - Self::Cs(region) => { - if *region != Region::Any { - f.write_str("cs_")?; - ::fmt(region, f) - } else { - f.write_str("cs") - } - } + Self::Cs(region) => language_display_helper(*region, f, "cs".to_string()), // Danish DA - Self::Da(region) => { - if *region != Region::Any { - f.write_str("da_")?; - ::fmt(region, f) - } else { - f.write_str("da") - } - } + Self::Da(region) => language_display_helper(*region, f, "da".to_string()), // Dutch NL - Self::Nl(region) => { - if *region != Region::Any { - f.write_str("nl_")?; - ::fmt(region, f) - } else { - f.write_str("nl") - } - } + Self::Nl(region) => language_display_helper(*region, f, "nl".to_string()), // English, American EN - Self::En(region) => { - if *region != Region::Any { - f.write_str("en_")?; - ::fmt(region, f) - } else { - f.write_str("en") - } - } + Self::En(region) => language_display_helper(*region, f, "en".to_string()), // Esperanto EO - Self::Eo(region) => { - if *region != Region::Any { - f.write_str("eo_")?; - ::fmt(region, f) - } else { - f.write_str("eo") - } - } + Self::Eo(region) => language_display_helper(*region, f, "eo".to_string()), // Estonian ET - Self::Et(region) => { - if *region != Region::Any { - f.write_str("et_")?; - ::fmt(region, f) - } else { - f.write_str("et") - } - } + Self::Et(region) => language_display_helper(*region, f, "et".to_string()), // Faeroese FO - Self::Fo(region) => { - if *region != Region::Any { - f.write_str("fo_")?; - ::fmt(region, f) - } else { - f.write_str("fo") - } - } + Self::Fo(region) => language_display_helper(*region, f, "fo".to_string()), // Fiji FJ - Self::Fj(region) => { - if *region != Region::Any { - f.write_str("fj_")?; - ::fmt(region, f) - } else { - f.write_str("fj") - } - } + Self::Fj(region) => language_display_helper(*region, f, "fj".to_string()), // Finnish FI - Self::Fi(region) => { - if *region != Region::Any { - f.write_str("fi_")?; - ::fmt(region, f) - } else { - f.write_str("fi") - } - } + Self::Fi(region) => language_display_helper(*region, f, "fi".to_string()), // French FR - Self::Fr(region) => { - if *region != Region::Any { - f.write_str("fr_")?; - ::fmt(region, f) - } else { - f.write_str("fr") - } - } + Self::Fr(region) => language_display_helper(*region, f, "fr".to_string()), // Frisian FY - Self::Fy(region) => { - if *region != Region::Any { - f.write_str("fy_")?; - ::fmt(region, f) - } else { - f.write_str("fy") - } - } + Self::Fy(region) => language_display_helper(*region, f, "fy".to_string()), // Gaelic (Scots Gaelic) GD - Self::Gd(region) => { - if *region != Region::Any { - f.write_str("gd_")?; - ::fmt(region, f) - } else { - f.write_str("gd") - } - } + Self::Gd(region) => language_display_helper(*region, f, "gd".to_string()), // Galician GL - Self::Gl(region) => { - if *region != Region::Any { - f.write_str("gl_")?; - ::fmt(region, f) - } else { - f.write_str("gl") - } - } + Self::Gl(region) => language_display_helper(*region, f, "gl".to_string()), // Georgian KA - Self::Ka(region) => { - if *region != Region::Any { - f.write_str("ka_")?; - ::fmt(region, f) - } else { - f.write_str("ka") - } - } + Self::Ka(region) => language_display_helper(*region, f, "ka".to_string()), // German DE - Self::De(region) => { - if *region != Region::Any { - f.write_str("de_")?; - ::fmt(region, f) - } else { - f.write_str("de") - } - } + Self::De(region) => language_display_helper(*region, f, "de".to_string()), // Greek EL - Self::El(region) => { - if *region != Region::Any { - f.write_str("el_")?; - ::fmt(region, f) - } else { - f.write_str("el") - } - } + Self::El(region) => language_display_helper(*region, f, "el".to_string()), // Greenlandic KL - Self::Kl(region) => { - if *region != Region::Any { - f.write_str("kl_")?; - ::fmt(region, f) - } else { - f.write_str("kl") - } - } + Self::Kl(region) => language_display_helper(*region, f, "kl".to_string()), // Guarani GN - Self::Gn(region) => { - if *region != Region::Any { - f.write_str("gn_")?; - ::fmt(region, f) - } else { - f.write_str("gn") - } - } + Self::Gn(region) => language_display_helper(*region, f, "gn".to_string()), // Gujarati GU - Self::Gu(region) => { - if *region != Region::Any { - f.write_str("gu_")?; - ::fmt(region, f) - } else { - f.write_str("gu") - } - } + Self::Gu(region) => language_display_helper(*region, f, "gu".to_string()), // Hausa HA - Self::Ha(region) => { - if *region != Region::Any { - f.write_str("ha_")?; - ::fmt(region, f) - } else { - f.write_str("ha") - } - } + Self::Ha(region) => language_display_helper(*region, f, "ha".to_string()), // Hebrew IW - Self::Iw(region) => { - if *region != Region::Any { - f.write_str("iw_")?; - ::fmt(region, f) - } else { - f.write_str("iw") - } - } + Self::Iw(region) => language_display_helper(*region, f, "iw".to_string()), // Hindi HI - Self::Hi(region) => { - if *region != Region::Any { - f.write_str("hi_")?; - ::fmt(region, f) - } else { - f.write_str("hi") - } - } + Self::Hi(region) => language_display_helper(*region, f, "hi".to_string()), // Hungarian HU - Self::Hu(region) => { - if *region != Region::Any { - f.write_str("hu_")?; - ::fmt(region, f) - } else { - f.write_str("hu") - } - } + Self::Hu(region) => language_display_helper(*region, f, "hu".to_string()), // Icelandic IS - Self::Is(region) => { - if *region != Region::Any { - f.write_str("is_")?; - ::fmt(region, f) - } else { - f.write_str("is") - } - } + Self::Is(region) => language_display_helper(*region, f, "is".to_string()), // Indonesian IN - Self::In(region) => { - if *region != Region::Any { - f.write_str("in_")?; - ::fmt(region, f) - } else { - f.write_str("in") - } - } + Self::In(region) => language_display_helper(*region, f, "in".to_string()), // Interlingua IA - Self::Ia(region) => { - if *region != Region::Any { - f.write_str("ia_")?; - ::fmt(region, f) - } else { - f.write_str("ia") - } - } + Self::Ia(region) => language_display_helper(*region, f, "ia".to_string()), // Interlingue IE - Self::Ie(region) => { - if *region != Region::Any { - f.write_str("ie_")?; - ::fmt(region, f) - } else { - f.write_str("ie") - } - } + Self::Ie(region) => language_display_helper(*region, f, "ie".to_string()), // Inupiak IK - Self::Ik(region) => { - if *region != Region::Any { - f.write_str("ik_")?; - ::fmt(region, f) - } else { - f.write_str("ik") - } - } + Self::Ik(region) => language_display_helper(*region, f, "ik".to_string()), // Irish GA - Self::Ga(region) => { - if *region != Region::Any { - f.write_str("ga_")?; - ::fmt(region, f) - } else { - f.write_str("ga") - } - } + Self::Ga(region) => language_display_helper(*region, f, "ga".to_string()), // Italian IT - Self::It(region) => { - if *region != Region::Any { - f.write_str("it_")?; - ::fmt(region, f) - } else { - f.write_str("it") - } - } + Self::It(region) => language_display_helper(*region, f, "it".to_string()), // Japanese JA - Self::Ja(region) => { - if *region != Region::Any { - f.write_str("ja_")?; - ::fmt(region, f) - } else { - f.write_str("ja") - } - } + Self::Ja(region) => language_display_helper(*region, f, "ja".to_string()), // Javanese JW - Self::Jw(region) => { - if *region != Region::Any { - f.write_str("jw_")?; - ::fmt(region, f) - } else { - f.write_str("jw") - } - } + Self::Jw(region) => language_display_helper(*region, f, "jw".to_string()), // Kannada KN - Self::Kn(region) => { - if *region != Region::Any { - f.write_str("kn_")?; - ::fmt(region, f) - } else { - f.write_str("kn") - } - } + Self::Kn(region) => language_display_helper(*region, f, "kn".to_string()), // Kashmiri KS - Self::Ks(region) => { - if *region != Region::Any { - f.write_str("ks_")?; - ::fmt(region, f) - } else { - f.write_str("ks") - } - } + Self::Ks(region) => language_display_helper(*region, f, "ks".to_string()), // Kazakh KK - Self::Kk(region) => { - if *region != Region::Any { - f.write_str("kk_")?; - ::fmt(region, f) - } else { - f.write_str("kk") - } - } + Self::Kk(region) => language_display_helper(*region, f, "kk".to_string()), // Kinyarwanda RW - Self::Rw(region) => { - if *region != Region::Any { - f.write_str("rw_")?; - ::fmt(region, f) - } else { - f.write_str("rw") - } - } + Self::Rw(region) => language_display_helper(*region, f, "rw".to_string()), // Kirghiz KY - Self::Ky(region) => { - if *region != Region::Any { - f.write_str("ky_")?; - ::fmt(region, f) - } else { - f.write_str("ky") - } - } + Self::Ky(region) => language_display_helper(*region, f, "ky".to_string()), // Kirundi RN - Self::Rn(region) => { - if *region != Region::Any { - f.write_str("rn_")?; - ::fmt(region, f) - } else { - f.write_str("rn") - } - } + Self::Rn(region) => language_display_helper(*region, f, "rn".to_string()), // Korean KO - Self::Ko(region) => { - if *region != Region::Any { - f.write_str("ko_")?; - ::fmt(region, f) - } else { - f.write_str("ko") - } - } + Self::Ko(region) => language_display_helper(*region, f, "ko".to_string()), // Kurdish KU - Self::Ku(region) => { - if *region != Region::Any { - f.write_str("ku_")?; - ::fmt(region, f) - } else { - f.write_str("ku") - } - } + Self::Ku(region) => language_display_helper(*region, f, "ku".to_string()), // Laothian LO - Self::Lo(region) => { - if *region != Region::Any { - f.write_str("lo_")?; - ::fmt(region, f) - } else { - f.write_str("lo") - } - } + Self::Lo(region) => language_display_helper(*region, f, "lo".to_string()), // Latin LA - Self::La(region) => { - if *region != Region::Any { - f.write_str("la_")?; - ::fmt(region, f) - } else { - f.write_str("la") - } - } + Self::La(region) => language_display_helper(*region, f, "la".to_string()), // Latvian, Lettish LV - Self::Lv(region) => { - if *region != Region::Any { - f.write_str("lv_")?; - ::fmt(region, f) - } else { - f.write_str("lv") - } - } + Self::Lv(region) => language_display_helper(*region, f, "lv".to_string()), // Lingala LN - Self::Ln(region) => { - if *region != Region::Any { - f.write_str("ln_")?; - ::fmt(region, f) - } else { - f.write_str("ln") - } - } + Self::Ln(region) => language_display_helper(*region, f, "ln".to_string()), // Lithuanian LT - Self::Lt(region) => { - if *region != Region::Any { - f.write_str("lt_")?; - ::fmt(region, f) - } else { - f.write_str("lt") - } - } + Self::Lt(region) => language_display_helper(*region, f, "lt".to_string()), // Macedonian MK - Self::Mk(region) => { - if *region != Region::Any { - f.write_str("mk_")?; - ::fmt(region, f) - } else { - f.write_str("mk") - } - } + Self::Mk(region) => language_display_helper(*region, f, "mk".to_string()), // Malagasy MG - Self::Mg(region) => { - if *region != Region::Any { - f.write_str("mg_")?; - ::fmt(region, f) - } else { - f.write_str("mg") - } - } + Self::Mg(region) => language_display_helper(*region, f, "mg".to_string()), // Malay MS - Self::Ms(region) => { - if *region != Region::Any { - f.write_str("ms_")?; - ::fmt(region, f) - } else { - f.write_str("ms") - } - } - + Self::Ms(region) => language_display_helper(*region, f, "ms".to_string()), // Malayalam ML - Self::Ml(region) => { - if *region != Region::Any { - f.write_str("ml_")?; - ::fmt(region, f) - } else { - f.write_str("ml") - } - } + Self::Ml(region) => language_display_helper(*region, f, "ml".to_string()), // Maltese MT - Self::Mt(region) => { - if *region != Region::Any { - f.write_str("mt_")?; - ::fmt(region, f) - } else { - f.write_str("mt") - } - } + Self::Mt(region) => language_display_helper(*region, f, "mt".to_string()), // Maori MI - Self::Mi(region) => { - if *region != Region::Any { - f.write_str("mi_")?; - ::fmt(region, f) - } else { - f.write_str("mi") - } - } + Self::Mi(region) => language_display_helper(*region, f, "mi".to_string()), // Marathi MR - Self::Mr(region) => { - if *region != Region::Any { - f.write_str("mr_")?; - ::fmt(region, f) - } else { - f.write_str("mr") - } - } + Self::Mr(region) => language_display_helper(*region, f, "mr".to_string()), // Moldavian MO - Self::Mo(region) => { - if *region != Region::Any { - f.write_str("mo_")?; - ::fmt(region, f) - } else { - f.write_str("mo") - } - } + Self::Mo(region) => language_display_helper(*region, f, "mo".to_string()), // Mongolian MN - Self::Mn(region) => { - if *region != Region::Any { - f.write_str("mn_")?; - ::fmt(region, f) - } else { - f.write_str("mn") - } - } + Self::Mn(region) => language_display_helper(*region, f, "mn".to_string()), // Nauru NA - Self::Na(region) => { - if *region != Region::Any { - f.write_str("na_")?; - ::fmt(region, f) - } else { - f.write_str("na") - } - } + Self::Na(region) => language_display_helper(*region, f, "na".to_string()), // Nepali NE - Self::Ne(region) => { - if *region != Region::Any { - f.write_str("ne_")?; - ::fmt(region, f) - } else { - f.write_str("ne") - } - } + Self::Ne(region) => language_display_helper(*region, f, "ne".to_string()), // Norwegian NO - Self::No(region) => { - if *region != Region::Any { - f.write_str("no_")?; - ::fmt(region, f) - } else { - f.write_str("no") - } - } + Self::No(region) => language_display_helper(*region, f, "no".to_string()), // Occitan OC - Self::Oc(region) => { - if *region != Region::Any { - f.write_str("oc_")?; - ::fmt(region, f) - } else { - f.write_str("oc") - } - } + Self::Oc(region) => language_display_helper(*region, f, "oc".to_string()), // Oriya OR - Self::Or(region) => { - if *region != Region::Any { - f.write_str("or_")?; - ::fmt(region, f) - } else { - f.write_str("or") - } - } + Self::Or(region) => language_display_helper(*region, f, "or".to_string()), // Oromo, Afan OM - Self::Om(region) => { - if *region != Region::Any { - f.write_str("om_")?; - ::fmt(region, f) - } else { - f.write_str("om") - } - } + Self::Om(region) => language_display_helper(*region, f, "om".to_string()), // Pashto, Pushto PS - Self::Ps(region) => { - if *region != Region::Any { - f.write_str("ps_")?; - ::fmt(region, f) - } else { - f.write_str("ps") - } - } + Self::Ps(region) => language_display_helper(*region, f, "ps".to_string()), // Persian FA - Self::Fa(region) => { - if *region != Region::Any { - f.write_str("fa_")?; - ::fmt(region, f) - } else { - f.write_str("fa") - } - } + Self::Fa(region) => language_display_helper(*region, f, "fa".to_string()), // Polish PL - Self::Pl(region) => { - if *region != Region::Any { - f.write_str("pl_")?; - ::fmt(region, f) - } else { - f.write_str("pl") - } - } + Self::Pl(region) => language_display_helper(*region, f, "pl".to_string()), // Portuguese PT - Self::Pt(region) => { - if *region != Region::Any { - f.write_str("pt_")?; - ::fmt(region, f) - } else { - f.write_str("pt") - } - } + Self::Pt(region) => language_display_helper(*region, f, "pt".to_string()), // Punjabi PA - Self::Pa(region) => { - if *region != Region::Any { - f.write_str("pd_")?; - ::fmt(region, f) - } else { - f.write_str("pa") - } - } + Self::Pa(region) => language_display_helper(*region, f, "pa".to_string()), // Quechua QU - Self::Qu(region) => { - if *region != Region::Any { - f.write_str("qu_")?; - ::fmt(region, f) - } else { - f.write_str("qu") - } - } + Self::Qu(region) => language_display_helper(*region, f, "qu".to_string()), // Rhaeto-Romance RM - Self::Rm(region) => { - if *region != Region::Any { - f.write_str("rm_")?; - ::fmt(region, f) - } else { - f.write_str("rm") - } - } + Self::Rm(region) => language_display_helper(*region, f, "rm".to_string()), // Romanian RO - Self::Ro(region) => { - if *region != Region::Any { - f.write_str("ro_")?; - ::fmt(region, f) - } else { - f.write_str("ro") - } - } + Self::Ro(region) => language_display_helper(*region, f, "ro".to_string()), // Russian RU - Self::Ru(region) => { - if *region != Region::Any { - f.write_str("ru_")?; - ::fmt(region, f) - } else { - f.write_str("ru") - } - } + Self::Ru(region) => language_display_helper(*region, f, "ru".to_string()), // Samoan SM - Self::Sm(region) => { - if *region != Region::Any { - f.write_str("sm_")?; - ::fmt(region, f) - } else { - f.write_str("sm") - } - } + Self::Sm(region) => language_display_helper(*region, f, "sm".to_string()), // Sangro SG - Self::Sg(region) => { - if *region != Region::Any { - f.write_str("sg_")?; - ::fmt(region, f) - } else { - f.write_str("sg") - } - } + Self::Sg(region) => language_display_helper(*region, f, "sg".to_string()), // Sanskrit SA - Self::Sa(region) => { - if *region != Region::Any { - f.write_str("sa_")?; - ::fmt(region, f) - } else { - f.write_str("sa") - } - } + Self::Sa(region) => language_display_helper(*region, f, "sa".to_string()), // Serbian SR - Self::Sr(region) => { - if *region != Region::Any { - f.write_str("sr_")?; - ::fmt(region, f) - } else { - f.write_str("sr") - } - } + Self::Sr(region) => language_display_helper(*region, f, "sr".to_string()), // Serbo-Croatian SH - Self::Sh(region) => { - if *region != Region::Any { - f.write_str("sh_")?; - ::fmt(region, f) - } else { - f.write_str("sh") - } - } + Self::Sh(region) => language_display_helper(*region, f, "sh".to_string()), // Sesotho ST - Self::St(region) => { - if *region != Region::Any { - f.write_str("st_")?; - ::fmt(region, f) - } else { - f.write_str("st") - } - } + Self::St(region) => language_display_helper(*region, f, "st".to_string()), // Setswana TN - Self::Tn(region) => { - if *region != Region::Any { - f.write_str("tn_")?; - ::fmt(region, f) - } else { - f.write_str("tn") - } - } + Self::Tn(region) => language_display_helper(*region, f, "tn".to_string()), // Shona SN - Self::Sn(region) => { - if *region != Region::Any { - f.write_str("sn_")?; - ::fmt(region, f) - } else { - f.write_str("sn") - } - } + Self::Sn(region) => language_display_helper(*region, f, "sn".to_string()), // Sindhi SD - Self::Sd(region) => { - if *region != Region::Any { - f.write_str("sd_")?; - ::fmt(region, f) - } else { - f.write_str("sd") - } - } + Self::Sd(region) => language_display_helper(*region, f, "sd".to_string()), // Singhalese SI - Self::Si(region) => { - if *region != Region::Any { - f.write_str("si_")?; - ::fmt(region, f) - } else { - f.write_str("si") - } - } + Self::Si(region) => language_display_helper(*region, f, "si".to_string()), // Siswati SS - Self::Ss(region) => { - if *region != Region::Any { - f.write_str("ss_")?; - ::fmt(region, f) - } else { - f.write_str("ss") - } - } + Self::Ss(region) => language_display_helper(*region, f, "ss".to_string()), // Slovak SK - Self::Sk(region) => { - if *region != Region::Any { - f.write_str("sk_")?; - ::fmt(region, f) - } else { - f.write_str("sk") - } - } + Self::Sk(region) => language_display_helper(*region, f, "sk".to_string()), // Slovenian SL - Self::Sl(region) => { - if *region != Region::Any { - f.write_str("Sl_")?; - ::fmt(region, f) - } else { - f.write_str("Sl") - } - } + Self::Sl(region) => language_display_helper(*region, f, "sl".to_string()), // Somali SO - Self::So(region) => { - if *region != Region::Any { - f.write_str("so_")?; - ::fmt(region, f) - } else { - f.write_str("so") - } - } + Self::So(region) => language_display_helper(*region, f, "so".to_string()), // Spanish ES - Self::Es(region) => { - if *region != Region::Any { - f.write_str("es_")?; - ::fmt(region, f) - } else { - f.write_str("es") - } - } + Self::Es(region) => language_display_helper(*region, f, "es".to_string()), // Sudanese SU - Self::Su(region) => { - if *region != Region::Any { - f.write_str("su_")?; - ::fmt(region, f) - } else { - f.write_str("su") - } - } + Self::Su(region) => language_display_helper(*region, f, "su".to_string()), // Swahili SW - Self::Sw(region) => { - if *region != Region::Any { - f.write_str("sw_")?; - ::fmt(region, f) - } else { - f.write_str("sw") - } - } + Self::Sw(region) => language_display_helper(*region, f, "sw".to_string()), // Swedish SV - Self::Sv(region) => { - if *region != Region::Any { - f.write_str("sv_")?; - ::fmt(region, f) - } else { - f.write_str("sv") - } - } + Self::Sv(region) => language_display_helper(*region, f, "sv".to_string()), // Tagalog TL - Self::Tl(region) => { - if *region != Region::Any { - f.write_str("tl_")?; - ::fmt(region, f) - } else { - f.write_str("tl") - } - } + Self::Tl(region) => language_display_helper(*region, f, "tl".to_string()), // Tajik TG - Self::Tg(region) => { - if *region != Region::Any { - f.write_str("tg_")?; - ::fmt(region, f) - } else { - f.write_str("tg") - } - } + Self::Tg(region) => language_display_helper(*region, f, "tg".to_string()), // Tamil TA - Self::Ta(region) => { - if *region != Region::Any { - f.write_str("ta_")?; - ::fmt(region, f) - } else { - f.write_str("ta") - } - } + Self::Ta(region) => language_display_helper(*region, f, "ta".to_string()), // Tatar TT - Self::Tt(region) => { - if *region != Region::Any { - f.write_str("tt_")?; - ::fmt(region, f) - } else { - f.write_str("tt") - } - } + Self::Tt(region) => language_display_helper(*region, f, "tt".to_string()), // Tegulu TE - Self::Te(region) => { - if *region != Region::Any { - f.write_str("te_")?; - ::fmt(region, f) - } else { - f.write_str("te") - } - } + Self::Te(region) => language_display_helper(*region, f, "te".to_string()), // Thai TH - Self::Th(region) => { - if *region != Region::Any { - f.write_str("th_")?; - ::fmt(region, f) - } else { - f.write_str("th") - } - } + Self::Th(region) => language_display_helper(*region, f, "th".to_string()), // Tibetan BO - Self::Bo(region) => { - if *region != Region::Any { - f.write_str("bo_")?; - ::fmt(region, f) - } else { - f.write_str("bo") - } - } + Self::Bo(region) => language_display_helper(*region, f, "bo".to_string()), // Tigrinya TI - Self::Ti(region) => { - if *region != Region::Any { - f.write_str("ti_")?; - ::fmt(region, f) - } else { - f.write_str("ti") - } - } + Self::Ti(region) => language_display_helper(*region, f, "ti".to_string()), // Tonga TO - Self::To(region) => { - if *region != Region::Any { - f.write_str("to_")?; - ::fmt(region, f) - } else { - f.write_str("to") - } - } + Self::To(region) => language_display_helper(*region, f, "to".to_string()), // Tsonga TS - Self::Ts(region) => { - if *region != Region::Any { - f.write_str("ts_")?; - ::fmt(region, f) - } else { - f.write_str("ts") - } - } + Self::Ts(region) => language_display_helper(*region, f, "ts".to_string()), // Turkish TR - Self::Tr(region) => { - if *region != Region::Any { - f.write_str("tr_")?; - ::fmt(region, f) - } else { - f.write_str("tr") - } - } + Self::Tr(region) => language_display_helper(*region, f, "tr".to_string()), // Turkmen TK - Self::Tk(region) => { - if *region != Region::Any { - f.write_str("tk_")?; - ::fmt(region, f) - } else { - f.write_str("tk") - } - } + Self::Tk(region) => language_display_helper(*region, f, "tk".to_string()), // Twi TW - Self::Tw(region) => { - if *region != Region::Any { - f.write_str("tw_")?; - ::fmt(region, f) - } else { - f.write_str("tw") - } - } + Self::Tw(region) => language_display_helper(*region, f, "tw".to_string()), // Ukrainian UK - Self::Uk(region) => { - if *region != Region::Any { - f.write_str("uk_")?; - ::fmt(region, f) - } else { - f.write_str("uk") - } - } + Self::Uk(region) => language_display_helper(*region, f, "uk".to_string()), // Urdu UR - Self::Ur(region) => { - if *region != Region::Any { - f.write_str("ur_")?; - ::fmt(region, f) - } else { - f.write_str("ur") - } - } + Self::Ur(region) => language_display_helper(*region, f, "ur".to_string()), // Uzbek UZ - Self::Uz(region) => { - if *region != Region::Any { - f.write_str("uz_")?; - ::fmt(region, f) - } else { - f.write_str("uz") - } - } + Self::Uz(region) => language_display_helper(*region, f, "uz".to_string()), // Vietnamese VI - Self::Vi(region) => { - if *region != Region::Any { - f.write_str("vi_")?; - ::fmt(region, f) - } else { - f.write_str("vi") - } - } + Self::Vi(region) => language_display_helper(*region, f, "vi".to_string()), // Volapuk VO - Self::Vo(region) => { - if *region != Region::Any { - f.write_str("vo_")?; - ::fmt(region, f) - } else { - f.write_str("vo") - } - } + Self::Vo(region) => language_display_helper(*region, f, "vo".to_string()), // Welsh CY - Self::Cy(region) => { - if *region != Region::Any { - f.write_str("cy_")?; - ::fmt(region, f) - } else { - f.write_str("cy") - } - } + Self::Cy(region) => language_display_helper(*region, f, "cy".to_string()), // Wolof WO - Self::Wo(region) => { - if *region != Region::Any { - f.write_str("wo_")?; - ::fmt(region, f) - } else { - f.write_str("wo") - } - } + Self::Wo(region) => language_display_helper(*region, f, "wo".to_string()), // Xhosa XH - Self::Xh(region) => { - if *region != Region::Any { - f.write_str("xh_")?; - ::fmt(region, f) - } else { - f.write_str("xh") - } - } + Self::Xh(region) => language_display_helper(*region, f, "xh".to_string()), // Yiddish JI - Self::Ji(region) => { - if *region != Region::Any { - f.write_str("ji_")?; - ::fmt(region, f) - } else { - f.write_str("ji") - } - } + Self::Ji(region) => language_display_helper(*region, f, "ji".to_string()), // Yoruba YO - Self::Yo(region) => { - if *region != Region::Any { - f.write_str("yo_")?; - ::fmt(region, f) - } else { - f.write_str("yo") - } - } + Self::Yo(region) => language_display_helper(*region, f, "yo".to_string()), // Zulu ZU - Self::Zu(region) => { - if *region != Region::Any { - f.write_str("zu_")?; - ::fmt(region, f) - } else { - f.write_str("zu") - } - } + Self::Zu(region) => language_display_helper(*region, f, "zu".to_string()), } } } +/// the String represents the two letter encoding of the language +fn language_display_helper(region: Region, f: &mut Formatter<'_>, encoding: String) -> fmt::Result { + if region != Region::Any { + let mut display: String = encoding; + display.push('_'); + f.write_str(&display)?; + ::fmt(®ion, f) + } else { + let display: String = encoding; + f.write_str(&display) + } +} +