locale

package module
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

Country names and ISO codes kit

Installation

go get github.com/intelligent-medical-cloud/imc-locale

Examples

import "github.com/intelligent-medical-cloud/imc-locale"
us := locale.LocaleUS
ok := us.IsValid() // true
cname := us.Country() // "United States"
other := locale.Locale("XYZ")
ok := other.IsValid() // false
iso, err := locale.Make(" cA") // normalize and cast to LocaleCA
if err == nil {
    ok := iso.IsValid() // true
    cname := iso.Country() // "Canada"
}

Documentation

Overview

Country names and ISO codes kit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locale

type Locale string
const (
	LocaleWildcard Locale = "*"
	LocaleAD       Locale = "AD"
	LocaleAF       Locale = "AF"
	LocaleAG       Locale = "AG"
	LocaleAI       Locale = "AI"
	LocaleAL       Locale = "AL"
	LocaleAM       Locale = "AM"
	LocaleAO       Locale = "AO"
	LocaleAQ       Locale = "AQ"
	LocaleAE       Locale = "AE"
	LocaleAR       Locale = "AR"
	LocaleAS       Locale = "AS"
	LocaleAT       Locale = "AT"
	LocaleAU       Locale = "AU"
	LocaleAW       Locale = "AW"
	LocaleAX       Locale = "AX"
	LocaleAZ       Locale = "AZ"
	LocaleBA       Locale = "BA"
	LocaleBB       Locale = "BB"
	LocaleBD       Locale = "BD"
	LocaleBE       Locale = "BE"
	LocaleBF       Locale = "BF"
	LocaleBG       Locale = "BG"
	LocaleBH       Locale = "BH"
	LocaleBI       Locale = "BI"
	LocaleBJ       Locale = "BJ"
	LocaleBL       Locale = "BL"
	LocaleBM       Locale = "BM"
	LocaleBN       Locale = "BN"
	LocaleBO       Locale = "BO"
	LocaleBQ       Locale = "BQ"
	LocaleBR       Locale = "BR"
	LocaleBS       Locale = "BS"
	LocaleBT       Locale = "BT"
	LocaleBV       Locale = "BV"
	LocaleBW       Locale = "BW"
	LocaleBY       Locale = "BY"
	LocaleBZ       Locale = "BZ"
	LocaleCA       Locale = "CA"
	LocaleCC       Locale = "CC"
	LocaleCD       Locale = "CD"
	LocaleCF       Locale = "CF"
	LocaleCG       Locale = "CG"
	LocaleCH       Locale = "CH"
	LocaleCI       Locale = "CI"
	LocaleCK       Locale = "CK"
	LocaleCL       Locale = "CL"
	LocaleCM       Locale = "CM"
	LocaleCN       Locale = "CN"
	LocaleCO       Locale = "CO"
	LocaleCR       Locale = "CR"
	LocaleCU       Locale = "CU"
	LocaleCV       Locale = "CV"
	LocaleCW       Locale = "CW"
	LocaleCX       Locale = "CX"
	LocaleCY       Locale = "CY"
	LocaleCZ       Locale = "CZ"
	LocaleDE       Locale = "DE"
	LocaleDJ       Locale = "DJ"
	LocaleDK       Locale = "DK"
	LocaleDM       Locale = "DM"
	LocaleDO       Locale = "DO"
	LocaleDZ       Locale = "DZ"
	LocaleEC       Locale = "EC"
	LocaleEE       Locale = "EE"
	LocaleEG       Locale = "EG"
	LocaleEH       Locale = "EH"
	LocaleER       Locale = "ER"
	LocaleES       Locale = "ES"
	LocaleET       Locale = "ET"
	LocaleFI       Locale = "FI"
	LocaleFJ       Locale = "FJ"
	LocaleFK       Locale = "FK"
	LocaleFM       Locale = "FM"
	LocaleFO       Locale = "FO"
	LocaleFR       Locale = "FR"
	LocaleGA       Locale = "GA"
	LocaleGB       Locale = "GB"
	LocaleGD       Locale = "GD"
	LocaleGE       Locale = "GE"
	LocaleGF       Locale = "GF"
	LocaleGG       Locale = "GG"
	LocaleGH       Locale = "GH"
	LocaleGI       Locale = "GI"
	LocaleGL       Locale = "GL"
	LocaleGM       Locale = "GM"
	LocaleGN       Locale = "GN"
	LocaleGP       Locale = "GP"
	LocaleGQ       Locale = "GQ"
	LocaleGR       Locale = "GR"
	LocaleGS       Locale = "GS"
	LocaleGT       Locale = "GT"
	LocaleGU       Locale = "GU"
	LocaleGW       Locale = "GW"
	LocaleGY       Locale = "GY"
	LocaleHK       Locale = "HK"
	LocaleHM       Locale = "HM"
	LocaleHN       Locale = "HN"
	LocaleHR       Locale = "HR"
	LocaleHT       Locale = "HT"
	LocaleHU       Locale = "HU"
	LocaleID       Locale = "ID"
	LocaleIE       Locale = "IE"
	LocaleIL       Locale = "IL"
	LocaleIM       Locale = "IM"
	LocaleIN       Locale = "IN"
	LocaleIO       Locale = "IO"
	LocaleIQ       Locale = "IQ"
	LocaleIR       Locale = "IR"
	LocaleIS       Locale = "IS"
	LocaleIT       Locale = "IT"
	LocaleJE       Locale = "JE"
	LocaleJM       Locale = "JM"
	LocaleJO       Locale = "JO"
	LocaleJP       Locale = "JP"
	LocaleKE       Locale = "KE"
	LocaleKG       Locale = "KG"
	LocaleKH       Locale = "KH"
	LocaleKI       Locale = "KI"
	LocaleKM       Locale = "KM"
	LocaleKN       Locale = "KN"
	LocaleKP       Locale = "KP"
	LocaleKR       Locale = "KR"
	LocaleKW       Locale = "KW"
	LocaleKY       Locale = "KY"
	LocaleKZ       Locale = "KZ"
	LocaleLA       Locale = "LA"
	LocaleLB       Locale = "LB"
	LocaleLC       Locale = "LC"
	LocaleLI       Locale = "LI"
	LocaleLK       Locale = "LK"
	LocaleLR       Locale = "LR"
	LocaleLS       Locale = "LS"
	LocaleLT       Locale = "LT"
	LocaleLU       Locale = "LU"
	LocaleLV       Locale = "LV"
	LocaleLY       Locale = "LY"
	LocaleMA       Locale = "MA"
	LocaleMC       Locale = "MC"
	LocaleMD       Locale = "MD"
	LocaleME       Locale = "ME"
	LocaleMF       Locale = "MF"
	LocaleMG       Locale = "MG"
	LocaleMH       Locale = "MH"
	LocaleMK       Locale = "MK"
	LocaleML       Locale = "ML"
	LocaleMM       Locale = "MM"
	LocaleMN       Locale = "MN"
	LocaleMO       Locale = "MO"
	LocaleMP       Locale = "MP"
	LocaleMQ       Locale = "MQ"
	LocaleMR       Locale = "MR"
	LocaleMS       Locale = "MS"
	LocaleMT       Locale = "MT"
	LocaleMU       Locale = "MU"
	LocaleMV       Locale = "MV"
	LocaleMW       Locale = "MW"
	LocaleMX       Locale = "MX"
	LocaleMY       Locale = "MY"
	LocaleMZ       Locale = "MZ"
	LocaleNA       Locale = "NA"
	LocaleNC       Locale = "NC"
	LocaleNE       Locale = "NE"
	LocaleNF       Locale = "NF"
	LocaleNI       Locale = "NI"
	LocaleNL       Locale = "NL"
	LocaleNO       Locale = "NO"
	LocaleNP       Locale = "NP"
	LocaleNR       Locale = "NR"
	LocaleNU       Locale = "NU"
	LocaleNZ       Locale = "NZ"
	LocaleOM       Locale = "OM"
	LocalePA       Locale = "PA"
	LocalePE       Locale = "PE"
	LocalePF       Locale = "PF"
	LocalePG       Locale = "PG"
	LocalePH       Locale = "PH"
	LocalePK       Locale = "PK"
	LocalePL       Locale = "PL"
	LocalePM       Locale = "PM"
	LocalePN       Locale = "PN"
	LocalePR       Locale = "PR"
	LocalePS       Locale = "PS"
	LocalePT       Locale = "PT"
	LocalePW       Locale = "PW"
	LocalePY       Locale = "PY"
	LocaleQA       Locale = "QA"
	LocaleRE       Locale = "RE"
	LocaleRO       Locale = "RO"
	LocaleRS       Locale = "RS"
	LocaleRU       Locale = "RU"
	LocaleRW       Locale = "RW"
	LocaleSA       Locale = "SA"
	LocaleSB       Locale = "SB"
	LocaleSC       Locale = "SC"
	LocaleSD       Locale = "SD"
	LocaleSE       Locale = "SE"
	LocaleSG       Locale = "SG"
	LocaleSH       Locale = "SH"
	LocaleSI       Locale = "SI"
	LocaleSJ       Locale = "SJ"
	LocaleSK       Locale = "SK"
	LocaleSL       Locale = "SL"
	LocaleSM       Locale = "SM"
	LocaleSN       Locale = "SN"
	LocaleSO       Locale = "SO"
	LocaleSR       Locale = "SR"
	LocaleSS       Locale = "SS"
	LocaleST       Locale = "ST"
	LocaleSV       Locale = "SV"
	LocaleSX       Locale = "SX"
	LocaleSY       Locale = "SY"
	LocaleSZ       Locale = "SZ"
	LocaleTC       Locale = "TC"
	LocaleTD       Locale = "TD"
	LocaleTF       Locale = "TF"
	LocaleTG       Locale = "TG"
	LocaleTH       Locale = "TH"
	LocaleTJ       Locale = "TJ"
	LocaleTK       Locale = "TK"
	LocaleTL       Locale = "TL"
	LocaleTM       Locale = "TM"
	LocaleTN       Locale = "TN"
	LocaleTO       Locale = "TO"
	LocaleTR       Locale = "TR"
	LocaleTT       Locale = "TT"
	LocaleTV       Locale = "TV"
	LocaleTW       Locale = "TW"
	LocaleTZ       Locale = "TZ"
	LocaleUA       Locale = "UA"
	LocaleUG       Locale = "UG"
	LocaleUM       Locale = "UM"
	LocaleUS       Locale = "US"
	LocaleUY       Locale = "UY"
	LocaleUZ       Locale = "UZ"
	LocaleVA       Locale = "VA"
	LocaleVC       Locale = "VC"
	LocaleVE       Locale = "VE"
	LocaleVG       Locale = "VG"
	LocaleVI       Locale = "VI"
	LocaleVN       Locale = "VN"
	LocaleVU       Locale = "VU"
	LocaleWF       Locale = "WF"
	LocaleWS       Locale = "WS"
	LocaleYE       Locale = "YE"
	LocaleYT       Locale = "YT"
	LocaleZA       Locale = "ZA"
	LocaleZM       Locale = "ZM"
	LocaleZW       Locale = "ZW"
)

All available ISO codes.

func Make

func Make(isoCode string) (Locale, error)

Safely cast string type ISO code to Locale type. If casting failed, en empty (zero value) Locale and error reurned.

func (Locale) Country

func (l Locale) Country() string

Returns country name for the ISO code.

func (Locale) ISOLowercase

func (l Locale) ISOLowercase() string

Returns country ISO code as normalized lowercase string.

func (Locale) ISOUppercase

func (l Locale) ISOUppercase() string

Returns country ISO code as normalized uppercase string.

func (Locale) IsValid

func (l Locale) IsValid() bool

Check if such ISO country code exists.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL