language

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause, Unlicense Imports: 4 Imported by: 11

Documentation

Index

Constants

View Source
const (
	Adlam                        = Script(0x61646c6d) // adlm
	Afaka                        = Script(0x6166616b) // afak
	Ahom                         = Script(0x61686f6d) // ahom
	Anatolian_Hieroglyphs        = Script(0x686c7577) // hluw
	Arabic                       = Script(0x61726162) // arab
	Armenian                     = Script(0x61726d6e) // armn
	Avestan                      = Script(0x61767374) // avst
	Balinese                     = Script(0x62616c69) // bali
	Bamum                        = Script(0x62616d75) // bamu
	Bassa_Vah                    = Script(0x62617373) // bass
	Batak                        = Script(0x6261746b) // batk
	Bengali                      = Script(0x62656e67) // beng
	Bhaiksuki                    = Script(0x62686b73) // bhks
	Blissymbols                  = Script(0x626c6973) // blis
	Book_Pahlavi                 = Script(0x70686c76) // phlv
	Bopomofo                     = Script(0x626f706f) // bopo
	Brahmi                       = Script(0x62726168) // brah
	Braille                      = Script(0x62726169) // brai
	Buginese                     = Script(0x62756769) // bugi
	Buhid                        = Script(0x62756864) // buhd
	Canadian_Aboriginal          = Script(0x63616e73) // cans
	Carian                       = Script(0x63617269) // cari
	Caucasian_Albanian           = Script(0x61676862) // aghb
	Chakma                       = Script(0x63616b6d) // cakm
	Cham                         = Script(0x6368616d) // cham
	Cherokee                     = Script(0x63686572) // cher
	Chorasmian                   = Script(0x63687273) // chrs
	Cirth                        = Script(0x63697274) // cirt
	Code_for_unwritten_documents = Script(0x7a787878) // zxxx
	Common                       = Script(0x7a797979) // zyyy
	Coptic                       = Script(0x636f7074) // copt
	Cuneiform                    = Script(0x78737578) // xsux
	Cypriot                      = Script(0x63707274) // cprt
	Cypro_Minoan                 = Script(0x63706d6e) // cpmn
	Cyrillic                     = Script(0x6379726c) // cyrl
	Deseret                      = Script(0x64737274) // dsrt
	Devanagari                   = Script(0x64657661) // deva
	Dives_Akuru                  = Script(0x6469616b) // diak
	Dogra                        = Script(0x646f6772) // dogr
	Duployan                     = Script(0x6475706c) // dupl
	Egyptian_Hieroglyphs         = Script(0x65677970) // egyp
	Egyptian_demotic             = Script(0x65677964) // egyd
	Egyptian_hieratic            = Script(0x65677968) // egyh
	Elbasan                      = Script(0x656c6261) // elba
	Elymaic                      = Script(0x656c796d) // elym
	Ethiopic                     = Script(0x65746869) // ethi
	Georgian                     = Script(0x67656f72) // geor
	Glagolitic                   = Script(0x676c6167) // glag
	Gothic                       = Script(0x676f7468) // goth
	Grantha                      = Script(0x6772616e) // gran
	Greek                        = Script(0x6772656b) // grek
	Gujarati                     = Script(0x67756a72) // gujr
	Gunjala_Gondi                = Script(0x676f6e67) // gong
	Gurmukhi                     = Script(0x67757275) // guru
	Han                          = Script(0x68616e69) // hani
	Hangul                       = Script(0x68616e67) // hang
	Hanifi_Rohingya              = Script(0x726f6867) // rohg
	Hanunoo                      = Script(0x68616e6f) // hano
	Hatran                       = Script(0x68617472) // hatr
	Hebrew                       = Script(0x68656272) // hebr
	Hiragana                     = Script(0x68697261) // hira
	Imperial_Aramaic             = Script(0x61726d69) // armi
	Inherited                    = Script(0x7a696e68) // zinh
	Inscriptional_Pahlavi        = Script(0x70686c69) // phli
	Inscriptional_Parthian       = Script(0x70727469) // prti
	Javanese                     = Script(0x6a617661) // java
	Jurchen                      = Script(0x6a757263) // jurc
	Kaithi                       = Script(0x6b746869) // kthi
	Kannada                      = Script(0x6b6e6461) // knda
	Katakana                     = Script(0x6b616e61) // kana
	Katakana_Or_Hiragana         = Script(0x68726b74) // hrkt
	Kawi                         = Script(0x6b617769) // kawi
	Kayah_Li                     = Script(0x6b616c69) // kali
	Kharoshthi                   = Script(0x6b686172) // khar
	Khitan_Small_Script          = Script(0x6b697473) // kits
	Khitan_large_script          = Script(0x6b69746c) // kitl
	Khmer                        = Script(0x6b686d72) // khmr
	Khojki                       = Script(0x6b686f6a) // khoj
	Khudawadi                    = Script(0x73696e64) // sind
	Kpelle                       = Script(0x6b70656c) // kpel
	Lao                          = Script(0x6c616f6f) // laoo
	Latin                        = Script(0x6c61746e) // latn
	Leke                         = Script(0x6c656b65) // leke
	Lepcha                       = Script(0x6c657063) // lepc
	Limbu                        = Script(0x6c696d62) // limb
	Linear_A                     = Script(0x6c696e61) // lina
	Linear_B                     = Script(0x6c696e62) // linb
	Lisu                         = Script(0x6c697375) // lisu
	Loma                         = Script(0x6c6f6d61) // loma
	Lycian                       = Script(0x6c796369) // lyci
	Lydian                       = Script(0x6c796469) // lydi
	Mahajani                     = Script(0x6d61686a) // mahj
	Makasar                      = Script(0x6d616b61) // maka
	Malayalam                    = Script(0x6d6c796d) // mlym
	Mandaic                      = Script(0x6d616e64) // mand
	Manichaean                   = Script(0x6d616e69) // mani
	Marchen                      = Script(0x6d617263) // marc
	Masaram_Gondi                = Script(0x676f6e6d) // gonm
	Mathematical_notation        = Script(0x7a6d7468) // zmth
	Mayan_hieroglyphs            = Script(0x6d617961) // maya
	Medefaidrin                  = Script(0x6d656466) // medf
	Meetei_Mayek                 = Script(0x6d746569) // mtei
	Mende_Kikakui                = Script(0x6d656e64) // mend
	Meroitic_Cursive             = Script(0x6d657263) // merc
	Meroitic_Hieroglyphs         = Script(0x6d65726f) // mero
	Miao                         = Script(0x706c7264) // plrd
	Modi                         = Script(0x6d6f6469) // modi
	Mongolian                    = Script(0x6d6f6e67) // mong
	Mro                          = Script(0x6d726f6f) // mroo
	Multani                      = Script(0x6d756c74) // mult
	Myanmar                      = Script(0x6d796d72) // mymr
	Nabataean                    = Script(0x6e626174) // nbat
	Nag_Mundari                  = Script(0x6e61676d) // nagm
	Nandinagari                  = Script(0x6e616e64) // nand
	New_Tai_Lue                  = Script(0x74616c75) // talu
	Newa                         = Script(0x6e657761) // newa
	Nko                          = Script(0x6e6b6f6f) // nkoo
	Nushu                        = Script(0x6e736875) // nshu
	Nyiakeng_Puachue_Hmong       = Script(0x686d6e70) // hmnp
	Ogham                        = Script(0x6f67616d) // ogam
	Ol_Chiki                     = Script(0x6f6c636b) // olck
	Old_Hungarian                = Script(0x68756e67) // hung
	Old_Italic                   = Script(0x6974616c) // ital
	Old_North_Arabian            = Script(0x6e617262) // narb
	Old_Permic                   = Script(0x7065726d) // perm
	Old_Persian                  = Script(0x7870656f) // xpeo
	Old_Sogdian                  = Script(0x736f676f) // sogo
	Old_South_Arabian            = Script(0x73617262) // sarb
	Old_Turkic                   = Script(0x6f726b68) // orkh
	Old_Uyghur                   = Script(0x6f756772) // ougr
	Oriya                        = Script(0x6f727961) // orya
	Osage                        = Script(0x6f736765) // osge
	Osmanya                      = Script(0x6f736d61) // osma
	Pahawh_Hmong                 = Script(0x686d6e67) // hmng
	Palmyrene                    = Script(0x70616c6d) // palm
	Pau_Cin_Hau                  = Script(0x70617563) // pauc
	Phags_Pa                     = Script(0x70686167) // phag
	Phoenician                   = Script(0x70686e78) // phnx
	Psalter_Pahlavi              = Script(0x70686c70) // phlp
	Ranjana                      = Script(0x72616e6a) // ranj
	Rejang                       = Script(0x726a6e67) // rjng
	Rongorongo                   = Script(0x726f726f) // roro
	Runic                        = Script(0x72756e72) // runr
	Samaritan                    = Script(0x73616d72) // samr
	Sarati                       = Script(0x73617261) // sara
	Saurashtra                   = Script(0x73617572) // saur
	Sharada                      = Script(0x73687264) // shrd
	Shavian                      = Script(0x73686177) // shaw
	Shuishu                      = Script(0x73687569) // shui
	Siddham                      = Script(0x73696464) // sidd
	SignWriting                  = Script(0x73676e77) // sgnw
	Sinhala                      = Script(0x73696e68) // sinh
	Sogdian                      = Script(0x736f6764) // sogd
	Sora_Sompeng                 = Script(0x736f7261) // sora
	Soyombo                      = Script(0x736f796f) // soyo
	Sundanese                    = Script(0x73756e64) // sund
	Sunuwar                      = Script(0x73756e75) // sunu
	Syloti_Nagri                 = Script(0x73796c6f) // sylo
	Symbols                      = Script(0x7a73796d) // zsym
	Syriac                       = Script(0x73797263) // syrc
	Tagalog                      = Script(0x74676c67) // tglg
	Tagbanwa                     = Script(0x74616762) // tagb
	Tai_Le                       = Script(0x74616c65) // tale
	Tai_Tham                     = Script(0x6c616e61) // lana
	Tai_Viet                     = Script(0x74617674) // tavt
	Takri                        = Script(0x74616b72) // takr
	Tamil                        = Script(0x74616d6c) // taml
	Tangsa                       = Script(0x746e7361) // tnsa
	Tangut                       = Script(0x74616e67) // tang
	Telugu                       = Script(0x74656c75) // telu
	Tengwar                      = Script(0x74656e67) // teng
	Thaana                       = Script(0x74686161) // thaa
	Thai                         = Script(0x74686169) // thai
	Tibetan                      = Script(0x74696274) // tibt
	Tifinagh                     = Script(0x74666e67) // tfng
	Tirhuta                      = Script(0x74697268) // tirh
	Toto                         = Script(0x746f746f) // toto
	Ugaritic                     = Script(0x75676172) // ugar
	Unknown                      = Script(0x7a7a7a7a) // zzzz
	Vai                          = Script(0x76616969) // vaii
	Visible_Speech               = Script(0x76697370) // visp
	Vithkuqi                     = Script(0x76697468) // vith
	Wancho                       = Script(0x7763686f) // wcho
	Warang_Citi                  = Script(0x77617261) // wara
	Woleai                       = Script(0x776f6c65) // wole
	Yezidi                       = Script(0x79657a69) // yezi
	Yi                           = Script(0x79696969) // yiii
	Zanabazar_Square             = Script(0x7a616e62) // zanb
)

