Documentation
¶
Overview ¶
Package l10n provides localization models and data.
Index ¶
- type Code
- type CountryDef
- type CountryDefs
- type ISOCountryCode
- func (c ISOCountryCode) Alpha3() string
- func (c ISOCountryCode) Code() Code
- func (c ISOCountryCode) Empty() bool
- func (c ISOCountryCode) In(set ...ISOCountryCode) bool
- func (ISOCountryCode) JSONSchema() *jsonschema.Schema
- func (c ISOCountryCode) Name() string
- func (c ISOCountryCode) String() string
- func (c ISOCountryCode) Validate() error
- type TaxCountryCode
- func (c TaxCountryCode) Code() Code
- func (c TaxCountryCode) Empty() bool
- func (c TaxCountryCode) In(set ...TaxCountryCode) bool
- func (TaxCountryCode) JSONSchema() *jsonschema.Schema
- func (c TaxCountryCode) Name() string
- func (c TaxCountryCode) String() string
- func (c TaxCountryCode) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶ added in v0.20.0
type Code string
Code is used for short identifiers like country or state codes. They are limited to upper-case letters and numbers only, and should be validated against region specific data.
const ( AF Code = "AF" AX Code = "AX" AL Code = "AL" DZ Code = "DZ" AS Code = "AS" AD Code = "AD" AO Code = "AO" AI Code = "AI" AQ Code = "AQ" AG Code = "AG" AR Code = "AR" AM Code = "AM" AW Code = "AW" AU Code = "AU" AT Code = "AT" AZ Code = "AZ" BS Code = "BS" BH Code = "BH" BD Code = "BD" BB Code = "BB" BY Code = "BY" BE Code = "BE" BZ Code = "BZ" BJ Code = "BJ" BM Code = "BM" BT Code = "BT" BO Code = "BO" BQ Code = "BQ" BA Code = "BA" BW Code = "BW" BV Code = "BV" BR Code = "BR" IO Code = "IO" BN Code = "BN" BG Code = "BG" BF Code = "BF" BI Code = "BI" CV Code = "CV" KH Code = "KH" CM Code = "CM" CA Code = "CA" KY Code = "KY" CF Code = "CF" TD Code = "TD" CL Code = "CL" CN Code = "CN" CX Code = "CX" CC Code = "CC" CO Code = "CO" KM Code = "KM" CG Code = "CG" CD Code = "CD" CK Code = "CK" CR Code = "CR" CI Code = "CI" HR Code = "HR" CU Code = "CU" CW Code = "CW" CY Code = "CY" CZ Code = "CZ" DK Code = "DK" DJ Code = "DJ" DM Code = "DM" DO Code = "DO" EC Code = "EC" EG Code = "EG" SV Code = "SV" GQ Code = "GQ" ER Code = "ER" EE Code = "EE" SZ Code = "SZ" ET Code = "ET" FK Code = "FK" FO Code = "FO" FJ Code = "FJ" FI Code = "FI" FR Code = "FR" GF Code = "GF" PF Code = "PF" TF Code = "TF" GA Code = "GA" GM Code = "GM" GE Code = "GE" DE Code = "DE" GH Code = "GH" GI Code = "GI" GR Code = "GR" GL Code = "GL" GD Code = "GD" GP Code = "GP" GU Code = "GU" GT Code = "GT" GG Code = "GG" GN Code = "GN" GW Code = "GW" GY Code = "GY" HT Code = "HT" HM Code = "HM" VA Code = "VA" HN Code = "HN" HK Code = "HK" HU Code = "HU" IS Code = "IS" IN Code = "IN" ID Code = "ID" IR Code = "IR" IQ Code = "IQ" IE Code = "IE" IM Code = "IM" IL Code = "IL" IT Code = "IT" JM Code = "JM" JP Code = "JP" JE Code = "JE" JO Code = "JO" KZ Code = "KZ" KE Code = "KE" KI Code = "KI" KP Code = "KP" KR Code = "KR" KW Code = "KW" KG Code = "KG" LA Code = "LA" LV Code = "LV" LB Code = "LB" LS Code = "LS" LR Code = "LR" LY Code = "LY" LI Code = "LI" LT Code = "LT" LU Code = "LU" MO Code = "MO" MG Code = "MG" MW Code = "MW" MY Code = "MY" MV Code = "MV" ML Code = "ML" MT Code = "MT" MH Code = "MH" MQ Code = "MQ" MR Code = "MR" MU Code = "MU" YT Code = "YT" MX Code = "MX" FM Code = "FM" MD Code = "MD" MC Code = "MC" MN Code = "MN" ME Code = "ME" MS Code = "MS" MA Code = "MA" MZ Code = "MZ" MM Code = "MM" NA Code = "NA" NR Code = "NR" NP Code = "NP" NL Code = "NL" NC Code = "NC" NZ Code = "NZ" NI Code = "NI" NE Code = "NE" NG Code = "NG" NU Code = "NU" NF Code = "NF" MK Code = "MK" MP Code = "MP" NO Code = "NO" OM Code = "OM" PK Code = "PK" PW Code = "PW" PS Code = "PS" PA Code = "PA" PG Code = "PG" PY Code = "PY" PE Code = "PE" PH Code = "PH" PN Code = "PN" PL Code = "PL" PT Code = "PT" PR Code = "PR" QA Code = "QA" RE Code = "RE" RO Code = "RO" RU Code = "RU" RW Code = "RW" BL Code = "BL" SH Code = "SH" KN Code = "KN" LC Code = "LC" MF Code = "MF" PM Code = "PM" VC Code = "VC" WS Code = "WS" SM Code = "SM" ST Code = "ST" SA Code = "SA" SN Code = "SN" RS Code = "RS" SC Code = "SC" SL Code = "SL" SG Code = "SG" SX Code = "SX" SK Code = "SK" SI Code = "SI" SB Code = "SB" SO Code = "SO" ZA Code = "ZA" GS Code = "GS" SS Code = "SS" ES Code = "ES" LK Code = "LK" SD Code = "SD" SR Code = "SR" SJ Code = "SJ" SE Code = "SE" CH Code = "CH" SY Code = "SY" TW Code = "TW" TJ Code = "TJ" TZ Code = "TZ" TH Code = "TH" TL Code = "TL" TG Code = "TG" TK Code = "TK" TO Code = "TO" TT Code = "TT" TN Code = "TN" TR Code = "TR" TM Code = "TM" TC Code = "TC" TV Code = "TV" UG Code = "UG" UA Code = "UA" AE Code = "AE" GB Code = "GB" // Great Britain and Northern Ireland US Code = "US" // United States UM Code = "UM" UY Code = "UY" UZ Code = "UZ" VU Code = "VU" VE Code = "VE" VN Code = "VN" VG Code = "VG" VI Code = "VI" WF Code = "WF" EH Code = "EH" YE Code = "YE" ZM Code = "ZM" ZW Code = "ZW" )
List of all ISO 3166-2 country codes that we know about.
const ( EL Code = "EL" // Greece XI Code = "XI" // Northern Ireland XU Code = "XU" // United Kingdom except Northern Ireland EU Code = "EU" // European Union special code )
Extension country codes required by some countries for tax purposes.
const CodeEmpty Code = ""
CodeEmpty is used for matching empty codes.
func (Code) ISO ¶ added in v0.113.0
func (c Code) ISO() ISOCountryCode
ISO is a convenience method to provide the ISO country code of a code.
func (Code) JSONSchema ¶ added in v0.29.0
func (Code) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
func (Code) Tax ¶ added in v0.113.0
func (c Code) Tax() TaxCountryCode
Tax is a convenience method to provide the tax country code of a code.
type CountryDef ¶ added in v0.29.0
type CountryDef struct { // ISO 3166-2 Country code Code Code `json:"code" jsonschema:"title=ISO 3166-2 Country Code"` // ISO 3166-1 alpha-3 Country code Alpha3 string `json:"alpha3" jsonschema:"title=ISO 3166-1 Alpha-3 Country Code"` // English name of the country Name string `json:"name" jsonschema:"title=Name"` // Internet Top-Level-Domain TLD string `json:"tld" jsonschema:"title=Top level domain"` // When true, the country is an ISO code. ISO bool `json:"iso" jsonschema:"title=ISO"` // When true, the code can be used for tax purposes. Tax bool `json:"tax" jsonschema:"title=Tax"` // Indicates that a different code can be used for lookups. AltCode Code `json:"alt_code" jsonschema:"title=Tax Code"` }
CountryDef provides the structure use to define a Country Code definition.
type CountryDefs ¶ added in v0.113.0
type CountryDefs []*CountryDef
CountryDefs provides helps for managing the list of countries
func Countries ¶ added in v0.113.0
func Countries() CountryDefs
Countries provides an array of country definitions including the official ISO country code, the name in English, the country's top-level-domain name, and if this is an extension or not.
func (CountryDefs) Code ¶ added in v0.113.0
func (cdfs CountryDefs) Code(c Code) *CountryDef
Code finds the country definition for the given country code
func (CountryDefs) ISO ¶ added in v0.113.0
func (cdfs CountryDefs) ISO() []*CountryDef
ISO provides a list of all the ISO countries.
func (CountryDefs) Len ¶ added in v0.113.0
func (cdfs CountryDefs) Len() int
Len provides the length of the country definitions
func (CountryDefs) Tax ¶ added in v0.113.0
func (cdfs CountryDefs) Tax() []*CountryDef
Tax provides a list of all the country definitions that can be used for tax purposes.
type ISOCountryCode ¶ added in v0.113.0
type ISOCountryCode Code
ISOCountryCode defines an ISO 3166-2 country code.
func (ISOCountryCode) Alpha3 ¶ added in v0.113.0
func (c ISOCountryCode) Alpha3() string
Alpha3 provides the ISO 3166-1 alpha-3 country code
func (ISOCountryCode) Code ¶ added in v0.113.0
func (c ISOCountryCode) Code() Code
Code provides the Code type for the ISO country code.
func (ISOCountryCode) Empty ¶ added in v0.115.0
func (c ISOCountryCode) Empty() bool
Empty returns true if the ISO country code is empty.
func (ISOCountryCode) In ¶ added in v0.113.0
func (c ISOCountryCode) In(set ...ISOCountryCode) bool
In returns true if the country code is contained inside the provided set
func (ISOCountryCode) JSONSchema ¶ added in v0.113.0
func (ISOCountryCode) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
func (ISOCountryCode) Name ¶ added in v0.113.0
func (c ISOCountryCode) Name() string
Name provides the ISO Country Name for the code
func (ISOCountryCode) String ¶ added in v0.113.0
func (c ISOCountryCode) String() string
String provides string representation of the ISO country code
func (ISOCountryCode) Validate ¶ added in v0.113.0
func (c ISOCountryCode) Validate() error
Validate ensures the ISO country code is inside the known and valid list of countries.
type TaxCountryCode ¶ added in v0.113.0
type TaxCountryCode Code
TaxCountryCode defines a code that may coincide with a country code, but may not always coincide.
func (TaxCountryCode) Code ¶ added in v0.113.0
func (c TaxCountryCode) Code() Code
Code provides the Code type for the tax country code.
func (TaxCountryCode) Empty ¶ added in v0.115.0
func (c TaxCountryCode) Empty() bool
Empty returns true if the tax country code is empty.
func (TaxCountryCode) In ¶ added in v0.113.0
func (c TaxCountryCode) In(set ...TaxCountryCode) bool
In returns true if the tax country code is contained inside the provided set
func (TaxCountryCode) JSONSchema ¶ added in v0.113.0
func (TaxCountryCode) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the type for usage in Schema.
func (TaxCountryCode) Name ¶ added in v0.113.0
func (c TaxCountryCode) Name() string
Name provides the ISO Country Name for the code
func (TaxCountryCode) String ¶ added in v0.113.0
func (c TaxCountryCode) String() string
String provides string representation of the tax country code
func (TaxCountryCode) Validate ¶ added in v0.113.0
func (c TaxCountryCode) Validate() error
Validate ensures the tax country code is inside the known and valid list of country codes for taxes.