From b03ddb177cd1f5fd380c59e7a85db9282e4e9d6a Mon Sep 17 00:00:00 2001 From: Daniel Hilton Date: Wed, 13 Nov 2024 18:28:13 +0000 Subject: [PATCH 1/5] Adding ISO-639-1 language code support --- countries.go | 509 +++++++++++++++++++ languages.go | 1208 +++++++++++++++++++++++++++++++++++++++++++++ languagesconst.go | 387 +++++++++++++++ 3 files changed, 2104 insertions(+) create mode 100644 languages.go create mode 100644 languagesconst.go diff --git a/countries.go b/countries.go index 5fd63f7..7cf4a5f 100644 --- a/countries.go +++ b/countries.go @@ -4894,6 +4894,515 @@ func (c CountryCode) Region() RegionCode { //nolint:gocyclo return RegionUnknown } +// Language - return language code of country +func (c CountryCode) Language() LanguageCode { + switch c { + case AUS: + return LanguageEN + case AUT: + return LanguageDE + case AZE: + return LanguageAZ + case ALB: + return LanguageSQ + case DZA: + return LanguageAR + case ASM: + return LanguageSM + case AIA: + return LanguageEN + case AGO: + return LanguagePT + case AND: + return LanguageCA + case ATA: + return LanguageEN + case ATG: + return LanguageEN + case ARE: + return LanguageAR + case ARG: + return LanguageES + case ARM: + return LanguageHY + case ABW: + return LanguageNL + case AFG: + return LanguageFA + case BHS: + return LanguageEN + case BGD: + return LanguageBN + case BRB: + return LanguageEN + case BHR: + return LanguageAR + case BLR: + return LanguageBE + case BLZ: + return LanguageEN + case BEL: + return LanguageNL + case BEN: + return LanguageFR + case BMU: + return LanguageEN + case BGR: + return LanguageBG + case BOL: + return LanguageES + case BIH: + return LanguageBS + case BWA: + return LanguageEN + case BRA: + return LanguagePT + case IOT: + return LanguageEN + case BRN: + return LanguageMS + case BFA: + return LanguageFR + case BDI: + return LanguageFR + case BTN: + return LanguageDZ + case VUT: + return LanguageBI + case VAT: + return LanguageIT + case GBR: + return LanguageEN + case HUN: + return LanguageHU + case VEN: + return LanguageES + case VGB: + return LanguageEN + case VIR: + return LanguageEN + case TLS: + return LanguagePT + case VNM: + return LanguageVI + case GAB: + return LanguageFR + case HTI: + return LanguageHT + case GUY: + return LanguageEN + case GMB: + return LanguageEN + case GHA: + return LanguageEN + case GLP: + return LanguageFR + case GTM: + return LanguageES + case GIN: + return LanguageFR + case GNB: + return LanguagePT + case DEU: + return LanguageDE + case GIB: + return LanguageEN + case HND: + return LanguageES + case HKG: + return LanguageZH + case GRD: + return LanguageEN + case GRL: + return LanguageKL + case GRC: + return LanguageEL + case GEO: + return LanguageKA + case GUM: + return LanguageEN + case DNK: + return LanguageDA + case COD: + return LanguageFR + case DJI: + return LanguageFR + case DMA: + return LanguageEN + case DOM: + return LanguageES + case EGY: + return LanguageAR + case ZMB: + return LanguageEN + case ESH: + return LanguageAR + case ZWE: + return LanguageEN + case ISR: + return LanguageHE + case IND: + return LanguageHI + case IDN: + return LanguageID + case JOR: + return LanguageAR + case IRQ: + return LanguageAR + case IRN: + return LanguageFA + case IRL: + return LanguageEN + case ISL: + return LanguageIS + case ESP: + return LanguageES + case ITA: + return LanguageIT + case YEM: + return LanguageAR + case KAZ: + return LanguageKK + case CYM: + return LanguageEN + case KHM: + return LanguageKM + case CMR: + return LanguageFR + case CAN: + return LanguageEN + case QAT: + return LanguageAR + case KEN: + return LanguageEN + case CYP: + return LanguageEL + case KIR: + return LanguageEN + case CHN: + return LanguageZH + case CCK: + return LanguageEN + case COL: + return LanguageES + case COM: + return LanguageFR + case COG: + return LanguageFR + case PRK: + return LanguageKO + case KOR: + return LanguageKO + case CRI: + return LanguageES + case CIV: + return LanguageFR + case CUB: + return LanguageES + case KWT: + return LanguageAR + case KGZ: + return LanguageKY + case LAO: + return LanguageLO + case LVA: + return LanguageLV + case LSO: + return LanguageEN + case LBR: + return LanguageEN + case LBN: + return LanguageAR + case LBY: + return LanguageAR + case LTU: + return LanguageLT + case LIE: + return LanguageDE + case LUX: + return LanguageLU + case MUS: + return LanguageEN + case MRT: + return LanguageAR + case MDG: + return LanguageFR + case MYT: + return LanguageFR + case MAC: + return LanguageZH + case MKD: + return LanguageMK + case MWI: + return LanguageEN + case MYS: + return LanguageMS + case MLI: + return LanguageFR + case MDV: + return LanguageDV + case MLT: + return LanguageMT + case MNP: + return LanguageEN + case MAR: + return LanguageAR + case MTQ: + return LanguageFR + case MHL: + return LanguageEN + case MEX: + return LanguageES + case FSM: + return LanguageEN + case MOZ: + return LanguagePT + case MDA: + return LanguageRO + case MCO: + return LanguageFR + case MNG: + return LanguageMN + case MSR: + return LanguageEN + case MMR: + return LanguageMY + case NAM: + return LanguageEN + case NRU: + return LanguageEN + case NPL: + return LanguageNE + case NER: + return LanguageFR + case NGA: + return LanguageEN + case NLD: + return LanguageNL + case NIC: + return LanguageES + case NIU: + return LanguageEN + case NZL: + return LanguageEN + case NCL: + return LanguageFR + case NOR: + return LanguageNO + case OMN: + return LanguageAR + case BVT: + return LanguageNO + case IMN: + return LanguageEN + case NFK: + return LanguageEN + case PCN: + return LanguageEN + case CXR: + return LanguageEN + case SHN: + return LanguageEN + case WLF: + return LanguageFR + case HMD: + return LanguageEN + case CPV: + return LanguagePT + case COK: + return LanguageEN + case WSM: + return LanguageSM + case SJM: + return LanguageNO + case TCA: + return LanguageEN + case UMI: + return LanguageEN + case PAK: + return LanguageUR + case PLW: + return LanguageEN + case PSE: + return LanguageAR + case PAN: + return LanguageES + case PNG: + return LanguageEN + case PRY: + return LanguageES + case PER: + return LanguageES + case POL: + return LanguagePL + case PRT: + return LanguagePT + case PRI: + return LanguageES + case REU: + return LanguageFR + case RUS: + return LanguageRU + case RWA: + return LanguageRW + case ROU: + return LanguageRO + case SLV: + return LanguageES + case SMR: + return LanguageIT + case STP: + return LanguagePT + case SAU: + return LanguageAR + case SWZ: + return LanguageEN + case SYC: + return LanguageFR + case SEN: + return LanguageFR + case SPM: + return LanguageFR + case VCT: + return LanguageEN + case KNA: + return LanguageEN + case LCA: + return LanguageEN + case SGP: + return LanguageEN + case SYR: + return LanguageAR + case SVK: + return LanguageSK + case SVN: + return LanguageSL + case USA: + return LanguageEN + case SLB: + return LanguageEN + case SOM: + return LanguageSO + case SDN: + return LanguageAR + case SUR: + return LanguageNL + case SLE: + return LanguageEN + case TJK: + return LanguageTG + case TWN: + return LanguageZH + case THA: + return LanguageTH + case TZA: + return LanguageSW + case TGO: + return LanguageFR + case TKL: + return LanguageEN + case TON: + return LanguageTO + case TTO: + return LanguageEN + case TUV: + return LanguageEN + case TUN: + return LanguageAR + case TKM: + return LanguageTK + case TUR: + return LanguageTR + case UGA: + return LanguageEN + case UZB: + return LanguageUZ + case UKR: + return LanguageUK + case URY: + return LanguageES + case FRO: + return LanguageFO + case FJI: + return LanguageEN + case PHL: + return LanguageTL + case FIN: + return LanguageFI + case FLK: + return LanguageEN + case FRA: + return LanguageFR + case GUF: + return LanguageFR + case PYF: + return LanguageFR + case ATF: + return LanguageFR + case HRV: + return LanguageHR + case CAF: + return LanguageFR + case TCD: + return LanguageFR + case CZE: + return LanguageCS + case CHL: + return LanguageES + case CHE: + return LanguageDE + case SWE: + return LanguageSV + case LKA: + return LanguageSI + case ECU: + return LanguageES + case GNQ: + return LanguageES + case ERI: + return LanguageTI + case EST: + return LanguageET + case ETH: + return LanguageAM + case ZAF: + return LanguageAF + case YUG: + return LanguageSR + case SGS: + return LanguageEN + case JAM: + return LanguageEN + case MNE: + return LanguageSR + case BLM: + return LanguageFR + case SXM: + return LanguageNL + case SRB: + return LanguageSR + case ALA: + return LanguageSV + case BES: + return LanguageNL + case GGY: + return LanguageEN + case JEY: + return LanguageEN + case CUW: + return LanguageNL + case MAF: + return LanguageFR + case SSD: + return LanguageEN + case XKX: + return LanguageSQ + case JPN: + return LanguageJA + } + return LanguageUnknown +} + // Capital - return a capital of country // //nolint:gocyclo diff --git a/languages.go b/languages.go new file mode 100644 index 0000000..d6eab97 --- /dev/null +++ b/languages.go @@ -0,0 +1,1208 @@ +package countries + +import ( + "encoding/json" + "fmt" +) + +type LanguageCode string // string for database/sql/driver.Valuer compatibility + +type Language struct { + Name string + Code LanguageCode +} + +func (_ LanguageCode) Type() string { + return TypeLanguageCode +} + +func (c LanguageCode) String() string { + switch c { + case LanguageAA: + return "Afar" + case LanguageAB: + return "Abkhazian" + case LanguageAE: + return "Avestan" + case LanguageAF: + return "Afrikaans" + case LanguageAK: + return "Akan" + case LanguageAM: + return "Amharic" + case LanguageAN: + return "Aragonese" + case LanguageAR: + return "Arabic" + case LanguageAS: + return "Assamese" + case LanguageAV: + return "Avaric" + case LanguageAY: + return "Aymara" + case LanguageAZ: + return "Azerbaijani" + case LanguageBA: + return "Bashkir" + case LanguageBE: + return "Belarusian" + case LanguageBG: + return "Bulgarian" + case LanguageBH: + return "Bihari" + case LanguageBI: + return "Bislama" + case LanguageBM: + return "Bambara" + case LanguageBN: + return "Bengali" + case LanguageBO: + return "Tibetan" + case LanguageBR: + return "Breton" + case LanguageBS: + return "Bosnian" + case LanguageCA: + return "Catalan" + case LanguageCE: + return "Chechen" + case LanguageCH: + return "Chamorro" + case LanguageCO: + return "Corsican" + case LanguageCR: + return "Cree" + case LanguageCS: + return "Czech" + case LanguageCU: + return "Old Church Slavonic" + case LanguageCV: + return "Chuvash" + case LanguageCY: + return "Welsh" + case LanguageDA: + return "Danish" + case LanguageDE: + return "German" + case LanguageDV: + return "Divehi" + case LanguageDZ: + return "Dzongkha" + case LanguageEE: + return "Ewe" + case LanguageEL: + return "Greek" + case LanguageEN: + return "English" + case LanguageEO: + return "Esperanto" + case LanguageES: + return "Spanish" + case LanguageET: + return "Estonian" + case LanguageEU: + return "Basque" + case LanguageFA: + return "Persian" + case LanguageFF: + return "Fulah" + case LanguageFI: + return "Finnish" + case LanguageFJ: + return "Fijian" + case LanguageFO: + return "Faroese" + case LanguageFR: + return "French" + case LanguageFY: + return "Western Frisian" + case LanguageGA: + return "Irish" + case LanguageGD: + return "Scottish Gaelic" + case LanguageGL: + return "Galician" + case LanguageGN: + return "Guarani" + case LanguageGU: + return "Gujarati" + case LanguageGV: + return "Manx" + case LanguageHA: + return "Hausa" + case LanguageHE: + return "Hebrew" + case LanguageHI: + return "Hindi" + case LanguageHO: + return "Hiri Motu" + case LanguageHR: + return "Croatian" + case LanguageHT: + return "Haitian" + case LanguageHU: + return "Hungarian" + case LanguageHY: + return "Armenian" + case LanguageHZ: + return "Herero" + case LanguageIA: + return "Interlingua" + case LanguageID: + return "Indonesian" + case LanguageIE: + return "Interlingue" + case LanguageIG: + return "Igbo" + case LanguageII: + return "Sichuan Yi" + case LanguageIK: + return "Inupiaq" + case LanguageIO: + return "Ido" + case LanguageIS: + return "Icelandic" + case LanguageIT: + return "Italian" + case LanguageIU: + return "Inuktitut" + case LanguageJA: + return "Japanese" + case LanguageJV: + return "Javanese" + case LanguageKA: + return "Georgian" + case LanguageKG: + return "Kongo" + case LanguageKI: + return "Kikuyu" + case LanguageKJ: + return "Kwanyama" + case LanguageKK: + return "Kazakh" + case LanguageKL: + return "Kalaallisut" + case LanguageKM: + return "Khmer" + case LanguageKN: + return "Kannada" + case LanguageKO: + return "Korean" + case LanguageKR: + return "Kanuri" + case LanguageKS: + return "Kashmiri" + case LanguageKU: + return "Kurdish" + case LanguageKV: + return "Komi" + case LanguageKW: + return "Cornish" + case LanguageKY: + return "Kyrgyz" + case LanguageLA: + return "Latin" + case LanguageLB: + return "Luxembourgish" + case LanguageLG: + return "Ganda" + case LanguageLI: + return "Limburgish" + case LanguageLN: + return "Lingala" + case LanguageLO: + return "Lao" + case LanguageLT: + return "Lithuanian" + case LanguageLU: + return "Luba-Katanga" + case LanguageLV: + return "Latvian" + case LanguageMG: + return "Malagasy" + case LanguageMH: + return "Marshallese" + case LanguageMI: + return "Maori" + case LanguageMK: + return "Macedonian" + case LanguageML: + return "Malayalam" + case LanguageMN: + return "Mongolian" + case LanguageMR: + return "Marathi" + case LanguageMS: + return "Malay" + case LanguageMT: + return "Maltese" + case LanguageMY: + return "Burmese" + case LanguageNA: + return "Nauru" + case LanguageNB: + return "Norwegian Bokmål" + case LanguageND: + return "North Ndebele" + case LanguageNE: + return "Nepali" + case LanguageNG: + return "Ndonga" + case LanguageNL: + return "Dutch" + case LanguageNN: + return "Norwegian Nynorsk" + case LanguageNO: + return "Norwegian" + case LanguageNS: + return "Northern Sotho" + case LanguageNV: + return "Navajo" + case LanguageNY: + return "Chichewa" + case LanguageOC: + return "Occitan" + case LanguageOJ: + return "Ojibwa" + case LanguageOM: + return "Oromo" + case LanguageOR: + return "Oriya" + case LanguageOS: + return "Ossetian" + case LanguagePA: + return "Panjabi" + case LanguagePI: + return "Pali" + case LanguagePL: + return "Polish" + case LanguagePS: + return "Pashto" + case LanguagePT: + return "Portuguese" + case LanguageQU: + return "Quechua" + case LanguageRM: + return "Romansh" + case LanguageRN: + return "Rundi" + case LanguageRO: + return "Romanian" + case LanguageRU: + return "Russian" + case LanguageRW: + return "Kinyarwanda" + case LanguageSA: + return "Sanskrit" + case LanguageSC: + return "Sardinian" + case LanguageSD: + return "Sindhi" + case LanguageSE: + return "Northern Sami" + case LanguageSG: + return "Sango" + case LanguageSI: + return "Sinhala" + case LanguageSK: + return "Slovak" + case LanguageSL: + return "Slovene" + case LanguageSM: + return "Samoan" + case LanguageSN: + return "Shona" + case LanguageSO: + return "Somali" + case LanguageSQ: + return "Albanian" + case LanguageSR: + return "Serbian" + case LanguageSS: + return "Swati" + case LanguageST: + return "Southern Sotho" + case LanguageSU: + return "Sundanese" + case LanguageSV: + return "Swedish" + case LanguageSW: + return "Swahili" + case LanguageTA: + return "Tamil" + case LanguageTE: + return "Telugu" + case LanguageTG: + return "Tajik" + case LanguageTH: + return "Thai" + case LanguageTI: + return "Tigrinya" + case LanguageTK: + return "Turkmen" + case LanguageTL: + return "Tagalog" + case LanguageTN: + return "Tswana" + case LanguageTO: + return "Tonga" + case LanguageTR: + return "Turkish" + case LanguageTS: + return "Tsonga" + case LanguageTT: + return "Tatar" + case LanguageTW: + return "Twi" + case LanguageTY: + return "Tahitian" + case LanguageUG: + return "Uighur" + case LanguageUK: + return "Ukrainian" + case LanguageUR: + return "Urdu" + case LanguageUZ: + return "Uzbek" + case LanguageVE: + return "Venda" + case LanguageVI: + return "Vietnamese" + case LanguageVO: + return "Volapük" + case LanguageWA: + return "Walloon" + case LanguageWO: + return "Wolof" + case LanguageXH: + return "Xhosa" + case LanguageYI: + return "Yiddish" + case LanguageYO: + return "Yoruba" + case LanguageZA: + return "Zhuang" + case LanguageZH: + return "Chinese" + case LanguageZU: + return "Zulu" + default: + return UnknownLanguageCode + } +} + +func (c LanguageCode) StringRus() string { + switch c { + case LanguageAA: + return "Афар" + case LanguageAB: + return "Абхазский" + case LanguageAE: + return "Авестийский" + case LanguageAF: + return "Африкаанс" + case LanguageAK: + return "Акан" + case LanguageAM: + return "Амхарский" + case LanguageAN: + return "Арагонский" + case LanguageAR: + return "Арабский" + case LanguageAS: + return "Ассамский" + case LanguageAV: + return "Аварский" + case LanguageAY: + return "Аймара" + case LanguageAZ: + return "Азербайджанский" + case LanguageBA: + return "Башкирский" + case LanguageBE: + return "Белорусский" + case LanguageBG: + return "Болгарский" + case LanguageBH: + return "Бихари" + case LanguageBI: + return "Бислама" + case LanguageBM: + return "Бамбара" + case LanguageBN: + return "Бенгальский" + case LanguageBO: + return "Тибетский" + case LanguageBR: + return "Бретонский" + case LanguageBS: + return "Боснийский" + case LanguageCA: + return "Каталанский" + case LanguageCE: + return "Чеченский" + case LanguageCH: + return "Чаморро" + case LanguageCO: + return "Корсиканский" + case LanguageCR: + return "Кри" + case LanguageCS: + return "Чешский" + case LanguageCU: + return "Церковнославянский" + case LanguageCV: + return "Чувашский" + case LanguageCY: + return "Валлийский" + case LanguageDA: + return "Датский" + case LanguageDE: + return "Немецкий" + case LanguageDV: + return "Дивехи" + case LanguageDZ: + return "Дзонг-кэ" + case LanguageEE: + return "Эве" + case LanguageEL: + return "Греческий" + case LanguageEN: + return "Английский" + case LanguageEO: + return "Эсперанто" + case LanguageES: + return "Испанский" + case LanguageET: + return "Эстонский" + case LanguageEU: + return "Баскский" + case LanguageFA: + return "Персидский" + case LanguageFF: + return "Фула" + case LanguageFI: + return "Финский" + case LanguageFJ: + return "Фиджи" + case LanguageFO: + return "Фарерский" + case LanguageFR: + return "Французский" + case LanguageFY: + return "Западнофризский" + case LanguageGA: + return "Ирландский" + case LanguageGD: + return "Шотландский гэльский" + case LanguageGL: + return "Галисийский" + case LanguageGN: + return "Гуарани" + case LanguageGU: + return "Гуджарати" + case LanguageGV: + return "Мэнский" + case LanguageHA: + return "Хауса" + case LanguageHE: + return "Иврит" + case LanguageHI: + return "Хинди" + case LanguageHO: + return "Хири-моту" + case LanguageHR: + return "Хорватский" + case LanguageHT: + return "Гаитянский" + case LanguageHU: + return "Венгерский" + case LanguageHY: + return "Армянский" + case LanguageHZ: + return "Гереро" + case LanguageIA: + return "Интерлингва" + case LanguageID: + return "Индонезийский" + case LanguageIE: + return "Интерлингве" + case LanguageIG: + return "Игбо" + case LanguageII: + return "Сычуань И" + case LanguageIK: + return "Инупиак" + case LanguageIO: + return "Идо" + case LanguageIS: + return "Исландский" + case LanguageIT: + return "Итальянский" + case LanguageIU: + return "Инуктитут" + case LanguageJA: + return "Японский" + case LanguageJV: + return "Яванский" + case LanguageKA: + return "Грузинский" + case LanguageKG: + return "Конго" + case LanguageKI: + return "Кикуйю" + case LanguageKJ: + return "Кваньяма" + case LanguageKK: + return "Казахский" + case LanguageKL: + return "Гренландский" + case LanguageKM: + return "Кхмерский" + case LanguageKN: + return "Каннада" + case LanguageKO: + return "Корейский" + case LanguageKR: + return "Канури" + case LanguageKS: + return "Кашмири" + case LanguageKU: + return "Курдский" + case LanguageKV: + return "Коми" + case LanguageKW: + return "Корнский" + case LanguageKY: + return "Киргизский" + case LanguageLA: + return "Латинский" + case LanguageLB: + return "Люксембургский" + case LanguageLG: + return "Ганда" + case LanguageLI: + return "Лимбургский" + case LanguageLN: + return "Лингала" + case LanguageLO: + return "Лаосский" + case LanguageLT: + return "Литовский" + case LanguageLU: + return "Луба-катанга" + case LanguageLV: + return "Латышский" + case LanguageMG: + return "Малагасийский" + case LanguageMH: + return "Маршалльский" + case LanguageMI: + return "Маори" + case LanguageMK: + return "Македонский" + case LanguageML: + return "Малаялам" + case LanguageMN: + return "Монгольский" + case LanguageMR: + return "Маратхи" + case LanguageMS: + return "Малайский" + case LanguageMT: + return "Мальтийский" + case LanguageMY: + return "Бирманский" + case LanguageNA: + return "Науру" + case LanguageNB: + return "Норвежский букмол" + case LanguageND: + return "Северный ндебеле" + case LanguageNE: + return "Непальский" + case LanguageNG: + return "Ндонга" + case LanguageNL: + return "Голландский" + case LanguageNN: + return "Норвежский нюнорск" + case LanguageNO: + return "Норвежский" + case LanguageNS: + return "Северный сото" + case LanguageNV: + return "Навахо" + case LanguageNY: + return "Чичева" + case LanguageOC: + return "Окситанский" + case LanguageOJ: + return "Оджибве" + case LanguageOM: + return "Оромо" + case LanguageOR: + return "Ория" + case LanguageOS: + return "Осетинский" + case LanguagePA: + return "Панджаби" + case LanguagePI: + return "Пали" + case LanguagePL: + return "Польский" + case LanguagePS: + return "Пушту" + case LanguagePT: + return "Португальский" + case LanguageQU: + return "Кечуа" + case LanguageRM: + return "Ретороманский" + case LanguageRN: + return "Рунди" + case LanguageRO: + return "Румынский" + case LanguageRU: + return "Русский" + case LanguageRW: + return "Киньяруанда" + case LanguageSA: + return "Санскрит" + case LanguageSC: + return "Сардинский" + case LanguageSD: + return "Синдхи" + case LanguageSE: + return "Северносаамский" + case LanguageSG: + return "Санго" + case LanguageSI: + return "Сингальский" + case LanguageSK: + return "Словацкий" + case LanguageSL: + return "Словенский" + case LanguageSM: + return "Самоанский" + case LanguageSN: + return "Шона" + case LanguageSO: + return "Сомалийский" + case LanguageSQ: + return "Албанский" + case LanguageSR: + return "Сербский" + case LanguageSS: + return "Свази" + case LanguageST: + return "Сесото" + case LanguageSU: + return "Сунданский" + case LanguageSV: + return "Шведский" + case LanguageSW: + return "Суахили" + case LanguageTA: + return "Тамильский" + case LanguageTE: + return "Телугу" + case LanguageTG: + return "Таджикский" + case LanguageTH: + return "Тайский" + case LanguageTI: + return "Тигринья" + case LanguageTK: + return "Туркменский" + case LanguageTL: + return "Тагальский" + case LanguageTN: + return "Тсвана" + case LanguageTO: + return "Тонганский" + case LanguageTR: + return "Турецкий" + case LanguageTS: + return "Тсонга" + case LanguageTT: + return "Татарский" + case LanguageTW: + return "Тви" + case LanguageTY: + return "Таитянский" + case LanguageUG: + return "Уйгурский" + case LanguageUK: + return "Украинский" + case LanguageUR: + return "Урду" + case LanguageUZ: + return "Узбекский" + case LanguageVE: + return "Венда" + case LanguageVI: + return "Вьетнамский" + case LanguageVO: + return "Волапюк" + case LanguageWA: + return "Валлонский" + case LanguageWO: + return "Волоф" + case LanguageXH: + return "Коса" + case LanguageYI: + return "Идиш" + case LanguageYO: + return "Йоруба" + case LanguageZA: + return "Чжуанский" + case LanguageZH: + return "Китайский" + case LanguageZU: + return "Зулу" + default: + return "Неизвестный" + } +} + +func (c LanguageCode) IsValid() bool { + return c.String() != UnknownLanguageCode +} + +func TotalLanguages() int { + return 183 +} + +func (c LanguageCode) Info() *Language { + return &Language{ + Name: c.String(), + Code: c, + } +} + +func (_ *Language) Type() string { + return TypeLanguage +} + +func (r Language) Value() (Value, error) { + return json.Marshal(r) +} + +func (r *Language) Scan(src interface{}) error { + if r == nil { + return fmt.Errorf("countries::Scan: Language scan err: language == nil") + } + switch src := src.(type) { + case *Language: + *r = *src + case Language: + *r = src + } + return nil +} + +func AllLanguages() []LanguageCode { + return []LanguageCode{ + LanguageAA, LanguageAB, LanguageAE, LanguageAF, LanguageAK, LanguageAM, LanguageAN, LanguageAR, LanguageAS, LanguageAV, LanguageAY, LanguageAZ, + LanguageBA, LanguageBE, LanguageBG, LanguageBH, LanguageBI, LanguageBM, LanguageBN, LanguageBO, LanguageBR, LanguageBS, LanguageCA, LanguageCE, + LanguageCH, LanguageCO, LanguageCR, LanguageCS, LanguageCU, LanguageCV, LanguageCY, LanguageDA, LanguageDE, LanguageDV, LanguageDZ, LanguageEE, + LanguageEL, LanguageEN, LanguageEO, LanguageES, LanguageET, LanguageEU, LanguageFA, LanguageFF, LanguageFI, LanguageFJ, LanguageFO, LanguageFR, + LanguageFY, LanguageGA, LanguageGD, LanguageGL, LanguageGN, LanguageGU, LanguageGV, LanguageHA, LanguageHE, LanguageHI, LanguageHO, LanguageHR, + LanguageHT, LanguageHU, LanguageHY, LanguageHZ, LanguageIA, LanguageID, LanguageIE, LanguageIG, LanguageII, LanguageIK, LanguageIO, LanguageIS, + LanguageIT, LanguageIU, LanguageJA, LanguageJV, LanguageKA, LanguageKG, LanguageKI, LanguageKJ, LanguageKK, LanguageKL, LanguageKM, LanguageKN, + LanguageKO, LanguageKR, LanguageKS, LanguageKU, LanguageKV, LanguageKW, LanguageKY, LanguageLA, LanguageLB, LanguageLG, LanguageLI, LanguageLN, + LanguageLO, LanguageLT, LanguageLU, LanguageLV, LanguageMG, LanguageMH, LanguageMI, LanguageMK, LanguageML, LanguageMN, LanguageMR, LanguageMS, + LanguageMT, LanguageMY, LanguageNA, LanguageNB, LanguageND, LanguageNE, LanguageNG, LanguageNL, LanguageNN, LanguageNO, LanguageNS, LanguageNV, + LanguageNY, LanguageOC, LanguageOJ, LanguageOM, LanguageOR, LanguageOS, LanguagePA, LanguagePI, LanguagePL, LanguagePS, LanguagePT, LanguageQU, + LanguageRM, LanguageRN, LanguageRO, LanguageRU, LanguageRW, LanguageSA, LanguageSC, LanguageSD, LanguageSE, LanguageSG, LanguageSI, LanguageSK, + LanguageSL, LanguageSM, LanguageSN, LanguageSO, LanguageSQ, LanguageSR, LanguageSS, LanguageST, LanguageSU, LanguageSV, LanguageSW, LanguageTA, + LanguageTE, LanguageTG, LanguageTH, LanguageTI, LanguageTK, LanguageTL, LanguageTN, LanguageTO, LanguageTR, LanguageTS, LanguageTT, LanguageTW, + LanguageTY, LanguageUG, LanguageUK, LanguageUR, LanguageUZ, LanguageVE, LanguageVI, LanguageVO, LanguageWA, LanguageWO, LanguageXH, LanguageYI, + LanguageYO, LanguageZA, LanguageZH, LanguageZU, + } +} + +func AllLanguagesInfo() []*Language { + all := AllLanguages() + languages := make([]*Language, 0, len(all)) + for _, v := range all { + languages = append(languages, v.Info()) + } + return languages +} + +func LanguageCodeByName(name string) LanguageCode { + switch textPrepare(name) { + case "AA", "AFAR": + return LanguageAA + case "AB", "ABKHAZIAN": + return LanguageAB + case "AE", "AVESTAN": + return LanguageAE + case "AF", "AFRIKAANS": + return LanguageAF + case "AK", "AKAN": + return LanguageAK + case "AM", "AMHARIC": + return LanguageAM + case "AN", "ARAGONESE": + return LanguageAN + case "AR", "ARABIC": + return LanguageAR + case "AS", "ASSAMESE": + return LanguageAS + case "AV", "AVARIC": + return LanguageAV + case "AY", "AYMARA": + return LanguageAY + case "AZ", "AZERBAIJANI": + return LanguageAZ + case "BA", "BASHKIR": + return LanguageBA + case "BE", "BELARUSIAN": + return LanguageBE + case "BG", "BULGARIAN": + return LanguageBG + case "BH", "BIHARI": + return LanguageBH + case "BI", "BISLAMA": + return LanguageBI + case "BM", "BAMBARA": + return LanguageBM + case "BN", "BENGALI": + return LanguageBN + case "BO", "TIBETAN": + return LanguageBO + case "BR", "BRETON": + return LanguageBR + case "BS", "BOSNIAN": + return LanguageBS + case "CA", "CATALAN": + return LanguageCA + case "CE", "CHECHEN": + return LanguageCE + case "CH", "CHAMORRO": + return LanguageCH + case "CO", "CORSICAN": + return LanguageCO + case "CR", "CREE": + return LanguageCR + case "CS", "CZECH": + return LanguageCS + case "CU", "OLDCHURCHSLAVONIC", "CHURCHSLAVONIC", "CHURCHSLAVIC": + return LanguageCU + case "CV", "CHUVASH": + return LanguageCV + case "CY", "WELSH": + return LanguageCY + case "DA", "DANISH": + return LanguageDA + case "DE", "GERMAN": + return LanguageDE + case "DV", "DIVEHI": + return LanguageDV + case "DZ", "DZONGKHA": + return LanguageDZ + case "EE", "EWE": + return LanguageEE + case "EL", "GREEK": + return LanguageEL + case "EN", "ENGLISH": + return LanguageEN + case "EO", "ESPERANTO": + return LanguageEO + case "ES", "SPANISH": + return LanguageES + case "ET", "ESTONIAN": + return LanguageET + case "EU", "BASQUE": + return LanguageEU + case "FA", "PERSIAN": + return LanguageFA + case "FF", "FULAH": + return LanguageFF + case "FI", "FINNISH": + return LanguageFI + case "FJ", "FIJIAN": + return LanguageFJ + case "FO", "FAROESE": + return LanguageFO + case "FR", "FRENCH": + return LanguageFR + case "FY", "WESTERNFRISIAN": + return LanguageFY + case "GA", "IRISH": + return LanguageGA + case "GD", "SCOTTISHGAELIC": + return LanguageGD + case "GL", "GALICIAN": + return LanguageGL + case "GN", "GUARANI": + return LanguageGN + case "GU", "GUJARATI": + return LanguageGU + case "GV", "MANX": + return LanguageGV + case "HA", "HAUSA": + return LanguageHA + case "HE", "HEBREW": + return LanguageHE + case "HI", "HINDI": + return LanguageHI + case "HO", "HIRIMOTU": + return LanguageHO + case "HR", "CROATIAN": + return LanguageHR + case "HT", "HAITIAN": + return LanguageHT + case "HU", "HUNGARIAN": + return LanguageHU + case "HY", "ARMENIAN": + return LanguageHY + case "HZ", "HERERO": + return LanguageHZ + case "IA", "INTERLINGUA": + return LanguageIA + case "ID", "INDONESIAN": + return LanguageID + case "IE", "INTERLINGUE": + return LanguageIE + case "IG", "IGBO": + return LanguageIG + case "II", "SICHUANYI": + return LanguageII + case "IK", "INUPIAQ": + return LanguageIK + case "IO", "IDO": + return LanguageIO + case "IS", "ICELANDIC": + return LanguageIS + case "IT", "ITALIAN": + return LanguageIT + case "IU", "INUKTITUT": + return LanguageIU + case "JA", "JAPANESE": + return LanguageJA + case "JV", "JAVANESE": + return LanguageJV + case "KA", "GEORGIAN": + return LanguageKA + case "KG", "KONGO": + return LanguageKG + case "KI", "KIKUYU": + return LanguageKI + case "KJ", "KWANYAMA": + return LanguageKJ + case "KK", "KAZAKH": + return LanguageKK + case "KL", "KALAALLISUT": + return LanguageKL + case "KM", "KHMER": + return LanguageKM + case "KN", "KANNADA": + return LanguageKN + case "KO", "KOREAN": + return LanguageKO + case "KR", "KANURI": + return LanguageKR + case "KS", "KASHMIRI": + return LanguageKS + case "KU", "KURDISH": + return LanguageKU + case "KV", "KOMI": + return LanguageKV + case "KW", "CORNISH": + return LanguageKW + case "KY", "KYRGYZ": + return LanguageKY + case "LA", "LATIN": + return LanguageLA + case "LB", "LUXEMBOURGISH": + return LanguageLB + case "LG", "GANDA": + return LanguageLG + case "LI", "LIMBURGISH": + return LanguageLI + case "LN", "LINGALA": + return LanguageLN + case "LO", "LAO": + return LanguageLO + case "LT", "LITHUANIAN": + return LanguageLT + case "LU", "LUBAKATANGA": + return LanguageLU + case "LV", "LATVIAN": + return LanguageLV + case "MG", "MALAGASY": + return LanguageMG + case "MH", "MARSHALLESE": + return LanguageMH + case "MI", "MAORI": + return LanguageMI + case "MK", "MACEDONIAN": + return LanguageMK + case "ML", "MALAYALAM": + return LanguageML + case "MN", "MONGOLIAN": + return LanguageMN + case "MR", "MARATHI": + return LanguageMR + case "MS", "MALAY": + return LanguageMS + case "MT", "MALTESE": + return LanguageMT + case "MY", "BURMESE": + return LanguageMY + case "NA", "NAURU": + return LanguageNA + case "NB", "NORWEGIANBOKMAL": + return LanguageNB + case "ND", "NORTHNDEBELE": + return LanguageND + case "NE", "NEPALI": + return LanguageNE + case "NG", "NDONGA": + return LanguageNG + case "NL", "DUTCH": + return LanguageNL + case "NN", "NORWEGIANNYNORSK": + return LanguageNN + case "NO", "NORWEGIAN": + return LanguageNO + case "NS", "NORTHERNSOTHO": + return LanguageNS + case "NV", "NAVAJO": + return LanguageNV + case "NY", "CHICHEWA": + return LanguageNY + case "OC", "OCCITAN": + return LanguageOC + case "OJ", "OJIBWA": + return LanguageOJ + case "OM", "OROMO": + return LanguageOM + case "OR", "ORIYA": + return LanguageOR + case "OS", "OSSETIAN": + return LanguageOS + case "PA", "PANJABI": + return LanguagePA + case "PI", "PALI": + return LanguagePI + case "PL", "POLISH": + return LanguagePL + case "PS", "PASHTO": + return LanguagePS + case "PT", "PORTUGUESE": + return LanguagePT + case "QU", "QUECHUA": + return LanguageQU + case "RM", "ROMANSH": + return LanguageRM + case "RN", "RUNDI": + return LanguageRN + case "RO", "ROMANIAN": + return LanguageRO + case "RU", "RUSSIAN": + return LanguageRU + case "RW", "KINYARWANDA": + return LanguageRW + case "SA", "SANSKRIT": + return LanguageSA + case "SC", "SARDINIAN": + return LanguageSC + case "SD", "SINDHI": + return LanguageSD + case "SE", "NORTHERNSAMI": + return LanguageSE + case "SG", "SANGO": + return LanguageSG + case "SI", "SINHALA": + return LanguageSI + case "SK", "SLOVAK": + return LanguageSK + case "SL", "SLOVENE": + return LanguageSL + case "SM", "SAMOAN": + return LanguageSM + case "SN", "SHONA": + return LanguageSN + case "SO", "SOMALI": + return LanguageSO + case "SQ", "ALBANIAN": + return LanguageSQ + case "SR", "SERBIAN": + return LanguageSR + case "SS", "SWATI": + return LanguageSS + case "ST", "SOUTHERNSOTHO": + return LanguageST + case "SU", "SUNDANESE": + return LanguageSU + case "SV", "SWEDISH": + return LanguageSV + case "SW", "SWAHILI": + return LanguageSW + case "TA", "TAMIL": + return LanguageTA + case "TE", "TELUGU": + return LanguageTE + case "TG", "TAJIK": + return LanguageTG + case "TH", "THAI": + return LanguageTH + case "TI", "TIGRINYA": + return LanguageTI + case "TK", "TURKMEN": + return LanguageTK + case "TL", "TAGALOG": + return LanguageTL + case "TN", "TSWANA": + return LanguageTN + case "TO", "TONGAN": + return LanguageTO + case "TR", "TURKISH": + return LanguageTR + case "TS", "TSONGA": + return LanguageTS + case "TT", "TATAR": + return LanguageTT + case "TW", "TWI": + return LanguageTW + case "TY", "TAHITIAN": + return LanguageTY + case "UG", "UIGHUR": + return LanguageUG + case "UK", "UKRAINIAN": + return LanguageUK + case "UR", "URDU": + return LanguageUR + case "UZ", "UZBEK": + return LanguageUZ + case "VE", "VENDA": + return LanguageVE + case "VI", "VIETNAMESE": + return LanguageVI + case "VO", "VOLAPUK": + return LanguageVO + case "WA", "WALLOON": + return LanguageWA + case "WO", "WOLOF": + return LanguageWO + case "XH", "XHOSA": + return LanguageXH + case "YI", "YIDDISH": + return LanguageYI + case "YO", "YORUBA": + return LanguageYO + case "ZA", "ZHUANG": + return LanguageZA + case "ZH", "CHINESE": + return LanguageZH + case "ZU", "ZULU": + return LanguageZU + default: + return LanguageUnknown + } +} diff --git a/languagesconst.go b/languagesconst.go new file mode 100644 index 0000000..fdb1f2f --- /dev/null +++ b/languagesconst.go @@ -0,0 +1,387 @@ +package countries + +// TypeLanguageCode for Typer interface +const TypeLanguageCode string = "countries.LanguageCode" + +// TypeLanguage for Typer interface +const TypeLanguage string = "countries.Language" + +// UnknownLanguageCode is the unknown language code. +const UnknownLanguageCode string = "Unknown" + +// ISO 639-1 language code name, 2 codes present e.g. LanguageRU == LanguageRussian = "ru". +const ( + LanguageUnknown LanguageCode = "Unknown" + LanguageAfar LanguageCode = "aa" + LanguageAbkhazian LanguageCode = "ab" + LanguageAvestan LanguageCode = "ae" + LanguageAfrikaans LanguageCode = "af" + LanguageAkan LanguageCode = "ak" + LanguageAmharic LanguageCode = "am" + LanguageAragonese LanguageCode = "an" + LanguageArabic LanguageCode = "ar" + LanguageAssamese LanguageCode = "as" + LanguageAvaric LanguageCode = "av" + LanguageAymara LanguageCode = "ay" + LanguageAzerbaijani LanguageCode = "az" + LanguageBashkir LanguageCode = "ba" + LanguageBelarusian LanguageCode = "be" + LanguageBulgarian LanguageCode = "bg" + LanguageBihariLanguages LanguageCode = "bh" + LanguageBislama LanguageCode = "bi" + LanguageBambara LanguageCode = "bm" + LanguageBengali LanguageCode = "bn" + LanguageTibetan LanguageCode = "bo" + LanguageBreton LanguageCode = "br" + LanguageBosnian LanguageCode = "bs" + LanguageCatalan LanguageCode = "ca" + LanguageChechen LanguageCode = "ce" + LanguageChamorro LanguageCode = "ch" + LanguageCorsican LanguageCode = "co" + LanguageCree LanguageCode = "cr" + LanguageCzech LanguageCode = "cs" + LanguageChurchSlavic LanguageCode = "cu" + LanguageChuvash LanguageCode = "cv" + LanguageWelsh LanguageCode = "cy" + LanguageDanish LanguageCode = "da" + LanguageGerman LanguageCode = "de" + LanguageDivehi LanguageCode = "dv" + LanguageDzongkha LanguageCode = "dz" + LanguageEwe LanguageCode = "ee" + LanguageGreek LanguageCode = "el" + LanguageEnglish LanguageCode = "en" + LanguageEsperanto LanguageCode = "eo" + LanguageSpanish LanguageCode = "es" + LanguageEstonian LanguageCode = "et" + LanguageBasque LanguageCode = "eu" + LanguagePersian LanguageCode = "fa" + LanguageFulah LanguageCode = "ff" + LanguageFinnish LanguageCode = "fi" + LanguageFijian LanguageCode = "fj" + LanguageFaroese LanguageCode = "fo" + LanguageFrench LanguageCode = "fr" + LanguageWesternFrisian LanguageCode = "fy" + LanguageIrish LanguageCode = "ga" + LanguageScottishGaelic LanguageCode = "gd" + LanguageGalician LanguageCode = "gl" + LanguageGuarani LanguageCode = "gn" + LanguageGujarati LanguageCode = "gu" + LanguageManx LanguageCode = "gv" + LanguageHausa LanguageCode = "ha" + LanguageHebrew LanguageCode = "he" + LanguageHindi LanguageCode = "hi" + LanguageHiriMotu LanguageCode = "ho" + LanguageCroatian LanguageCode = "hr" + LanguageHaitianCreole LanguageCode = "ht" + LanguageHungarian LanguageCode = "hu" + LanguageArmenian LanguageCode = "hy" + LanguageHerero LanguageCode = "hz" + LanguageInterlingua LanguageCode = "ia" + LanguageIndonesian LanguageCode = "id" + LanguageInterlingue LanguageCode = "ie" + LanguageIgbo LanguageCode = "ig" + LanguageSichuanYi LanguageCode = "ii" + LanguageInupiaq LanguageCode = "ik" + LanguageIdo LanguageCode = "io" + LanguageIcelandic LanguageCode = "is" + LanguageItalian LanguageCode = "it" + LanguageInuktitut LanguageCode = "iu" + LanguageJapanese LanguageCode = "ja" + LanguageJavanese LanguageCode = "jv" + LanguageGeorgian LanguageCode = "ka" + LanguageKongo LanguageCode = "kg" + LanguageKikuyu LanguageCode = "ki" + LanguageKuanyama LanguageCode = "kj" + LanguageKazakh LanguageCode = "kk" + LanguageKalaallisut LanguageCode = "kl" + LanguageCentralKhmer LanguageCode = "km" + LanguageKannada LanguageCode = "kn" + LanguageKorean LanguageCode = "ko" + LanguageKanuri LanguageCode = "kr" + LanguageKashmiri LanguageCode = "ks" + LanguageKurdish LanguageCode = "ku" + LanguageKomi LanguageCode = "kv" + LanguageCornish LanguageCode = "kw" + LanguageKirghiz LanguageCode = "ky" + LanguageLatin LanguageCode = "la" + LanguageLuxembourgish LanguageCode = "lb" + LanguageGanda LanguageCode = "lg" + LanguageLimburgish LanguageCode = "li" + LanguageLingala LanguageCode = "ln" + LanguageLao LanguageCode = "lo" + LanguageLithuanian LanguageCode = "lt" + LanguageLubaKatanga LanguageCode = "lu" + LanguageLatvian LanguageCode = "lv" + LanguageMalagasy LanguageCode = "mg" + LanguageMarshallese LanguageCode = "mh" + LanguageMaori LanguageCode = "mi" + LanguageMacedonian LanguageCode = "mk" + LanguageMalayalam LanguageCode = "ml" + LanguageMongolian LanguageCode = "mn" + LanguageMarathi LanguageCode = "mr" + LanguageMalay LanguageCode = "ms" + LanguageMaltese LanguageCode = "mt" + LanguageBurmese LanguageCode = "my" + LanguageNauru LanguageCode = "na" + LanguageNorwegianBokmal LanguageCode = "nb" + LanguageNorthNdebele LanguageCode = "nd" + LanguageNepali LanguageCode = "ne" + LanguageNdonga LanguageCode = "ng" + LanguageDutch LanguageCode = "nl" + LanguageNorwegianNynorsk LanguageCode = "nn" + LanguageNorwegian LanguageCode = "no" + LanguageSouthNdebele LanguageCode = "ns" + LanguageNavajo LanguageCode = "nv" + LanguageChichewa LanguageCode = "ny" + LanguageOccitan LanguageCode = "oc" + LanguageOjibwe LanguageCode = "oj" + LanguageOromo LanguageCode = "om" + LanguageOriya LanguageCode = "or" + LanguageOssetian LanguageCode = "os" + LanguagePanjabi LanguageCode = "pa" + LanguagePali LanguageCode = "pi" + LanguagePolish LanguageCode = "pl" + LanguagePushto LanguageCode = "ps" + LanguagePortuguese LanguageCode = "pt" + LanguageQuechua LanguageCode = "qu" + LanguageRomansh LanguageCode = "rm" + LanguageRundi LanguageCode = "rn" + LanguageRomanian LanguageCode = "ro" + LanguageRussian LanguageCode = "ru" + LanguageKinyarwanda LanguageCode = "rw" + LanguageSanskrit LanguageCode = "sa" + LanguageSardinian LanguageCode = "sc" + LanguageSindhi LanguageCode = "sd" + LanguageNorthernSami LanguageCode = "se" + LanguageSango LanguageCode = "sg" + LanguageSinhalese LanguageCode = "si" + LanguageSlovak LanguageCode = "sk" + LanguageSlovenian LanguageCode = "sl" + LanguageSamoan LanguageCode = "sm" + LanguageShona LanguageCode = "sn" + LanguageSomali LanguageCode = "so" + LanguageAlbanian LanguageCode = "sq" + LanguageSerbian LanguageCode = "sr" + LanguageSwati LanguageCode = "ss" + LanguageSouthernSotho LanguageCode = "st" + LanguageSundanese LanguageCode = "su" + LanguageSwedish LanguageCode = "sv" + LanguageSwahili LanguageCode = "sw" + LanguageTamil LanguageCode = "ta" + LanguageTelugu LanguageCode = "te" + LanguageTajik LanguageCode = "tg" + LanguageThai LanguageCode = "th" + LanguageTigrinya LanguageCode = "ti" + LanguageTurkmen LanguageCode = "tk" + LanguageTagalog LanguageCode = "tl" + LanguageTswana LanguageCode = "tn" + LanguageTonga LanguageCode = "to" + LanguageTurkish LanguageCode = "tr" + LanguageTsonga LanguageCode = "ts" + LanguageTatar LanguageCode = "tt" + LanguageTwi LanguageCode = "tw" + LanguageTahitian LanguageCode = "ty" + LanguageUighur LanguageCode = "ug" + LanguageUkrainian LanguageCode = "uk" + LanguageUrdu LanguageCode = "ur" + LanguageUzbek LanguageCode = "uz" + LanguageVenda LanguageCode = "ve" + LanguageVietnamese LanguageCode = "vi" + LanguageVolapuk LanguageCode = "vo" + LanguageWalloon LanguageCode = "wa" + LanguageWolof LanguageCode = "wo" + LanguageXhosa LanguageCode = "xh" + LanguageYiddish LanguageCode = "yi" + LanguageYoruba LanguageCode = "yo" + LanguageZhuang LanguageCode = "za" + LanguageChinese LanguageCode = "zh" + LanguageZulu LanguageCode = "zu" +) + +// ISO 639-1 language code name, 2 codes present e.g. LanguageRU == LanguageRussian = "ru". +const ( + LanguageAA LanguageCode = "aa" + LanguageAB LanguageCode = "ab" + LanguageAE LanguageCode = "ae" + LanguageAF LanguageCode = "af" + LanguageAK LanguageCode = "ak" + LanguageAM LanguageCode = "am" + LanguageAN LanguageCode = "an" + LanguageAR LanguageCode = "ar" + LanguageAS LanguageCode = "as" + LanguageAV LanguageCode = "av" + LanguageAY LanguageCode = "ay" + LanguageAZ LanguageCode = "az" + LanguageBA LanguageCode = "ba" + LanguageBE LanguageCode = "be" + LanguageBG LanguageCode = "bg" + LanguageBH LanguageCode = "bh" + LanguageBI LanguageCode = "bi" + LanguageBM LanguageCode = "bm" + LanguageBN LanguageCode = "bn" + LanguageBO LanguageCode = "bo" + LanguageBR LanguageCode = "br" + LanguageBS LanguageCode = "bs" + LanguageCA LanguageCode = "ca" + LanguageCE LanguageCode = "ce" + LanguageCH LanguageCode = "ch" + LanguageCO LanguageCode = "co" + LanguageCR LanguageCode = "cr" + LanguageCS LanguageCode = "cs" + LanguageCU LanguageCode = "cu" + LanguageCV LanguageCode = "cv" + LanguageCY LanguageCode = "cy" + LanguageDA LanguageCode = "da" + LanguageDE LanguageCode = "de" + LanguageDV LanguageCode = "dv" + LanguageDZ LanguageCode = "dz" + LanguageEE LanguageCode = "ee" + LanguageEL LanguageCode = "el" + LanguageEN LanguageCode = "en" + LanguageEO LanguageCode = "eo" + LanguageES LanguageCode = "es" + LanguageET LanguageCode = "et" + LanguageEU LanguageCode = "eu" + LanguageFA LanguageCode = "fa" + LanguageFF LanguageCode = "ff" + LanguageFI LanguageCode = "fi" + LanguageFJ LanguageCode = "fj" + LanguageFO LanguageCode = "fo" + LanguageFR LanguageCode = "fr" + LanguageFY LanguageCode = "fy" + LanguageGA LanguageCode = "ga" + LanguageGD LanguageCode = "gd" + LanguageGL LanguageCode = "gl" + LanguageGN LanguageCode = "gn" + LanguageGU LanguageCode = "gu" + LanguageGV LanguageCode = "gv" + LanguageHA LanguageCode = "ha" + LanguageHE LanguageCode = "he" + LanguageHI LanguageCode = "hi" + LanguageHO LanguageCode = "ho" + LanguageHR LanguageCode = "hr" + LanguageHT LanguageCode = "ht" + LanguageHU LanguageCode = "hu" + LanguageHY LanguageCode = "hy" + LanguageHZ LanguageCode = "hz" + LanguageIA LanguageCode = "ia" + LanguageID LanguageCode = "id" + LanguageIE LanguageCode = "ie" + LanguageIG LanguageCode = "ig" + LanguageII LanguageCode = "ii" + LanguageIK LanguageCode = "ik" + LanguageIO LanguageCode = "io" + LanguageIS LanguageCode = "is" + LanguageIT LanguageCode = "it" + LanguageIU LanguageCode = "iu" + LanguageJA LanguageCode = "ja" + LanguageJV LanguageCode = "jv" + LanguageKA LanguageCode = "ka" + LanguageKG LanguageCode = "kg" + LanguageKI LanguageCode = "ki" + LanguageKJ LanguageCode = "kj" + LanguageKK LanguageCode = "kk" + LanguageKL LanguageCode = "kl" + LanguageKM LanguageCode = "km" + LanguageKN LanguageCode = "kn" + LanguageKO LanguageCode = "ko" + LanguageKR LanguageCode = "kr" + LanguageKS LanguageCode = "ks" + LanguageKU LanguageCode = "ku" + LanguageKV LanguageCode = "kv" + LanguageKW LanguageCode = "kw" + LanguageKY LanguageCode = "ky" + LanguageLA LanguageCode = "la" + LanguageLB LanguageCode = "lb" + LanguageLG LanguageCode = "lg" + LanguageLI LanguageCode = "li" + LanguageLN LanguageCode = "ln" + LanguageLO LanguageCode = "lo" + LanguageLT LanguageCode = "lt" + LanguageLU LanguageCode = "lu" + LanguageLV LanguageCode = "lv" + LanguageMG LanguageCode = "mg" + LanguageMH LanguageCode = "mh" + LanguageMI LanguageCode = "mi" + LanguageMK LanguageCode = "mk" + LanguageML LanguageCode = "ml" + LanguageMN LanguageCode = "mn" + LanguageMR LanguageCode = "mr" + LanguageMS LanguageCode = "ms" + LanguageMT LanguageCode = "mt" + LanguageMY LanguageCode = "my" + LanguageNA LanguageCode = "na" + LanguageNB LanguageCode = "nb" + LanguageND LanguageCode = "nd" + LanguageNE LanguageCode = "ne" + LanguageNG LanguageCode = "ng" + LanguageNL LanguageCode = "nl" + LanguageNN LanguageCode = "nn" + LanguageNO LanguageCode = "no" + LanguageNS LanguageCode = "ns" + LanguageNV LanguageCode = "nv" + LanguageNY LanguageCode = "ny" + LanguageOC LanguageCode = "oc" + LanguageOJ LanguageCode = "oj" + LanguageOM LanguageCode = "om" + LanguageOR LanguageCode = "or" + LanguageOS LanguageCode = "os" + LanguagePA LanguageCode = "pa" + LanguagePI LanguageCode = "pi" + LanguagePL LanguageCode = "pl" + LanguagePS LanguageCode = "ps" + LanguagePT LanguageCode = "pt" + LanguageQU LanguageCode = "qu" + LanguageRM LanguageCode = "rm" + LanguageRN LanguageCode = "rn" + LanguageRO LanguageCode = "ro" + LanguageRU LanguageCode = "ru" + LanguageRW LanguageCode = "rw" + LanguageSA LanguageCode = "sa" + LanguageSC LanguageCode = "sc" + LanguageSD LanguageCode = "sd" + LanguageSE LanguageCode = "se" + LanguageSG LanguageCode = "sg" + LanguageSI LanguageCode = "si" + LanguageSK LanguageCode = "sk" + LanguageSL LanguageCode = "sl" + LanguageSM LanguageCode = "sm" + LanguageSN LanguageCode = "sn" + LanguageSO LanguageCode = "so" + LanguageSQ LanguageCode = "sq" + LanguageSR LanguageCode = "sr" + LanguageSS LanguageCode = "ss" + LanguageST LanguageCode = "st" + LanguageSU LanguageCode = "su" + LanguageSV LanguageCode = "sv" + LanguageSW LanguageCode = "sw" + LanguageTA LanguageCode = "ta" + LanguageTE LanguageCode = "te" + LanguageTG LanguageCode = "tg" + LanguageTH LanguageCode = "th" + LanguageTI LanguageCode = "ti" + LanguageTK LanguageCode = "tk" + LanguageTL LanguageCode = "tl" + LanguageTN LanguageCode = "tn" + LanguageTO LanguageCode = "to" + LanguageTR LanguageCode = "tr" + LanguageTS LanguageCode = "ts" + LanguageTT LanguageCode = "tt" + LanguageTW LanguageCode = "tw" + LanguageTY LanguageCode = "ty" + LanguageUG LanguageCode = "ug" + LanguageUK LanguageCode = "uk" + LanguageUR LanguageCode = "ur" + LanguageUZ LanguageCode = "uz" + LanguageVE LanguageCode = "ve" + LanguageVI LanguageCode = "vi" + LanguageVO LanguageCode = "vo" + LanguageWA LanguageCode = "wa" + LanguageWO LanguageCode = "wo" + LanguageXH LanguageCode = "xh" + LanguageYI LanguageCode = "yi" + LanguageYO LanguageCode = "yo" + LanguageZA LanguageCode = "za" + LanguageZH LanguageCode = "zh" + LanguageZU LanguageCode = "zu" +) From 4c9d972672b2c77b94d8fea98a29b64c177fff54 Mon Sep 17 00:00:00 2001 From: Daniel Hilton Date: Wed, 13 Nov 2024 18:38:04 +0000 Subject: [PATCH 2/5] Adding tests --- languages.go | 2 +- languages_test.go | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 languages_test.go diff --git a/languages.go b/languages.go index d6eab97..1840290 100644 --- a/languages.go +++ b/languages.go @@ -771,7 +771,7 @@ func (c LanguageCode) IsValid() bool { } func TotalLanguages() int { - return 183 + return 184 // Including LanguageUnknown } func (c LanguageCode) Info() *Language { diff --git a/languages_test.go b/languages_test.go new file mode 100644 index 0000000..ada9af6 --- /dev/null +++ b/languages_test.go @@ -0,0 +1,80 @@ +package countries + +import ( + "testing" +) + +// Test Languages + +// nolint:gocyclo +func TestLanguageCount(t *testing.T) { + got := TotalLanguages() + + want := len(AllLanguages()) + if got != want { + t.Errorf("Test AllLanguageCodes() err, want %v, got %v", want, got) + } + + want = len(AllLanguagesInfo()) + if got != want { + t.Errorf("Test AllLanguageCodesInfo() err, want %v, got %v", want, got) + } +} + +func TestLanguageCode(t *testing.T) { + for _, l := range AllLanguages() { + if l == LanguageUnknown { + continue + } + + if info := l.Info(); info.Code == LanguageUnknown { + t.Errorf("Test info.Code err, l: %v", *info) + } + } +} + +func TestLanguageIsValid(t *testing.T) { + for _, l := range AllLanguages() { + if l == LanguageUnknown { + continue + } + + if !l.IsValid() && l != LanguageUnknown { + t.Errorf("Test LanguageCode.IsValid() err") + } + } +} + +func TestLanguageString(t *testing.T) { + for _, l := range AllLanguages() { + if l == LanguageUnknown { + continue + } + if l.String() == "" || l.String() == UnknownMsg { + t.Errorf("Test LanguageCode.String() err, l: %v", l) + } + } +} + +func TestLanguageType(t *testing.T) { + for _, l := range AllLanguages() { + if l == LanguageUnknown { + continue + } + if l.Type() == "" { + t.Errorf("Test LanguageCode.Type() err, l: %v", l) + } + } +} + +func TestLanguageInfo(t *testing.T) { + for _, l := range AllLanguages() { + if l == LanguageUnknown { + continue + } + + if info := l.Info(); info.Code == LanguageUnknown { + t.Errorf("Test info.Code err, l: %v", *info) + } + } +} From f46a5b310d4bf472a67ac72eb84f6fcf2858a096 Mon Sep 17 00:00:00 2001 From: Daniel Hilton Date: Wed, 13 Nov 2024 20:06:10 +0000 Subject: [PATCH 3/5] :rotating_light: deepsource lint fix and adjust totallanguages --- countries.go | 2 +- languages.go | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/countries.go b/countries.go index 7cf4a5f..649ac5b 100644 --- a/countries.go +++ b/countries.go @@ -4895,7 +4895,7 @@ func (c CountryCode) Region() RegionCode { //nolint:gocyclo } // Language - return language code of country -func (c CountryCode) Language() LanguageCode { +func (c CountryCode) Language() LanguageCode { //nolint:gocyclo switch c { case AUS: return LanguageEN diff --git a/languages.go b/languages.go index 1840290..72827a7 100644 --- a/languages.go +++ b/languages.go @@ -12,12 +12,12 @@ type Language struct { Code LanguageCode } -func (_ LanguageCode) Type() string { +func (LanguageCode) Type() string { return TypeLanguageCode } -func (c LanguageCode) String() string { - switch c { +func (lc LanguageCode) String() string { //nolint:gocyclo + switch lc { case LanguageAA: return "Afar" case LanguageAB: @@ -391,8 +391,8 @@ func (c LanguageCode) String() string { } } -func (c LanguageCode) StringRus() string { - switch c { +func (lc LanguageCode) StringRus() string { //nolint:gocyclo + switch lc { case LanguageAA: return "Афар" case LanguageAB: @@ -766,38 +766,38 @@ func (c LanguageCode) StringRus() string { } } -func (c LanguageCode) IsValid() bool { - return c.String() != UnknownLanguageCode +func (lc LanguageCode) IsValid() bool { + return lc.String() != UnknownLanguageCode } func TotalLanguages() int { - return 184 // Including LanguageUnknown + return len(AllLanguages()) } -func (c LanguageCode) Info() *Language { +func (lc LanguageCode) Info() *Language { return &Language{ - Name: c.String(), - Code: c, + Name: lc.String(), + Code: lc, } } -func (_ *Language) Type() string { +func (*Language) Type() string { return TypeLanguage } -func (r Language) Value() (Value, error) { - return json.Marshal(r) +func (l Language) Value() (Value, error) { + return json.Marshal(l) } -func (r *Language) Scan(src interface{}) error { - if r == nil { +func (l *Language) Scan(src interface{}) error { + if l == nil { return fmt.Errorf("countries::Scan: Language scan err: language == nil") } switch src := src.(type) { case *Language: - *r = *src + *l = *src case Language: - *r = src + *l = src } return nil } @@ -832,7 +832,7 @@ func AllLanguagesInfo() []*Language { return languages } -func LanguageCodeByName(name string) LanguageCode { +func LanguageCodeByName(name string) LanguageCode { //nolint:gocyclo switch textPrepare(name) { case "AA", "AFAR": return LanguageAA From dbf6bde7859bf8f2adf197258cd878ef8e8ab2ba Mon Sep 17 00:00:00 2001 From: Daniel Hilton Date: Thu, 14 Nov 2024 10:49:10 +0000 Subject: [PATCH 4/5] :sparkles: `Alpha2`, `Alpha3` and `StringLocal` --- languages.go | 755 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 755 insertions(+) diff --git a/languages.go b/languages.go index 72827a7..fa0c263 100644 --- a/languages.go +++ b/languages.go @@ -391,6 +391,386 @@ func (lc LanguageCode) String() string { //nolint:gocyclo } } +func (lc LanguageCode) Alpha2() string { + return string(lc) +} + +func (lc LanguageCode) Alpha3() string { + switch lc { + case LanguageAA: + return "aar" + case LanguageAB: + return "abk" + case LanguageAE: + return "ave" + case LanguageAF: + return "afr" + case LanguageAK: + return "aka" + case LanguageAM: + return "amh" + case LanguageAN: + return "arg" + case LanguageAR: + return "ara" + case LanguageAS: + return "asm" + case LanguageAV: + return "ava" + case LanguageAY: + return "aym" + case LanguageAZ: + return "aze" + case LanguageBA: + return "bak" + case LanguageBE: + return "bel" + case LanguageBG: + return "bul" + case LanguageBH: + return "bih" + case LanguageBI: + return "bis" + case LanguageBM: + return "bam" + case LanguageBN: + return "ben" + case LanguageBO: + return "bod" + case LanguageBR: + return "bre" + case LanguageBS: + return "bos" + case LanguageCA: + return "cat" + case LanguageCE: + return "che" + case LanguageCH: + return "cha" + case LanguageCO: + return "cos" + case LanguageCR: + return "cre" + case LanguageCS: + return "ces" + case LanguageCU: + return "chu" + case LanguageCV: + return "chv" + case LanguageCY: + return "cym" + case LanguageDA: + return "dan" + case LanguageDE: + return "deu" + case LanguageDV: + return "div" + case LanguageDZ: + return "dzo" + case LanguageEE: + return "ewe" + case LanguageEL: + return "ell" + case LanguageEN: + return "eng" + case LanguageEO: + return "epo" + case LanguageES: + return "spa" + case LanguageET: + return "est" + case LanguageEU: + return "eus" + case LanguageFA: + return "fas" + case LanguageFF: + return "ful" + case LanguageFI: + return "fin" + case LanguageFJ: + return "fij" + case LanguageFO: + return "fao" + case LanguageFR: + return "fra" + case LanguageFY: + return "fry" + case LanguageGA: + return "gle" + case LanguageGD: + return "gla" + case LanguageGL: + return "glg" + case LanguageGN: + return "grn" + case LanguageGU: + return "guj" + case LanguageGV: + return "glv" + case LanguageHA: + return "hau" + case LanguageHE: + return "heb" + case LanguageHI: + return "hin" + case LanguageHO: + return "hmo" + case LanguageHR: + return "hrv" + case LanguageHT: + return "hat" + case LanguageHU: + return "hun" + case LanguageHY: + return "hye" + case LanguageHZ: + return "her" + case LanguageIA: + return "ina" + case LanguageID: + return "ind" + case LanguageIE: + return "ile" + case LanguageIG: + return "ibo" + case LanguageII: + return "iii" + case LanguageIK: + return "ipk" + case LanguageIO: + return "ido" + case LanguageIS: + return "isl" + case LanguageIT: + return "ita" + case LanguageIU: + return "iku" + case LanguageJA: + return "jpn" + case LanguageJV: + return "jav" + case LanguageKA: + return "kat" + case LanguageKG: + return "kon" + case LanguageKI: + return "kik" + case LanguageKJ: + return "kua" + case LanguageKK: + return "kaz" + case LanguageKL: + return "kal" + case LanguageKM: + return "khm" + case LanguageKN: + return "kan" + case LanguageKO: + return "kor" + case LanguageKR: + return "kau" + case LanguageKS: + return "kas" + case LanguageKU: + return "kur" + case LanguageKV: + return "kom" + case LanguageKW: + return "cor" + case LanguageKY: + return "kir" + case LanguageLA: + return "lat" + case LanguageLB: + return "ltz" + case LanguageLG: + return "lug" + case LanguageLI: + return "lim" + case LanguageLN: + return "lin" + case LanguageLO: + return "lao" + case LanguageLT: + return "lit" + case LanguageLU: + return "lub" + case LanguageLV: + return "lav" + case LanguageMG: + return "mlg" + case LanguageMH: + return "mah" + case LanguageMI: + return "mri" + case LanguageMK: + return "mkd" + case LanguageML: + return "mal" + case LanguageMN: + return "mon" + case LanguageMR: + return "mar" + case LanguageMS: + return "msa" + case LanguageMT: + return "mlt" + case LanguageMY: + return "mya" + case LanguageNA: + return "nau" + case LanguageNB: + return "nob" + case LanguageND: + return "nde" + case LanguageNE: + return "nep" + case LanguageNG: + return "ndo" + case LanguageNL: + return "nld" + case LanguageNN: + return "nno" + case LanguageNO: + return "nor" + case LanguageNS: + return "nso" + case LanguageNV: + return "nav" + case LanguageNY: + return "nya" + case LanguageOC: + return "oci" + case LanguageOJ: + return "oji" + case LanguageOM: + return "orm" + case LanguageOR: + return "ori" + case LanguageOS: + return "oss" + case LanguagePA: + return "pan" + case LanguagePI: + return "pli" + case LanguagePL: + return "pol" + case LanguagePS: + return "pus" + case LanguagePT: + return "por" + case LanguageQU: + return "que" + case LanguageRM: + return "roh" + case LanguageRN: + return "run" + case LanguageRO: + return "ron" + case LanguageRU: + return "rus" + case LanguageRW: + return "kin" + case LanguageSA: + return "san" + case LanguageSC: + return "srd" + case LanguageSD: + return "snd" + case LanguageSE: + return "sme" + case LanguageSG: + return "sag" + case LanguageSI: + return "sin" + case LanguageSK: + return "slk" + case LanguageSL: + return "slv" + case LanguageSM: + return "smo" + case LanguageSN: + return "sna" + case LanguageSO: + return "som" + case LanguageSQ: + return "sqi" + case LanguageSR: + return "srp" + case LanguageSS: + return "ssw" + case LanguageST: + return "sot" + case LanguageSU: + return "sun" + case LanguageSV: + return "swe" + case LanguageSW: + return "swa" + case LanguageTA: + return "tam" + case LanguageTE: + return "tel" + case LanguageTG: + return "tgk" + case LanguageTH: + return "tha" + case LanguageTI: + return "tir" + case LanguageTK: + return "tuk" + case LanguageTL: + return "tgl" + case LanguageTN: + return "tsn" + case LanguageTO: + return "ton" + case LanguageTR: + return "tur" + case LanguageTS: + return "tso" + case LanguageTT: + return "tat" + case LanguageTW: + return "twi" + case LanguageTY: + return "tah" + case LanguageUG: + return "uig" + case LanguageUK: + return "ukr" + case LanguageUR: + return "urd" + case LanguageUZ: + return "uzb" + case LanguageVE: + return "ven" + case LanguageVI: + return "vie" + case LanguageVO: + return "vol" + case LanguageWA: + return "wln" + case LanguageWO: + return "wol" + case LanguageXH: + return "xho" + case LanguageYI: + return "yid" + case LanguageYO: + return "yor" + case LanguageZA: + return "zha" + case LanguageZH: + return "zho" + case LanguageZU: + return "zul" + } + return "unknown" +} + +// StringRus returns the language name in Russian. +// StringRus возвращает название языка на русском языке. func (lc LanguageCode) StringRus() string { //nolint:gocyclo switch lc { case LanguageAA: @@ -766,6 +1146,381 @@ func (lc LanguageCode) StringRus() string { //nolint:gocyclo } } +// StringLocal returns the language name in the local language. +func (lc LanguageCode) StringLocal() string { + switch lc { + case LanguageAA: + return "Qafar af" + case LanguageAB: + return "Аҧсуа" + case LanguageAE: + return "Avesta" + case LanguageAF: + return "Afrikaans" + case LanguageAK: + return "Ákán" + case LanguageAM: + return "አማርኛ" + case LanguageAN: + return "Aragonés" + case LanguageAR: + return "العربية" + case LanguageAS: + return "অসমীয়া" + case LanguageAV: + return "Авар мацӀ" + case LanguageAY: + return "Aymara" + case LanguageAZ: + return "Azərbaycan dili" + case LanguageBA: + return "башҡорт теле" + case LanguageBE: + return "беларуская" + case LanguageBG: + return "български" + case LanguageBH: + return "भोजपुरी" + case LanguageBI: + return "Bislama" + case LanguageBM: + return "ߓߡߊߣߊ߲" + case LanguageBN: + return "বাংলা" + case LanguageBO: + return "བོད་ཡིག" + case LanguageBR: + return "Brezhoneg" + case LanguageBS: + return "Босански" + case LanguageCA: + return "català" + case LanguageCE: + return "нохчийн мотт" + case LanguageCH: + return "Chamoru" + case LanguageCO: + return "corsu" + case LanguageCR: + return "ᓀᐦᐃᔭᐍᐏᐣ" + case LanguageCS: + return "čeština" + case LanguageCU: + return "ѩзыкъ словѣньскъ" + case LanguageCV: + return "чӑваш чӗлхи" + case LanguageCY: + return "Cymraeg" + case LanguageDA: + return "Dansk" + case LanguageDE: + return "Deutsch" + case LanguageDV: + return "ދިވެހި" + case LanguageDZ: + return "རྫོང་ཁ" + case LanguageEE: + return "Eʋegbe" + case LanguageEL: + return "Ελληνικά" + case LanguageEN: + return "English" + case LanguageEO: + return "Esperanto" + case LanguageES: + return "Español" + case LanguageET: + return "Eesti" + case LanguageEU: + return "Euskara" + case LanguageFA: + return "فارسی" + case LanguageFF: + return "Fulfulde" + case LanguageFI: + return "Suomi" + case LanguageFJ: + return "Vosa Vakaviti" + case LanguageFO: + return "Føroyskt" + case LanguageFR: + return "Français" + case LanguageFY: + return "Frysk" + case LanguageGA: + return "Gaeilge" + case LanguageGD: + return "Gàidhlig" + case LanguageGL: + return "Galego" + case LanguageGN: + return "Avañe'ẽ" + case LanguageGU: + return "ગુજરાતી" + case LanguageGV: + return "Gaelg" + case LanguageHA: + return "Hausa" + case LanguageHE: + return "עברית" + case LanguageHI: + return "हिन्दी" + case LanguageHO: + return "Hiri Motu" + case LanguageHR: + return "Hrvatski" + case LanguageHT: + return "Kreyòl ayisyen" + case LanguageHU: + return "Magyar" + case LanguageHY: + return "Հայերեն" + case LanguageHZ: + return "Otjiherero" + case LanguageIA: + return "Interlingua" + case LanguageID: + return "Bahasa Indonesia" + case LanguageIE: + return "Interlingue" + case LanguageIG: + return "Asụsụ Igbo" + case LanguageII: + return "ꆇꉙ" + case LanguageIK: + return "Iñupiatun" + case LanguageIO: + return "Ido" + case LanguageIS: + return "Íslenska" + case LanguageIT: + return "Italiano" + case LanguageIU: + return "ᐃᓄᒃᑎᑐᑦ" + case LanguageJA: + return "日本語" + case LanguageJV: + return "ꦧꦱꦗꦮ" + case LanguageKA: + return "ქართული" + case LanguageKG: + return "Kikongo" + case LanguageKI: + return "Gĩkũyũ" + case LanguageKJ: + return "Kuanyama" + case LanguageKK: + return "қазақ тілі" + case LanguageKL: + return "Kalaallisut" + case LanguageKM: + return "ខ្មែរ" + case LanguageKN: + return "ಕನ್ನಡ" + case LanguageKO: + return "한국어" + case LanguageKR: + return "Kanuri" + case LanguageKS: + return "कश्मीरी" + case LanguageKU: + return "Kurdî" + case LanguageKV: + return "коми кыв" + case LanguageKW: + return "Kernewek" + case LanguageKY: + return "Кыргызча" + case LanguageLA: + return "Latine" + case LanguageLB: + return "Lëtzebuergesch" + case LanguageLG: + return "Luganda" + case LanguageLI: + return "Limburgs" + case LanguageLN: + return "Lingála" + case LanguageLO: + return "ພາສາລາວ" + case LanguageLT: + return "Lietuvių kalba" + case LanguageLU: + return "Tshiluba" + case LanguageLV: + return "Latviešu valoda" + case LanguageMG: + return "Fiteny malagasy" + case LanguageMH: + return "Kajin M̧ajeļ" + case LanguageMI: + return "Te reo Māori" + case LanguageMK: + return "македонски јазик" + case LanguageML: + return "മലയാളം" + case LanguageMN: + return "монгол" + case LanguageMR: + return "मराठी" + case LanguageMS: + return "Bahasa Melayu" + case LanguageMT: + return "Malti" + case LanguageMY: + return "ဗမာစာ" + case LanguageNA: + return "Ekakairũ Naoero" + case LanguageNB: + return "Norsk bokmål" + case LanguageND: + return "isiNdebele" + case LanguageNE: + return "नेपाली" + case LanguageNG: + return "Owambo" + case LanguageNL: + return "Nederlands" + case LanguageNN: + return "Norsk nynorsk" + case LanguageNO: + return "Norsk" + case LanguageNS: + return "Sesotho sa Leboa" + case LanguageNV: + return "Diné bizaad" + case LanguageNY: + return "chichewa" + case LanguageOC: + return "Occitan" + case LanguageOJ: + return "ᐊᓂᔑᓈᐯᒧᐎᓐ" + case LanguageOM: + return "Afaan Oromoo" + case LanguageOR: + return "ଓଡ଼ିଆ" + case LanguageOS: + return "ирон æвзаг" + case LanguagePA: + return "ਪੰਜਾਬੀ" + case LanguagePI: + return "पाऴि" + case LanguagePL: + return "Polski" + case LanguagePS: + return "پښتو" + case LanguagePT: + return "Português" + case LanguageQU: + return "Runa Simi" + case LanguageRM: + return "Rumantsch grischun" + case LanguageRN: + return "Ikirundi" + case LanguageRO: + return "Română" + case LanguageRU: + return "Русский" + case LanguageRW: + return "Ikinyarwanda" + case LanguageSA: + return "संस्कृतम्" + case LanguageSC: + return "Sardu" + case LanguageSD: + return "सिन्धी" + case LanguageSE: + return "Davvisámegiella" + case LanguageSG: + return "Yângâ tî sängö" + case LanguageSI: + return "සිංහල" + case LanguageSK: + return "Slovenčina" + case LanguageSL: + return "Slovenščina" + case LanguageSM: + return "Gagana fa'a Samoa" + case LanguageSN: + return "chiShona" + case LanguageSO: + return "Soomaaliga" + case LanguageSQ: + return "Shqip" + case LanguageSR: + return "Српски" + case LanguageSS: + return "SiSwati" + case LanguageST: + return "Sesotho" + case LanguageSU: + return "Basa Sunda" + case LanguageSV: + return "Svenska" + case LanguageSW: + return "Kiswahili" + case LanguageTA: + return "தமிழ்" + case LanguageTE: + return "తెలుగు" + case LanguageTG: + return "тоҷикӣ" + case LanguageTH: + return "ไทย" + case LanguageTI: + return "ትግርኛ" + case LanguageTK: + return "Türkmen" + case LanguageTL: + return "Wikang Tagalog" + case LanguageTN: + return "Setswana" + case LanguageTO: + return "lea faka-Tonga" + case LanguageTR: + return "Türkçe" + case LanguageTS: + return "Xitsonga" + case LanguageTT: + return "татар теле" + case LanguageTW: + return "Twi" + case LanguageTY: + return "Reo Tahiti" + case LanguageUG: + return "ئۇيغۇرچە" + case LanguageUK: + return "українська" + case LanguageUR: + return "اردو" + case LanguageUZ: + return "Oʻzbek" + case LanguageVE: + return "Tshivenḓa" + case LanguageVI: + return "Tiếng Việt" + case LanguageVO: + return "Volapük" + case LanguageWA: + return "walon" + case LanguageWO: + return "Wollof" + case LanguageXH: + return "isiXhosa" + case LanguageYI: + return "ייִדיש" + case LanguageYO: + return "Yorùbá" + case LanguageZA: + return "Saɯ cueŋƅ" + case LanguageZH: + return "中文" + case LanguageZU: + return "isiZulu" + } + return "unknown" +} + func (lc LanguageCode) IsValid() bool { return lc.String() != UnknownLanguageCode } From cbbe2243951eb126d2e83621ece12f85cd0e4dba Mon Sep 17 00:00:00 2001 From: Daniel Hilton Date: Thu, 14 Nov 2024 13:46:58 +0000 Subject: [PATCH 5/5] :recycle: Return multiple languages for a country, add some extra missing languages --- countries.go | 689 ++++++++++++++++++++-------------------------- languages.go | 42 ++- languagesconst.go | 373 ++++++++++++------------- 3 files changed, 515 insertions(+), 589 deletions(-) diff --git a/countries.go b/countries.go index 649ac5b..34bcbe1 100644 --- a/countries.go +++ b/countries.go @@ -4894,513 +4894,412 @@ func (c CountryCode) Region() RegionCode { //nolint:gocyclo return RegionUnknown } -// Language - return language code of country -func (c CountryCode) Language() LanguageCode { //nolint:gocyclo +// Languages - return language codes for a country +func (c CountryCode) Languages() []LanguageCode { //nolint:gocyclo switch c { case AUS: - return LanguageEN + return []LanguageCode{LanguageEN} case AUT: - return LanguageDE + return []LanguageCode{LanguageDE} case AZE: - return LanguageAZ + return []LanguageCode{LanguageAZ} case ALB: - return LanguageSQ + return []LanguageCode{LanguageSQ} case DZA: - return LanguageAR + return []LanguageCode{LanguageAR} case ASM: - return LanguageSM + return []LanguageCode{LanguageEN, LanguageSM} case AIA: - return LanguageEN + return []LanguageCode{LanguageEN} case AGO: - return LanguagePT + return []LanguageCode{LanguagePT} case AND: - return LanguageCA + return []LanguageCode{LanguageCA} case ATA: - return LanguageEN + return []LanguageCode{LanguageEN, LanguageFR} case ATG: - return LanguageEN - case ARE: - return LanguageAR + return []LanguageCode{LanguageEN} case ARG: - return LanguageES + return []LanguageCode{LanguageES} case ARM: - return LanguageHY + return []LanguageCode{LanguageHY} case ABW: - return LanguageNL + return []LanguageCode{LanguageNL, LanguagePA} case AFG: - return LanguageFA + return []LanguageCode{LanguagePS, LanguageUZ, LanguageTK} case BHS: - return LanguageEN + return []LanguageCode{LanguageEN} case BGD: - return LanguageBN + return []LanguageCode{LanguageBN} case BRB: - return LanguageEN + return []LanguageCode{LanguageEN} case BHR: - return LanguageAR + return []LanguageCode{LanguageAR} case BLR: - return LanguageBE + return []LanguageCode{LanguageBE, LanguageRU} case BLZ: - return LanguageEN + return []LanguageCode{LanguageEN} case BEL: - return LanguageNL + return []LanguageCode{LanguageNL, LanguageFR, LanguageDE} case BEN: - return LanguageFR + return []LanguageCode{LanguageFR} case BMU: - return LanguageEN + return []LanguageCode{LanguageEN} case BGR: - return LanguageBG + return []LanguageCode{LanguageBG} case BOL: - return LanguageES + return []LanguageCode{LanguageES, LanguageAY, LanguageQU} case BIH: - return LanguageBS + return []LanguageCode{LanguageBS, LanguageHR, LanguageSR} case BWA: - return LanguageEN + return []LanguageCode{LanguageEN, LanguageTN} case BRA: - return LanguagePT - case IOT: - return LanguageEN + return []LanguageCode{LanguagePT} case BRN: - return LanguageMS + return []LanguageCode{LanguageMS} case BFA: - return LanguageFR + return []LanguageCode{LanguageFR} case BDI: - return LanguageFR - case BTN: - return LanguageDZ - case VUT: - return LanguageBI - case VAT: - return LanguageIT - case GBR: - return LanguageEN - case HUN: - return LanguageHU - case VEN: - return LanguageES - case VGB: - return LanguageEN - case VIR: - return LanguageEN - case TLS: - return LanguagePT - case VNM: - return LanguageVI + return []LanguageCode{LanguageFR, LanguageRN} + case CPV: + return []LanguageCode{LanguagePT} + case KHM: + return []LanguageCode{LanguageKM} + case CMR: + return []LanguageCode{LanguageEN, LanguageFR} + case CAN: + return []LanguageCode{LanguageEN, LanguageFR} + case CAF: + return []LanguageCode{LanguageFR, LanguageSG} + case TCD: + return []LanguageCode{LanguageFR, LanguageAR} + case CHL: + return []LanguageCode{LanguageES} + case CHN: + return []LanguageCode{LanguageZH} + case COL: + return []LanguageCode{LanguageES} + case COM: + return []LanguageCode{LanguageAR, LanguageFR, LanguageCO} + case COG: + return []LanguageCode{LanguageFR} + case CRI: + return []LanguageCode{LanguageES} + case HRV: + return []LanguageCode{LanguageHR} + case CUB: + return []LanguageCode{LanguageES} + case CYP: + return []LanguageCode{LanguageEL, LanguageTR} + case CZE: + return []LanguageCode{LanguageCS} + case DNK: + return []LanguageCode{LanguageDA} + case DJI: + return []LanguageCode{LanguageFR, LanguageAR} + case DMA: + return []LanguageCode{LanguageEN} + case DOM: + return []LanguageCode{LanguageES} + case ECU: + return []LanguageCode{LanguageES} + case EGY: + return []LanguageCode{LanguageAR} + case SLV: + return []LanguageCode{LanguageES} + case GNQ: + return []LanguageCode{LanguageES, LanguageFR, LanguagePT} + case ERI: + return []LanguageCode{LanguageTI, LanguageAR, LanguageEN} + case EST: + return []LanguageCode{LanguageET} + case SWZ: + return []LanguageCode{LanguageEN, LanguageSS} + case ETH: + return []LanguageCode{LanguageAM} + case FJI: + return []LanguageCode{LanguageEN, LanguageFJ, LanguageHI} + case FIN: + return []LanguageCode{LanguageFI, LanguageSV} + case FRA: + return []LanguageCode{LanguageFR} case GAB: - return LanguageFR - case HTI: - return LanguageHT - case GUY: - return LanguageEN + return []LanguageCode{LanguageFR} case GMB: - return LanguageEN + return []LanguageCode{LanguageEN} + case GEO: + return []LanguageCode{LanguageKA} + case DEU: + return []LanguageCode{LanguageDE} case GHA: - return LanguageEN - case GLP: - return LanguageFR + return []LanguageCode{LanguageEN} + case GRC: + return []LanguageCode{LanguageEL} + case GRL: + return []LanguageCode{LanguageKL} + case GRD: + return []LanguageCode{LanguageEN} case GTM: - return LanguageES + return []LanguageCode{LanguageES} case GIN: - return LanguageFR + return []LanguageCode{LanguageFR} case GNB: - return LanguagePT - case DEU: - return LanguageDE - case GIB: - return LanguageEN + return []LanguageCode{LanguagePT} + case GUY: + return []LanguageCode{LanguageEN} + case HTI: + return []LanguageCode{LanguageFR, LanguageHT} case HND: - return LanguageES - case HKG: - return LanguageZH - case GRD: - return LanguageEN - case GRL: - return LanguageKL - case GRC: - return LanguageEL - case GEO: - return LanguageKA - case GUM: - return LanguageEN - case DNK: - return LanguageDA - case COD: - return LanguageFR - case DJI: - return LanguageFR - case DMA: - return LanguageEN - case DOM: - return LanguageES - case EGY: - return LanguageAR - case ZMB: - return LanguageEN - case ESH: - return LanguageAR - case ZWE: - return LanguageEN - case ISR: - return LanguageHE + return []LanguageCode{LanguageES} + case HUN: + return []LanguageCode{LanguageHU} + case ISL: + return []LanguageCode{LanguageIS} case IND: - return LanguageHI + return []LanguageCode{LanguageHI, LanguageEN} case IDN: - return LanguageID - case JOR: - return LanguageAR - case IRQ: - return LanguageAR + return []LanguageCode{LanguageID} case IRN: - return LanguageFA + return []LanguageCode{LanguageFA} + case IRQ: + return []LanguageCode{LanguageAR, LanguageKU} case IRL: - return LanguageEN - case ISL: - return LanguageIS - case ESP: - return LanguageES + return []LanguageCode{LanguageEN, LanguageGA} + case ISR: + return []LanguageCode{LanguageHE, LanguageAR} case ITA: - return LanguageIT - case YEM: - return LanguageAR + return []LanguageCode{LanguageIT} + case CIV: + return []LanguageCode{LanguageFR} + case JAM: + return []LanguageCode{LanguageEN} + case JPN: + return []LanguageCode{LanguageJA} + case JOR: + return []LanguageCode{LanguageAR} case KAZ: - return LanguageKK - case CYM: - return LanguageEN - case KHM: - return LanguageKM - case CMR: - return LanguageFR - case CAN: - return LanguageEN - case QAT: - return LanguageAR + return []LanguageCode{LanguageKK, LanguageRU} case KEN: - return LanguageEN - case CYP: - return LanguageEL + return []LanguageCode{LanguageEN, LanguageSW} case KIR: - return LanguageEN - case CHN: - return LanguageZH - case CCK: - return LanguageEN - case COL: - return LanguageES - case COM: - return LanguageFR - case COG: - return LanguageFR + return []LanguageCode{LanguageEN} case PRK: - return LanguageKO + return []LanguageCode{LanguageKO} case KOR: - return LanguageKO - case CRI: - return LanguageES - case CIV: - return LanguageFR - case CUB: - return LanguageES + return []LanguageCode{LanguageKO} case KWT: - return LanguageAR + return []LanguageCode{LanguageAR} case KGZ: - return LanguageKY + return []LanguageCode{LanguageKY, LanguageRU} case LAO: - return LanguageLO + return []LanguageCode{LanguageLO} case LVA: - return LanguageLV + return []LanguageCode{LanguageLV} + case LBN: + return []LanguageCode{LanguageAR} case LSO: - return LanguageEN + return []LanguageCode{LanguageEN, LanguageST} case LBR: - return LanguageEN - case LBN: - return LanguageAR + return []LanguageCode{LanguageEN} case LBY: - return LanguageAR - case LTU: - return LanguageLT + return []LanguageCode{LanguageAR} case LIE: - return LanguageDE + return []LanguageCode{LanguageDE} + case LTU: + return []LanguageCode{LanguageLT} case LUX: - return LanguageLU - case MUS: - return LanguageEN - case MRT: - return LanguageAR + return []LanguageCode{LanguageLU, LanguageFR, LanguageDE} case MDG: - return LanguageFR - case MYT: - return LanguageFR - case MAC: - return LanguageZH - case MKD: - return LanguageMK + return []LanguageCode{LanguageFR, LanguageMG} case MWI: - return LanguageEN + return []LanguageCode{LanguageEN, LanguageNY} case MYS: - return LanguageMS - case MLI: - return LanguageFR + return []LanguageCode{LanguageMS} case MDV: - return LanguageDV + return []LanguageCode{LanguageDV} + case MLI: + return []LanguageCode{LanguageFR} case MLT: - return LanguageMT - case MNP: - return LanguageEN - case MAR: - return LanguageAR - case MTQ: - return LanguageFR + return []LanguageCode{LanguageMT, LanguageEN} case MHL: - return LanguageEN + return []LanguageCode{LanguageEN, LanguageMH} + case MRT: + return []LanguageCode{LanguageAR} + case MUS: + return []LanguageCode{LanguageEN} case MEX: - return LanguageES + return []LanguageCode{LanguageES} case FSM: - return LanguageEN - case MOZ: - return LanguagePT + return []LanguageCode{LanguageEN} case MDA: - return LanguageRO + return []LanguageCode{LanguageRO} case MCO: - return LanguageFR + return []LanguageCode{LanguageFR} case MNG: - return LanguageMN + return []LanguageCode{LanguageMN} + case MNE: + return []LanguageCode{LanguageSR} case MSR: - return LanguageEN + return []LanguageCode{LanguageEN} + case MAR: + return []LanguageCode{LanguageAR} + case MOZ: + return []LanguageCode{LanguagePT} case MMR: - return LanguageMY + return []LanguageCode{LanguageMY} case NAM: - return LanguageEN + return []LanguageCode{LanguageEN} case NRU: - return LanguageEN + return []LanguageCode{LanguageEN, LanguageNA} case NPL: - return LanguageNE - case NER: - return LanguageFR - case NGA: - return LanguageEN + return []LanguageCode{LanguageNE} case NLD: - return LanguageNL + return []LanguageCode{LanguageNL} + case NZL: + return []LanguageCode{LanguageEN, LanguageMI} case NIC: - return LanguageES + return []LanguageCode{LanguageES} + case NER: + return []LanguageCode{LanguageFR} + case NGA: + return []LanguageCode{LanguageEN} case NIU: - return LanguageEN - case NZL: - return LanguageEN - case NCL: - return LanguageFR + return []LanguageCode{LanguageEN} + case MKD: + return []LanguageCode{LanguageMK} case NOR: - return LanguageNO + return []LanguageCode{LanguageNO} case OMN: - return LanguageAR - case BVT: - return LanguageNO - case IMN: - return LanguageEN - case NFK: - return LanguageEN - case PCN: - return LanguageEN - case CXR: - return LanguageEN - case SHN: - return LanguageEN - case WLF: - return LanguageFR - case HMD: - return LanguageEN - case CPV: - return LanguagePT - case COK: - return LanguageEN - case WSM: - return LanguageSM - case SJM: - return LanguageNO - case TCA: - return LanguageEN - case UMI: - return LanguageEN + return []LanguageCode{LanguageAR} case PAK: - return LanguageUR + return []LanguageCode{LanguageEN, LanguageUR} case PLW: - return LanguageEN - case PSE: - return LanguageAR + return []LanguageCode{LanguageEN} case PAN: - return LanguageES + return []LanguageCode{LanguageES} case PNG: - return LanguageEN + return []LanguageCode{LanguageEN, LanguageHO} case PRY: - return LanguageES + return []LanguageCode{LanguageES, LanguageGN} case PER: - return LanguageES + return []LanguageCode{LanguageES} + case PHL: + return []LanguageCode{LanguageEN, LanguageTL} case POL: - return LanguagePL + return []LanguageCode{LanguagePL} case PRT: - return LanguagePT + return []LanguageCode{LanguagePT} case PRI: - return LanguageES - case REU: - return LanguageFR + return []LanguageCode{LanguageES, LanguageEN} + case QAT: + return []LanguageCode{LanguageAR} + case ROU: + return []LanguageCode{LanguageRO} case RUS: - return LanguageRU + return []LanguageCode{LanguageRU} case RWA: - return LanguageRW - case ROU: - return LanguageRO - case SLV: - return LanguageES + return []LanguageCode{LanguageRW, LanguageFR, LanguageEN} + case KNA: + return []LanguageCode{LanguageEN} + case LCA: + return []LanguageCode{LanguageEN} + case VCT: + return []LanguageCode{LanguageEN} case SMR: - return LanguageIT - case STP: - return LanguagePT + return []LanguageCode{LanguageIT} case SAU: - return LanguageAR - case SWZ: - return LanguageEN - case SYC: - return LanguageFR + return []LanguageCode{LanguageAR} case SEN: - return LanguageFR - case SPM: - return LanguageFR - case VCT: - return LanguageEN - case KNA: - return LanguageEN - case LCA: - return LanguageEN + return []LanguageCode{LanguageFR} + case SRB: + return []LanguageCode{LanguageSR} + case SYC: + return []LanguageCode{LanguageFR, LanguageEN, LanguageCR} + case SLE: + return []LanguageCode{LanguageEN} case SGP: - return LanguageEN - case SYR: - return LanguageAR + return []LanguageCode{LanguageEN, LanguageMS, LanguageTA, LanguageZH} case SVK: - return LanguageSK + return []LanguageCode{LanguageSK} case SVN: - return LanguageSL - case USA: - return LanguageEN + return []LanguageCode{LanguageSL} case SLB: - return LanguageEN + return []LanguageCode{LanguageEN} case SOM: - return LanguageSO + return []LanguageCode{LanguageSO, LanguageAR} + case ZAF: + return []LanguageCode{LanguageAF, LanguageEN, LanguageNR, LanguageST, LanguageTN, LanguageTS, LanguageVE, LanguageXH, LanguageZU} + case SSD: + return []LanguageCode{LanguageEN} + case ESP: + return []LanguageCode{LanguageES} + case LKA: + return []LanguageCode{LanguageSI, LanguageTA} case SDN: - return LanguageAR + return []LanguageCode{LanguageAR, LanguageEN} case SUR: - return LanguageNL - case SLE: - return LanguageEN - case TJK: - return LanguageTG + return []LanguageCode{LanguageNL} + case SWE: + return []LanguageCode{LanguageSV} + case CHE: + return []LanguageCode{LanguageDE, LanguageFR, LanguageIT, LanguageRM} + case SYR: + return []LanguageCode{LanguageAR} case TWN: - return LanguageZH - case THA: - return LanguageTH + return []LanguageCode{LanguageZH} + case TJK: + return []LanguageCode{LanguageTG, LanguageRU} case TZA: - return LanguageSW + return []LanguageCode{LanguageSW, LanguageEN} + case THA: + return []LanguageCode{LanguageTH} + case TLS: + return []LanguageCode{LanguagePT, LanguageTE} case TGO: - return LanguageFR - case TKL: - return LanguageEN + return []LanguageCode{LanguageFR} case TON: - return LanguageTO + return []LanguageCode{LanguageTO, LanguageEN} case TTO: - return LanguageEN - case TUV: - return LanguageEN + return []LanguageCode{LanguageEN} case TUN: - return LanguageAR - case TKM: - return LanguageTK + return []LanguageCode{LanguageAR} case TUR: - return LanguageTR + return []LanguageCode{LanguageTR} + case TKM: + return []LanguageCode{LanguageTK, LanguageRU} + case TUV: + return []LanguageCode{LanguageEN} case UGA: - return LanguageEN - case UZB: - return LanguageUZ + return []LanguageCode{LanguageEN} case UKR: - return LanguageUK + return []LanguageCode{LanguageUK} + case ARE: + return []LanguageCode{LanguageAR} + case GBR: + return []LanguageCode{LanguageEN} + case USA: + return []LanguageCode{LanguageEN} case URY: - return LanguageES - case FRO: - return LanguageFO - case FJI: - return LanguageEN - case PHL: - return LanguageTL - case FIN: - return LanguageFI - case FLK: - return LanguageEN - case FRA: - return LanguageFR - case GUF: - return LanguageFR - case PYF: - return LanguageFR - case ATF: - return LanguageFR - case HRV: - return LanguageHR - case CAF: - return LanguageFR - case TCD: - return LanguageFR - case CZE: - return LanguageCS - case CHL: - return LanguageES - case CHE: - return LanguageDE - case SWE: - return LanguageSV - case LKA: - return LanguageSI - case ECU: - return LanguageES - case GNQ: - return LanguageES - case ERI: - return LanguageTI - case EST: - return LanguageET - case ETH: - return LanguageAM - case ZAF: - return LanguageAF - case YUG: - return LanguageSR - case SGS: - return LanguageEN - case JAM: - return LanguageEN - case MNE: - return LanguageSR - case BLM: - return LanguageFR - case SXM: - return LanguageNL - case SRB: - return LanguageSR - case ALA: - return LanguageSV - case BES: - return LanguageNL - case GGY: - return LanguageEN - case JEY: - return LanguageEN - case CUW: - return LanguageNL - case MAF: - return LanguageFR - case SSD: - return LanguageEN - case XKX: - return LanguageSQ - case JPN: - return LanguageJA + return []LanguageCode{LanguageES} + case UZB: + return []LanguageCode{LanguageUZ} + case VUT: + return []LanguageCode{LanguageBI, LanguageEN, LanguageFR} + case VEN: + return []LanguageCode{LanguageES} + case VNM: + return []LanguageCode{LanguageVI} + case WSM: + return []LanguageCode{LanguageSM, LanguageEN} + case YEM: + return []LanguageCode{LanguageAR} + case ZMB: + return []LanguageCode{LanguageEN} + case ZWE: + return []LanguageCode{LanguageEN, LanguageSN, LanguageND} + default: + return []LanguageCode{} } - return LanguageUnknown } // Capital - return a capital of country diff --git a/languages.go b/languages.go index fa0c263..6c944ae 100644 --- a/languages.go +++ b/languages.go @@ -254,6 +254,8 @@ func (lc LanguageCode) String() string { //nolint:gocyclo return "Norwegian Nynorsk" case LanguageNO: return "Norwegian" + case LanguageNR: + return "South Ndebele" case LanguageNS: return "Northern Sotho" case LanguageNV: @@ -352,6 +354,8 @@ func (lc LanguageCode) String() string { //nolint:gocyclo return "Tsonga" case LanguageTT: return "Tatar" + case LanguageTVL: + return "Tuvaluan" case LanguageTW: return "Twi" case LanguageTY: @@ -392,7 +396,11 @@ func (lc LanguageCode) String() string { //nolint:gocyclo } func (lc LanguageCode) Alpha2() string { - return string(lc) + if len(string(lc)) == 2 { + return string(lc) + } + + return "unknown" } func (lc LanguageCode) Alpha3() string { @@ -633,6 +641,8 @@ func (lc LanguageCode) Alpha3() string { return "nno" case LanguageNO: return "nor" + case LanguageNR: + return "nbl" case LanguageNS: return "nso" case LanguageNV: @@ -733,6 +743,8 @@ func (lc LanguageCode) Alpha3() string { return "tat" case LanguageTW: return "twi" + case LanguageTVL: + return "tvl" case LanguageTY: return "tah" case LanguageUG: @@ -1009,6 +1021,8 @@ func (lc LanguageCode) StringRus() string { //nolint:gocyclo return "Норвежский нюнорск" case LanguageNO: return "Норвежский" + case LanguageNR: + return "Южный ндебеле" case LanguageNS: return "Северный сото" case LanguageNV: @@ -1109,6 +1123,8 @@ func (lc LanguageCode) StringRus() string { //nolint:gocyclo return "Татарский" case LanguageTW: return "Тви" + case LanguageTVL: + return "тувалуанский" case LanguageTY: return "Таитянский" case LanguageUG: @@ -1374,7 +1390,7 @@ func (lc LanguageCode) StringLocal() string { case LanguageNB: return "Norsk bokmål" case LanguageND: - return "isiNdebele" + return "Ndebele" case LanguageNE: return "नेपाली" case LanguageNG: @@ -1385,6 +1401,8 @@ func (lc LanguageCode) StringLocal() string { return "Norsk nynorsk" case LanguageNO: return "Norsk" + case LanguageNR: + return "isiNdebele" case LanguageNS: return "Sesotho sa Leboa" case LanguageNV: @@ -1485,6 +1503,8 @@ func (lc LanguageCode) StringLocal() string { return "татар теле" case LanguageTW: return "Twi" + case LanguageTVL: + return "Te Ggana Tuuvalu" case LanguageTY: return "Reo Tahiti" case LanguageUG: @@ -1568,13 +1588,13 @@ func AllLanguages() []LanguageCode { LanguageIT, LanguageIU, LanguageJA, LanguageJV, LanguageKA, LanguageKG, LanguageKI, LanguageKJ, LanguageKK, LanguageKL, LanguageKM, LanguageKN, LanguageKO, LanguageKR, LanguageKS, LanguageKU, LanguageKV, LanguageKW, LanguageKY, LanguageLA, LanguageLB, LanguageLG, LanguageLI, LanguageLN, LanguageLO, LanguageLT, LanguageLU, LanguageLV, LanguageMG, LanguageMH, LanguageMI, LanguageMK, LanguageML, LanguageMN, LanguageMR, LanguageMS, - LanguageMT, LanguageMY, LanguageNA, LanguageNB, LanguageND, LanguageNE, LanguageNG, LanguageNL, LanguageNN, LanguageNO, LanguageNS, LanguageNV, - LanguageNY, LanguageOC, LanguageOJ, LanguageOM, LanguageOR, LanguageOS, LanguagePA, LanguagePI, LanguagePL, LanguagePS, LanguagePT, LanguageQU, - LanguageRM, LanguageRN, LanguageRO, LanguageRU, LanguageRW, LanguageSA, LanguageSC, LanguageSD, LanguageSE, LanguageSG, LanguageSI, LanguageSK, - LanguageSL, LanguageSM, LanguageSN, LanguageSO, LanguageSQ, LanguageSR, LanguageSS, LanguageST, LanguageSU, LanguageSV, LanguageSW, LanguageTA, - LanguageTE, LanguageTG, LanguageTH, LanguageTI, LanguageTK, LanguageTL, LanguageTN, LanguageTO, LanguageTR, LanguageTS, LanguageTT, LanguageTW, - LanguageTY, LanguageUG, LanguageUK, LanguageUR, LanguageUZ, LanguageVE, LanguageVI, LanguageVO, LanguageWA, LanguageWO, LanguageXH, LanguageYI, - LanguageYO, LanguageZA, LanguageZH, LanguageZU, + LanguageMT, LanguageMY, LanguageNA, LanguageNB, LanguageND, LanguageNE, LanguageNG, LanguageNL, LanguageNN, LanguageNO, LanguageNR, LanguageNS, + LanguageNV, LanguageNY, LanguageOC, LanguageOJ, LanguageOM, LanguageOR, LanguageOS, LanguagePA, LanguagePI, LanguagePL, LanguagePS, LanguagePT, + LanguageQU, LanguageRM, LanguageRN, LanguageRO, LanguageRU, LanguageRW, LanguageSA, LanguageSC, LanguageSD, LanguageSE, LanguageSG, LanguageSI, + LanguageSK, LanguageSL, LanguageSM, LanguageSN, LanguageSO, LanguageSQ, LanguageSR, LanguageSS, LanguageST, LanguageSU, LanguageSV, LanguageSW, + LanguageTA, LanguageTE, LanguageTG, LanguageTH, LanguageTI, LanguageTK, LanguageTL, LanguageTN, LanguageTO, LanguageTR, LanguageTS, LanguageTT, + LanguageTW, LanguageTVL, LanguageTY, LanguageUG, LanguageUK, LanguageUR, LanguageUZ, LanguageVE, LanguageVI, LanguageVO, LanguageWA, LanguageWO, + LanguageXH, LanguageYI, LanguageYO, LanguageZA, LanguageZH, LanguageZU, } } @@ -1825,6 +1845,8 @@ func LanguageCodeByName(name string) LanguageCode { //nolint:gocyclo return LanguageNN case "NO", "NORWEGIAN": return LanguageNO + case "NR", "SOUTHNDEBELE": + return LanguageNR case "NS", "NORTHERNSOTHO": return LanguageNS case "NV", "NAVAJO": @@ -1925,6 +1947,8 @@ func LanguageCodeByName(name string) LanguageCode { //nolint:gocyclo return LanguageTT case "TW", "TWI": return LanguageTW + case "TVL", "TUVALUAN": + return LanguageTVL case "TY", "TAHITIAN": return LanguageTY case "UG", "UIGHUR": diff --git a/languagesconst.go b/languagesconst.go index fdb1f2f..72abfdb 100644 --- a/languagesconst.go +++ b/languagesconst.go @@ -130,7 +130,7 @@ const ( LanguageDutch LanguageCode = "nl" LanguageNorwegianNynorsk LanguageCode = "nn" LanguageNorwegian LanguageCode = "no" - LanguageSouthNdebele LanguageCode = "ns" + LanguageSouthNdebele LanguageCode = "nr" LanguageNavajo LanguageCode = "nv" LanguageChichewa LanguageCode = "ny" LanguageOccitan LanguageCode = "oc" @@ -181,6 +181,7 @@ const ( LanguageTatar LanguageCode = "tt" LanguageTwi LanguageCode = "tw" LanguageTahitian LanguageCode = "ty" + LanguageTuvaluan LanguageCode = "tvl" LanguageUighur LanguageCode = "ug" LanguageUkrainian LanguageCode = "uk" LanguageUrdu LanguageCode = "ur" @@ -200,188 +201,190 @@ const ( // ISO 639-1 language code name, 2 codes present e.g. LanguageRU == LanguageRussian = "ru". const ( - LanguageAA LanguageCode = "aa" - LanguageAB LanguageCode = "ab" - LanguageAE LanguageCode = "ae" - LanguageAF LanguageCode = "af" - LanguageAK LanguageCode = "ak" - LanguageAM LanguageCode = "am" - LanguageAN LanguageCode = "an" - LanguageAR LanguageCode = "ar" - LanguageAS LanguageCode = "as" - LanguageAV LanguageCode = "av" - LanguageAY LanguageCode = "ay" - LanguageAZ LanguageCode = "az" - LanguageBA LanguageCode = "ba" - LanguageBE LanguageCode = "be" - LanguageBG LanguageCode = "bg" - LanguageBH LanguageCode = "bh" - LanguageBI LanguageCode = "bi" - LanguageBM LanguageCode = "bm" - LanguageBN LanguageCode = "bn" - LanguageBO LanguageCode = "bo" - LanguageBR LanguageCode = "br" - LanguageBS LanguageCode = "bs" - LanguageCA LanguageCode = "ca" - LanguageCE LanguageCode = "ce" - LanguageCH LanguageCode = "ch" - LanguageCO LanguageCode = "co" - LanguageCR LanguageCode = "cr" - LanguageCS LanguageCode = "cs" - LanguageCU LanguageCode = "cu" - LanguageCV LanguageCode = "cv" - LanguageCY LanguageCode = "cy" - LanguageDA LanguageCode = "da" - LanguageDE LanguageCode = "de" - LanguageDV LanguageCode = "dv" - LanguageDZ LanguageCode = "dz" - LanguageEE LanguageCode = "ee" - LanguageEL LanguageCode = "el" - LanguageEN LanguageCode = "en" - LanguageEO LanguageCode = "eo" - LanguageES LanguageCode = "es" - LanguageET LanguageCode = "et" - LanguageEU LanguageCode = "eu" - LanguageFA LanguageCode = "fa" - LanguageFF LanguageCode = "ff" - LanguageFI LanguageCode = "fi" - LanguageFJ LanguageCode = "fj" - LanguageFO LanguageCode = "fo" - LanguageFR LanguageCode = "fr" - LanguageFY LanguageCode = "fy" - LanguageGA LanguageCode = "ga" - LanguageGD LanguageCode = "gd" - LanguageGL LanguageCode = "gl" - LanguageGN LanguageCode = "gn" - LanguageGU LanguageCode = "gu" - LanguageGV LanguageCode = "gv" - LanguageHA LanguageCode = "ha" - LanguageHE LanguageCode = "he" - LanguageHI LanguageCode = "hi" - LanguageHO LanguageCode = "ho" - LanguageHR LanguageCode = "hr" - LanguageHT LanguageCode = "ht" - LanguageHU LanguageCode = "hu" - LanguageHY LanguageCode = "hy" - LanguageHZ LanguageCode = "hz" - LanguageIA LanguageCode = "ia" - LanguageID LanguageCode = "id" - LanguageIE LanguageCode = "ie" - LanguageIG LanguageCode = "ig" - LanguageII LanguageCode = "ii" - LanguageIK LanguageCode = "ik" - LanguageIO LanguageCode = "io" - LanguageIS LanguageCode = "is" - LanguageIT LanguageCode = "it" - LanguageIU LanguageCode = "iu" - LanguageJA LanguageCode = "ja" - LanguageJV LanguageCode = "jv" - LanguageKA LanguageCode = "ka" - LanguageKG LanguageCode = "kg" - LanguageKI LanguageCode = "ki" - LanguageKJ LanguageCode = "kj" - LanguageKK LanguageCode = "kk" - LanguageKL LanguageCode = "kl" - LanguageKM LanguageCode = "km" - LanguageKN LanguageCode = "kn" - LanguageKO LanguageCode = "ko" - LanguageKR LanguageCode = "kr" - LanguageKS LanguageCode = "ks" - LanguageKU LanguageCode = "ku" - LanguageKV LanguageCode = "kv" - LanguageKW LanguageCode = "kw" - LanguageKY LanguageCode = "ky" - LanguageLA LanguageCode = "la" - LanguageLB LanguageCode = "lb" - LanguageLG LanguageCode = "lg" - LanguageLI LanguageCode = "li" - LanguageLN LanguageCode = "ln" - LanguageLO LanguageCode = "lo" - LanguageLT LanguageCode = "lt" - LanguageLU LanguageCode = "lu" - LanguageLV LanguageCode = "lv" - LanguageMG LanguageCode = "mg" - LanguageMH LanguageCode = "mh" - LanguageMI LanguageCode = "mi" - LanguageMK LanguageCode = "mk" - LanguageML LanguageCode = "ml" - LanguageMN LanguageCode = "mn" - LanguageMR LanguageCode = "mr" - LanguageMS LanguageCode = "ms" - LanguageMT LanguageCode = "mt" - LanguageMY LanguageCode = "my" - LanguageNA LanguageCode = "na" - LanguageNB LanguageCode = "nb" - LanguageND LanguageCode = "nd" - LanguageNE LanguageCode = "ne" - LanguageNG LanguageCode = "ng" - LanguageNL LanguageCode = "nl" - LanguageNN LanguageCode = "nn" - LanguageNO LanguageCode = "no" - LanguageNS LanguageCode = "ns" - LanguageNV LanguageCode = "nv" - LanguageNY LanguageCode = "ny" - LanguageOC LanguageCode = "oc" - LanguageOJ LanguageCode = "oj" - LanguageOM LanguageCode = "om" - LanguageOR LanguageCode = "or" - LanguageOS LanguageCode = "os" - LanguagePA LanguageCode = "pa" - LanguagePI LanguageCode = "pi" - LanguagePL LanguageCode = "pl" - LanguagePS LanguageCode = "ps" - LanguagePT LanguageCode = "pt" - LanguageQU LanguageCode = "qu" - LanguageRM LanguageCode = "rm" - LanguageRN LanguageCode = "rn" - LanguageRO LanguageCode = "ro" - LanguageRU LanguageCode = "ru" - LanguageRW LanguageCode = "rw" - LanguageSA LanguageCode = "sa" - LanguageSC LanguageCode = "sc" - LanguageSD LanguageCode = "sd" - LanguageSE LanguageCode = "se" - LanguageSG LanguageCode = "sg" - LanguageSI LanguageCode = "si" - LanguageSK LanguageCode = "sk" - LanguageSL LanguageCode = "sl" - LanguageSM LanguageCode = "sm" - LanguageSN LanguageCode = "sn" - LanguageSO LanguageCode = "so" - LanguageSQ LanguageCode = "sq" - LanguageSR LanguageCode = "sr" - LanguageSS LanguageCode = "ss" - LanguageST LanguageCode = "st" - LanguageSU LanguageCode = "su" - LanguageSV LanguageCode = "sv" - LanguageSW LanguageCode = "sw" - LanguageTA LanguageCode = "ta" - LanguageTE LanguageCode = "te" - LanguageTG LanguageCode = "tg" - LanguageTH LanguageCode = "th" - LanguageTI LanguageCode = "ti" - LanguageTK LanguageCode = "tk" - LanguageTL LanguageCode = "tl" - LanguageTN LanguageCode = "tn" - LanguageTO LanguageCode = "to" - LanguageTR LanguageCode = "tr" - LanguageTS LanguageCode = "ts" - LanguageTT LanguageCode = "tt" - LanguageTW LanguageCode = "tw" - LanguageTY LanguageCode = "ty" - LanguageUG LanguageCode = "ug" - LanguageUK LanguageCode = "uk" - LanguageUR LanguageCode = "ur" - LanguageUZ LanguageCode = "uz" - LanguageVE LanguageCode = "ve" - LanguageVI LanguageCode = "vi" - LanguageVO LanguageCode = "vo" - LanguageWA LanguageCode = "wa" - LanguageWO LanguageCode = "wo" - LanguageXH LanguageCode = "xh" - LanguageYI LanguageCode = "yi" - LanguageYO LanguageCode = "yo" - LanguageZA LanguageCode = "za" - LanguageZH LanguageCode = "zh" - LanguageZU LanguageCode = "zu" + LanguageAA LanguageCode = "aa" + LanguageAB LanguageCode = "ab" + LanguageAE LanguageCode = "ae" + LanguageAF LanguageCode = "af" + LanguageAK LanguageCode = "ak" + LanguageAM LanguageCode = "am" + LanguageAN LanguageCode = "an" + LanguageAR LanguageCode = "ar" + LanguageAS LanguageCode = "as" + LanguageAV LanguageCode = "av" + LanguageAY LanguageCode = "ay" + LanguageAZ LanguageCode = "az" + LanguageBA LanguageCode = "ba" + LanguageBE LanguageCode = "be" + LanguageBG LanguageCode = "bg" + LanguageBH LanguageCode = "bh" + LanguageBI LanguageCode = "bi" + LanguageBM LanguageCode = "bm" + LanguageBN LanguageCode = "bn" + LanguageBO LanguageCode = "bo" + LanguageBR LanguageCode = "br" + LanguageBS LanguageCode = "bs" + LanguageCA LanguageCode = "ca" + LanguageCE LanguageCode = "ce" + LanguageCH LanguageCode = "ch" + LanguageCO LanguageCode = "co" + LanguageCR LanguageCode = "cr" + LanguageCS LanguageCode = "cs" + LanguageCU LanguageCode = "cu" + LanguageCV LanguageCode = "cv" + LanguageCY LanguageCode = "cy" + LanguageDA LanguageCode = "da" + LanguageDE LanguageCode = "de" + LanguageDV LanguageCode = "dv" + LanguageDZ LanguageCode = "dz" + LanguageEE LanguageCode = "ee" + LanguageEL LanguageCode = "el" + LanguageEN LanguageCode = "en" + LanguageEO LanguageCode = "eo" + LanguageES LanguageCode = "es" + LanguageET LanguageCode = "et" + LanguageEU LanguageCode = "eu" + LanguageFA LanguageCode = "fa" + LanguageFF LanguageCode = "ff" + LanguageFI LanguageCode = "fi" + LanguageFJ LanguageCode = "fj" + LanguageFO LanguageCode = "fo" + LanguageFR LanguageCode = "fr" + LanguageFY LanguageCode = "fy" + LanguageGA LanguageCode = "ga" + LanguageGD LanguageCode = "gd" + LanguageGL LanguageCode = "gl" + LanguageGN LanguageCode = "gn" + LanguageGU LanguageCode = "gu" + LanguageGV LanguageCode = "gv" + LanguageHA LanguageCode = "ha" + LanguageHE LanguageCode = "he" + LanguageHI LanguageCode = "hi" + LanguageHO LanguageCode = "ho" + LanguageHR LanguageCode = "hr" + LanguageHT LanguageCode = "ht" + LanguageHU LanguageCode = "hu" + LanguageHY LanguageCode = "hy" + LanguageHZ LanguageCode = "hz" + LanguageIA LanguageCode = "ia" + LanguageID LanguageCode = "id" + LanguageIE LanguageCode = "ie" + LanguageIG LanguageCode = "ig" + LanguageII LanguageCode = "ii" + LanguageIK LanguageCode = "ik" + LanguageIO LanguageCode = "io" + LanguageIS LanguageCode = "is" + LanguageIT LanguageCode = "it" + LanguageIU LanguageCode = "iu" + LanguageJA LanguageCode = "ja" + LanguageJV LanguageCode = "jv" + LanguageKA LanguageCode = "ka" + LanguageKG LanguageCode = "kg" + LanguageKI LanguageCode = "ki" + LanguageKJ LanguageCode = "kj" + LanguageKK LanguageCode = "kk" + LanguageKL LanguageCode = "kl" + LanguageKM LanguageCode = "km" + LanguageKN LanguageCode = "kn" + LanguageKO LanguageCode = "ko" + LanguageKR LanguageCode = "kr" + LanguageKS LanguageCode = "ks" + LanguageKU LanguageCode = "ku" + LanguageKV LanguageCode = "kv" + LanguageKW LanguageCode = "kw" + LanguageKY LanguageCode = "ky" + LanguageLA LanguageCode = "la" + LanguageLB LanguageCode = "lb" + LanguageLG LanguageCode = "lg" + LanguageLI LanguageCode = "li" + LanguageLN LanguageCode = "ln" + LanguageLO LanguageCode = "lo" + LanguageLT LanguageCode = "lt" + LanguageLU LanguageCode = "lu" + LanguageLV LanguageCode = "lv" + LanguageMG LanguageCode = "mg" + LanguageMH LanguageCode = "mh" + LanguageMI LanguageCode = "mi" + LanguageMK LanguageCode = "mk" + LanguageML LanguageCode = "ml" + LanguageMN LanguageCode = "mn" + LanguageMR LanguageCode = "mr" + LanguageMS LanguageCode = "ms" + LanguageMT LanguageCode = "mt" + LanguageMY LanguageCode = "my" + LanguageNA LanguageCode = "na" + LanguageNB LanguageCode = "nb" + LanguageND LanguageCode = "nd" + LanguageNE LanguageCode = "ne" + LanguageNG LanguageCode = "ng" + LanguageNL LanguageCode = "nl" + LanguageNN LanguageCode = "nn" + LanguageNO LanguageCode = "no" + LanguageNS LanguageCode = "ns" + LanguageNR LanguageCode = "nr" + LanguageNV LanguageCode = "nv" + LanguageNY LanguageCode = "ny" + LanguageOC LanguageCode = "oc" + LanguageOJ LanguageCode = "oj" + LanguageOM LanguageCode = "om" + LanguageOR LanguageCode = "or" + LanguageOS LanguageCode = "os" + LanguagePA LanguageCode = "pa" + LanguagePI LanguageCode = "pi" + LanguagePL LanguageCode = "pl" + LanguagePS LanguageCode = "ps" + LanguagePT LanguageCode = "pt" + LanguageQU LanguageCode = "qu" + LanguageRM LanguageCode = "rm" + LanguageRN LanguageCode = "rn" + LanguageRO LanguageCode = "ro" + LanguageRU LanguageCode = "ru" + LanguageRW LanguageCode = "rw" + LanguageSA LanguageCode = "sa" + LanguageSC LanguageCode = "sc" + LanguageSD LanguageCode = "sd" + LanguageSE LanguageCode = "se" + LanguageSG LanguageCode = "sg" + LanguageSI LanguageCode = "si" + LanguageSK LanguageCode = "sk" + LanguageSL LanguageCode = "sl" + LanguageSM LanguageCode = "sm" + LanguageSN LanguageCode = "sn" + LanguageSO LanguageCode = "so" + LanguageSQ LanguageCode = "sq" + LanguageSR LanguageCode = "sr" + LanguageSS LanguageCode = "ss" + LanguageST LanguageCode = "st" + LanguageSU LanguageCode = "su" + LanguageSV LanguageCode = "sv" + LanguageSW LanguageCode = "sw" + LanguageTA LanguageCode = "ta" + LanguageTE LanguageCode = "te" + LanguageTG LanguageCode = "tg" + LanguageTH LanguageCode = "th" + LanguageTI LanguageCode = "ti" + LanguageTK LanguageCode = "tk" + LanguageTL LanguageCode = "tl" + LanguageTN LanguageCode = "tn" + LanguageTO LanguageCode = "to" + LanguageTR LanguageCode = "tr" + LanguageTS LanguageCode = "ts" + LanguageTT LanguageCode = "tt" + LanguageTW LanguageCode = "tw" + LanguageTVL LanguageCode = "tvl" + LanguageTY LanguageCode = "ty" + LanguageUG LanguageCode = "ug" + LanguageUK LanguageCode = "uk" + LanguageUR LanguageCode = "ur" + LanguageUZ LanguageCode = "uz" + LanguageVE LanguageCode = "ve" + LanguageVI LanguageCode = "vi" + LanguageVO LanguageCode = "vo" + LanguageWA LanguageCode = "wa" + LanguageWO LanguageCode = "wo" + LanguageXH LanguageCode = "xh" + LanguageYI LanguageCode = "yi" + LanguageYO LanguageCode = "yo" + LanguageZA LanguageCode = "za" + LanguageZH LanguageCode = "zh" + LanguageZU LanguageCode = "zu" )