Variables

View Source
var ScriptRanges = [...]ScriptRange{}/* 952 elements not displayed */

ScriptRanges is a sorted list of script ranges.

Functions

This section is empty.

Types

type Language

type Language string

Language store the canonicalized BCP 47 tag, which has the generic form <lang>-<country>-<other tags>...

func DefaultLanguage

func DefaultLanguage() Language

DefaultLanguage returns the language found in environment variables LC_ALL, LC_CTYPE or LANG (in that order), or the zero value if not found.

func NewLanguage

func NewLanguage(language string) Language

NewLanguage canonicalizes the language input (as a BCP 47 language tag), by converting it to lowercase, mapping '_' to '-', and stripping all characters other than letters, numbers and '-'.

func (Language) Compare

func (l Language) Compare(other Language) LanguageComparison

Compare compares `other` and `l`. Undetermined languages are only compared using the remaining tags, meaning that "und-fr" and "und-be" are compared as LanguagesDiffer, not LanguagePrimaryMatch.

func (Language) IsDerivedFrom

func (l Language) IsDerivedFrom(root Language) bool

IsDerivedFrom returns `true` if `l` has the `root` as primary language.

func (Language) IsUndetermined

func (l Language) IsUndetermined() bool

IsUndetermined returns `true` if its primary language is "und". It is a shortcut for IsDerivedFrom("und").

func (Language) Primary

func (l Language) Primary() Language

Primary returns the root language of l, that is the part before the first '-' separator

func (Language) SimpleInheritance

func (l Language) SimpleInheritance() []Language

SimpleInheritance returns the list of matching language, using simple truncation inheritance. The resulting slice starts with the given whole language. See http://www.unicode.org/reports/tr35/#Locale_Inheritance for more information.

func (Language) SplitExtensionTags

func (l Language) SplitExtensionTags() (prefix, private Language)

SplitExtensionTags splits the language at the extension and private-use subtags, which are marked by a "-<one char>-" pattern. It returns the language before the first pattern, and, if any, the private-use subtag.

(l, "") is returned if the language has no extension or private-use tag.

type LanguageComparison

type LanguageComparison uint8

LanguageComparison is a three state enum resulting from comparing two languages

const (
	LanguagesDiffer      LanguageComparison = iota // the two languages are totally differents
	LanguagesExactMatch                            // the two languages are exactly the same
	LanguagePrimaryMatch                           // the two languages have the same primary language, but differs.
)

type Script

type Script uint32

Script identifies different writing systems. It is represented as the binary encoding of a script tag of 4 (case sensitive) letters, as specified by ISO 15924. Note that the default value is usually the Unknown script, not the 0 value (which is invalid)

func LookupScript

func LookupScript(r rune) Script

LookupScript looks up the script for a particular character (as defined by Unicode Standard Annex #24), and returns Unknown if not found.

func ParseScript

func ParseScript(script string) (Script, error)

ParseScript simply converts a 4 bytes string into its binary encoding. If [script] is longer, only its 4 first bytes are used.

func (Script) String

func (s Script) String() string

String returns the ISO 4 lower letters code of the script

type ScriptRange

type ScriptRange struct {
	Start, End rune
	Script     Script
}

ScriptRange is an inclusive range of runes with constant script.

Jump to

Keyboard shortcuts

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