package compact
Import Path
golang.org/x/text/internal/language/compact (on go.dev)
Dependency Relation
imports 3 packages, and imported by one package
Involved Source Files
Package compact defines a compact representation of language tags.
Common language tags (at least all for which locale information is defined
in CLDR) are assigned a unique index. Each Tag is associated with such an
ID for selecting language-related resources (such as translations) as well
as one for selecting regional defaults (currency, number formatting, etc.)
It may want to export this functionality at some point, but at this point
this is only available for use within x/text.
language.go
parents.go
tables.go
tags.go
Package-Level Type Names (total 3, in which 2 are exported)
ID is an integer identifying a single tag.
Parent returns the ID of the parent or the root ID if id is already the root.
Tag converts id to an internal language Tag.
func FromTag(t language.Tag) (id ID, exact bool)
func LanguageID(t Tag) (id ID, exact bool)
func RegionalID(t Tag) (id ID, exact bool)
func ID.Parent() ID
func getCoreIndex(t language.Tag) (id ID, ok bool)
const afIndex
const afNAIndex
const afZAIndex
const agqCMIndex
const agqIndex
const akGHIndex
const akIndex
const amETIndex
const amIndex
const ar001Index
const arAEIndex
const arBHIndex
const arDJIndex
const arDZIndex
const arEGIndex
const arEHIndex
const arERIndex
const arILIndex
const arIndex
const arIQIndex
const arJOIndex
const arKMIndex
const arKWIndex
const arLBIndex
const arLYIndex
const arMAIndex
const arMRIndex
const arOMIndex
const arPSIndex
const arQAIndex
const arSAIndex
const arSDIndex
const arsIndex
const arSOIndex
const arSSIndex
const arSYIndex
const arTDIndex
const arTNIndex
const arYEIndex
const asaIndex
const asaTZIndex
const asIndex
const asINIndex
const astESIndex
const astIndex
const azCyrlAZIndex
const azCyrlIndex
const azIndex
const azLatnAZIndex
const azLatnIndex
const basCMIndex
const basIndex
const beBYIndex
const beIndex
const bemIndex
const bemZMIndex
const bezIndex
const bezTZIndex
const bgBGIndex
const bgIndex
const bhIndex
const bmIndex
const bmMLIndex
const bnBDIndex
const bnIndex
const bnINIndex
const boCNIndex
const boIndex
const boINIndex
const brFRIndex
const brIndex
const brxIndex
const brxINIndex
const bsCyrlBAIndex
const bsCyrlIndex
const bsIndex
const bsLatnBAIndex
const bsLatnIndex
const caADIndex
const caESIndex
const caESvalenciaIndex
const caFRIndex
const caIndex
const caITIndex
const ccpBDIndex
const ccpIndex
const ccpINIndex
const ceIndex
const ceRUIndex
const cggIndex
const cggUGIndex
const chrIndex
const chrUSIndex
const ckbIndex
const ckbIQIndex
const ckbIRIndex
const csCZIndex
const csIndex
const cuIndex
const cuRUIndex
const cyGBIndex
const cyIndex
const daDKIndex
const daGLIndex
const daIndex
const davIndex
const davKEIndex
const deATIndex
const deBEIndex
const deCHIndex
const deDEIndex
const deIndex
const deITIndex
const deLIIndex
const deLUIndex
const djeIndex
const djeNEIndex
const dsbDEIndex
const dsbIndex
const duaCMIndex
const duaIndex
const dvIndex
const dyoIndex
const dyoSNIndex
const dzBTIndex
const dzIndex
const ebuIndex
const ebuKEIndex
const eeGHIndex
const eeIndex
const eeTGIndex
const elCYIndex
const elGRIndex
const elIndex
const en001Index
const en150Index
const enAGIndex
const enAIIndex
const enASIndex
const enATIndex
const enAUIndex
const enBBIndex
const enBEIndex
const enBIIndex
const enBMIndex
const enBSIndex
const enBWIndex
const enBZIndex
const enCAIndex
const enCCIndex
const enCHIndex
const enCKIndex
const enCMIndex
const enCXIndex
const enCYIndex
const enDEIndex
const enDGIndex
const enDKIndex
const enDMIndex
const enERIndex
const enFIIndex
const enFJIndex
const enFKIndex
const enFMIndex
const enGBIndex
const enGDIndex
const enGGIndex
const enGHIndex
const enGIIndex
const enGMIndex
const enGUIndex
const enGYIndex
const enHKIndex
const enIEIndex
const enILIndex
const enIMIndex
const enIndex
const enINIndex
const enIOIndex
const enJEIndex
const enJMIndex
const enKEIndex
const enKIIndex
const enKNIndex
const enKYIndex
const enLCIndex
const enLRIndex
const enLSIndex
const enMGIndex
const enMHIndex
const enMOIndex
const enMPIndex
const enMSIndex
const enMTIndex
const enMUIndex
const enMWIndex
const enMYIndex
const enNAIndex
const enNFIndex
const enNGIndex
const enNLIndex
const enNRIndex
const enNUIndex
const enNZIndex
const enPGIndex
const enPHIndex
const enPKIndex
const enPNIndex
const enPRIndex
const enPWIndex
const enRWIndex
const enSBIndex
const enSCIndex
const enSDIndex
const enSEIndex
const enSGIndex
const enSHIndex
const enSIIndex
const enSLIndex
const enSSIndex
const enSXIndex
const enSZIndex
const enTCIndex
const enTKIndex
const enTOIndex
const enTTIndex
const enTVIndex
const enTZIndex
const enUGIndex
const enUMIndex
const enUSIndex
const enUSuvaposixIndex
const enVCIndex
const enVGIndex
const enVIIndex
const enVUIndex
const enWSIndex
const enZAIndex
const enZMIndex
const enZWIndex
const eo001Index
const eoIndex
const es419Index
const esARIndex
const esBOIndex
const esBRIndex
const esBZIndex
const esCLIndex
const esCOIndex
const esCRIndex
const esCUIndex
const esDOIndex
const esEAIndex
const esECIndex
const esESIndex
const esGQIndex
const esGTIndex
const esHNIndex
const esICIndex
const esIndex
const esMXIndex
const esNIIndex
const esPAIndex
const esPEIndex
const esPHIndex
const esPRIndex
const esPYIndex
const esSVIndex
const esUSIndex
const esUYIndex
const esVEIndex
const etEEIndex
const etIndex
const euESIndex
const euIndex
const ewoCMIndex
const ewoIndex
const faAFIndex
const faIndex
const faIRIndex
const ffCMIndex
const ffGNIndex
const ffIndex
const ffMRIndex
const ffSNIndex
const fiFIIndex
const fiIndex
const filIndex
const filPHIndex
const foDKIndex
const foFOIndex
const foIndex
const frBEIndex
const frBFIndex
const frBIIndex
const frBJIndex
const frBLIndex
const frCAIndex
const frCDIndex
const frCFIndex
const frCGIndex
const frCHIndex
const frCIIndex
const frCMIndex
const frDJIndex
const frDZIndex
const frFRIndex
const frGAIndex
const frGFIndex
const frGNIndex
const frGPIndex
const frGQIndex
const frHTIndex
const frIndex
const frKMIndex
const frLUIndex
const frMAIndex
const frMCIndex
const frMFIndex
const frMGIndex
const frMLIndex
const frMQIndex
const frMRIndex
const frMUIndex
const frNCIndex
const frNEIndex
const frPFIndex
const frPMIndex
const frREIndex
const frRWIndex
const frSCIndex
const frSNIndex
const frSYIndex
const frTDIndex
const frTGIndex
const frTNIndex
const frVUIndex
const frWFIndex
const frYTIndex
const furIndex
const furITIndex
const fyIndex
const fyNLIndex
const gaIEIndex
const gaIndex
const gdGBIndex
const gdIndex
const glESIndex
const glIndex
const gswCHIndex
const gswFRIndex
const gswIndex
const gswLIIndex
const guIndex
const guINIndex
const guwIndex
const guzIndex
const guzKEIndex
const gvIMIndex
const gvIndex
const haGHIndex
const haIndex
const haNEIndex
const haNGIndex
const hawIndex
const hawUSIndex
const heILIndex
const heIndex
const hiIndex
const hiINIndex
const hrBAIndex
const hrHRIndex
const hrIndex
const hsbDEIndex
const hsbIndex
const huHUIndex
const huIndex
const hyAMIndex
const hyIndex
const idIDIndex
const idIndex
const igIndex
const igNGIndex
const iiCNIndex
const iiIndex
const inIndex
const ioIndex
const isIndex
const isISIndex
const itCHIndex
const itIndex
const itITIndex
const itSMIndex
const itVAIndex
const iuIndex
const iwIndex
const jaIndex
const jaJPIndex
const jboIndex
const jgoCMIndex
const jgoIndex
const jiIndex
const jmcIndex
const jmcTZIndex
const jvIndex
const jwIndex
const kabDZIndex
const kabIndex
const kaGEIndex
const kaIndex
const kajIndex
const kamIndex
const kamKEIndex
const kcgIndex
const kdeIndex
const kdeTZIndex
const keaCVIndex
const keaIndex
const khqIndex
const khqMLIndex
const kiIndex
const kiKEIndex
const kkIndex
const kkjCMIndex
const kkjIndex
const kkKZIndex
const klGLIndex
const klIndex
const klnIndex
const klnKEIndex
const kmIndex
const kmKHIndex
const knIndex
const knINIndex
const koIndex
const kokIndex
const kokINIndex
const koKPIndex
const koKRIndex
const ksbIndex
const ksbTZIndex
const ksfCMIndex
const ksfIndex
const kshDEIndex
const kshIndex
const ksIndex
const ksINIndex
const kuIndex
const kwGBIndex
const kwIndex
const kyIndex
const kyKGIndex
const lagIndex
const lagTZIndex
const lbIndex
const lbLUIndex
const lgIndex
const lgUGIndex
const lktIndex
const lktUSIndex
const lnAOIndex
const lnCDIndex
const lnCFIndex
const lnCGIndex
const lnIndex
const loIndex
const loLAIndex
const lrcIndex
const lrcIQIndex
const lrcIRIndex
const ltIndex
const ltLTIndex
const luCDIndex
const luIndex
const luoIndex
const luoKEIndex
const luyIndex
const luyKEIndex
const lvIndex
const lvLVIndex
const masIndex
const masKEIndex
const masTZIndex
const merIndex
const merKEIndex
const mfeIndex
const mfeMUIndex
const mghIndex
const mghMZIndex
const mgIndex
const mgMGIndex
const mgoCMIndex
const mgoIndex
const mkIndex
const mkMKIndex
const mlIndex
const mlINIndex
const mnIndex
const mnMNIndex
const moIndex
const mrIndex
const mrINIndex
const msBNIndex
const msIndex
const msMYIndex
const msSGIndex
const mtIndex
const mtMTIndex
const muaCMIndex
const muaIndex
const myIndex
const myMMIndex
const mznIndex
const mznIRIndex
const nahIndex
const naqIndex
const naqNAIndex
const nbIndex
const nbNOIndex
const nbSJIndex
const ndIndex
const ndsDEIndex
const ndsIndex
const ndsNLIndex
const ndZWIndex
const neIndex
const neINIndex
const neNPIndex
const nlAWIndex
const nlBEIndex
const nlBQIndex
const nlCWIndex
const nlIndex
const nlNLIndex
const nlSRIndex
const nlSXIndex
const nmgCMIndex
const nmgIndex
const nnhCMIndex
const nnhIndex
const nnIndex
const nnNOIndex
const noIndex
const nqoIndex
const nrIndex
const nsoIndex
const nusIndex
const nusSSIndex
const nyIndex
const nynIndex
const nynUGIndex
const omETIndex
const omIndex
const omKEIndex
const orIndex
const orINIndex
const osGEIndex
const osIndex
const osRUIndex
const paArabIndex
const paArabPKIndex
const paGuruIndex
const paGuruINIndex
const paIndex
const papIndex
const plIndex
const plPLIndex
const prg001Index
const prgIndex
const psAFIndex
const psIndex
const ptAOIndex
const ptBRIndex
const ptCHIndex
const ptCVIndex
const ptGQIndex
const ptGWIndex
const ptIndex
const ptLUIndex
const ptMOIndex
const ptMZIndex
const ptPTIndex
const ptSTIndex
const ptTLIndex
const quBOIndex
const quECIndex
const quIndex
const quPEIndex
const rmCHIndex
const rmIndex
const rnBIIndex
const rnIndex
const rofIndex
const rofTZIndex
const roIndex
const roMDIndex
const roROIndex
const ruBYIndex
const ruIndex
const ruKGIndex
const ruKZIndex
const ruMDIndex
const ruRUIndex
const ruUAIndex
const rwIndex
const rwkIndex
const rwkTZIndex
const rwRWIndex
const sahIndex
const sahRUIndex
const saqIndex
const saqKEIndex
const sbpIndex
const sbpTZIndex
const sdhIndex
const sdIndex
const sdPKIndex
const seFIIndex
const sehIndex
const sehMZIndex
const seIndex
const seNOIndex
const seSEIndex
const sesIndex
const sesMLIndex
const sgCFIndex
const sgIndex
const shiIndex
const shiLatnIndex
const shiLatnMAIndex
const shIndex
const shiTfngIndex
const shiTfngMAIndex
const siIndex
const siLKIndex
const skIndex
const skSKIndex
const slIndex
const slSIIndex
const smaIndex
const smiIndex
const smjIndex
const smnFIIndex
const smnIndex
const smsIndex
const snIndex
const snZWIndex
const soDJIndex
const soETIndex
const soIndex
const soKEIndex
const soSOIndex
const sqALIndex
const sqIndex
const sqMKIndex
const sqXKIndex
const srCyrlBAIndex
const srCyrlIndex
const srCyrlMEIndex
const srCyrlRSIndex
const srCyrlXKIndex
const srIndex
const srLatnBAIndex
const srLatnIndex
const srLatnMEIndex
const srLatnRSIndex
const srLatnXKIndex
const ssIndex
const ssyIndex
const stIndex
const svAXIndex
const svFIIndex
const svIndex
const svSEIndex
const swCDIndex
const swIndex
const swKEIndex
const swTZIndex
const swUGIndex
const syrIndex
const taIndex
const taINIndex
const taLKIndex
const taMYIndex
const taSGIndex
const teIndex
const teINIndex
const teoIndex
const teoKEIndex
const teoUGIndex
const tgIndex
const tgTJIndex
const thIndex
const thTHIndex
const tiERIndex
const tiETIndex
const tigIndex
const tiIndex
const tkIndex
const tkTMIndex
const tlIndex
const tnIndex
const toIndex
const toTOIndex
const trCYIndex
const trIndex
const trTRIndex
const tsIndex
const ttIndex
const ttRUIndex
const twqIndex
const twqNEIndex
const tzmIndex
const tzmMAIndex
const ugCNIndex
const ugIndex
const ukIndex
const ukUAIndex
const undIndex
const urIndex
const urINIndex
const urPKIndex
const uzArabAFIndex
const uzArabIndex
const uzCyrlIndex
const uzCyrlUZIndex
const uzIndex
const uzLatnIndex
const uzLatnUZIndex
const vaiIndex
const vaiLatnIndex
const vaiLatnLRIndex
const vaiVaiiIndex
const vaiVaiiLRIndex
const veIndex
const viIndex
const viVNIndex
const vo001Index
const voIndex
const vunIndex
const vunTZIndex
const waeCHIndex
const waeIndex
const waIndex
const woIndex
const woSNIndex
const xhIndex
const xogIndex
const xogUGIndex
const yavCMIndex
const yavIndex
const yi001Index
const yiIndex
const yoBJIndex
const yoIndex
const yoNGIndex
const yueHansCNIndex
const yueHansIndex
const yueHantHKIndex
const yueHantIndex
const yueIndex
const zghIndex
const zghMAIndex
const zhHansCNIndex
const zhHansHKIndex
const zhHansIndex
const zhHansMOIndex
const zhHansSGIndex
const zhHantHKIndex
const zhHantIndex
const zhHantMOIndex
const zhHantTWIndex
const zhIndex
const zuIndex
const zuZAIndex
Tag represents a BCP 47 language tag. It is used to specify an instance of a
specific language or locale. All language tag values are guaranteed to be
well-formed.
// always a language.Tag for now.
NOTE: exported tags will become part of the public API.
locale ID
IsCompact reports whether this tag is fully defined in terms of ID.
IsRoot returns true if t is equal to language "und".
LanguageTag returns t stripped of regional variant indicators.
At the moment this means it is stripped of a regional and variant subtag "rg"
and "va" in the "u" extension.
MayHaveExtensions reports whether a tag may have extensions. If it returns
false it is guaranteed the tag does not have them.
MayHaveVariants reports whether a tag may have variants. If it returns false
it is guaranteed the tag does not have variants.
Parent returns the CLDR parent of t. In CLDR, missing fields in data for a
specific language are substituted with fields from the parent language.
The parent for a language may change for newer versions of CLDR.
RegionalTag returns the regional variant of the tag.
At the moment this means that the region is set from the regional subtag
"rg" in the "u" extension.
Tag returns an internal language Tag version of this tag.
func Make(t language.Tag) (tag Tag)
func Tag.LanguageTag() Tag
func Tag.Parent() Tag
func Tag.RegionalTag() Tag
func LanguageID(t Tag) (id ID, exact bool)
func RegionalID(t Tag) (id ID, exact bool)
var Afrikaans
var Albanian
var AmericanEnglish
var Amharic
var Arabic
var Armenian
var Azerbaijani
var Bengali
var BrazilianPortuguese
var BritishEnglish
var Bulgarian
var Burmese
var CanadianFrench
var Catalan
var Chinese
var Croatian
var Czech
var Danish
var Dutch
var English
var Estonian
var EuropeanPortuguese
var EuropeanSpanish
var Filipino
var Finnish
var French
var Georgian
var German
var Greek
var Gujarati
var Hebrew
var Hindi
var Hungarian
var Icelandic
var Indonesian
var Italian
var Japanese
var Kannada
var Kazakh
var Khmer
var Kirghiz
var Korean
var Lao
var LatinAmericanSpanish
var Latvian
var Lithuanian
var Macedonian
var Malay
var Malayalam
var Marathi
var ModernStandardArabic
var Mongolian
var Nepali
var Norwegian
var Persian
var Polish
var Portuguese
var Punjabi
var Romanian
var Russian
var Serbian
var SerbianLatin
var SimplifiedChinese
var Sinhala
var Slovak
var Slovenian
var Spanish
var Swahili
var Swedish
var Tamil
var Telugu
var Thai
var TraditionalChinese
var Turkish
var Ukrainian
var Und
var Urdu
var Uzbek
var Vietnamese
var Zulu
var und
Package-Level Functions (total 7, in which 4 are exported)
FromTag reports closest matching ID for an internal language Tag.
LanguageID returns an index, where 0 <= index < NumCompactTags, for tags
for which data exists in the text repository.The index will change over time
and should not be stored in persistent storage. If t does not match a compact
index, exact will be false and the compact index will be returned for the
first match after repeatedly taking the Parent of t.
Make a compact Tag from a fully specified internal language Tag.
RegionalID returns the ID for the regional variant of this tag. This index is
used to indicate region-specific overrides, such as default currency, default
calendar and week data, default time cycle, and default measurement system
and unit preferences.
For instance, the tag en-GB-u-rg-uszzzz specifies British English with US
settings for currency, number formatting, etc. The CompactIndex for this tag
will be that for en-GB, while the RegionalID will be the one corresponding to
en-US.
Package-Level Variables (total 85, in which 80 are exported)
Package-Level Constants (total 779, in which 2 are exported)
CLDRVersion is the CLDR version from which the tables in this package are derived.
NumCompactTags is the number of common tags. The maximum tag is
NumCompactTags-1.
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |