Documentation ¶
Index ¶
- Constants
- Variables
- type Language
- func (l Language) Compare(other Language) LanguageComparison
- func (l Language) IsDerivedFrom(root Language) bool
- func (l Language) IsUndetermined() bool
- func (l Language) Primary() Language
- func (l Language) SimpleInheritance() []Language
- func (l Language) SplitExtensionTags() (prefix, private Language)
- type LanguageComparison
- type Script
- type ScriptRange
Constants ¶
const ( Adlam = Script(0x41646c6d) // Adlm Afaka = Script(0x4166616b) // Afak Ahom = Script(0x41686f6d) // Ahom Anatolian_Hieroglyphs = Script(0x486c7577) // Hluw Arabic = Script(0x41726162) // Arab Armenian = Script(0x41726d6e) // Armn Avestan = Script(0x41767374) // Avst Balinese = Script(0x42616c69) // Bali Bamum = Script(0x42616d75) // Bamu Bassa_Vah = Script(0x42617373) // Bass Batak = Script(0x4261746b) // Batk Bengali = Script(0x42656e67) // Beng Bhaiksuki = Script(0x42686b73) // Bhks Blissymbols = Script(0x426c6973) // Blis Book_Pahlavi = Script(0x50686c76) // Phlv Bopomofo = Script(0x426f706f) // Bopo Brahmi = Script(0x42726168) // Brah Braille = Script(0x42726169) // Brai Buginese = Script(0x42756769) // Bugi Buhid = Script(0x42756864) // Buhd Canadian_Aboriginal = Script(0x43616e73) // Cans Carian = Script(0x43617269) // Cari Caucasian_Albanian = Script(0x41676862) // Aghb Chakma = Script(0x43616b6d) // Cakm Cham = Script(0x4368616d) // Cham Cherokee = Script(0x43686572) // Cher Chorasmian = Script(0x43687273) // Chrs Cirth = Script(0x43697274) // Cirt Code_for_unwritten_documents = Script(0x5a787878) // Zxxx Common = Script(0x5a797979) // Zyyy Coptic = Script(0x436f7074) // Copt Cuneiform = Script(0x58737578) // Xsux Cypriot = Script(0x43707274) // Cprt Cypro_Minoan = Script(0x43706d6e) // Cpmn Cyrillic = Script(0x4379726c) // Cyrl Deseret = Script(0x44737274) // Dsrt Devanagari = Script(0x44657661) // Deva Dives_Akuru = Script(0x4469616b) // Diak Dogra = Script(0x446f6772) // Dogr Duployan = Script(0x4475706c) // Dupl Egyptian_Hieroglyphs = Script(0x45677970) // Egyp Egyptian_demotic = Script(0x45677964) // Egyd Egyptian_hieratic = Script(0x45677968) // Egyh Elbasan = Script(0x456c6261) // Elba Elymaic = Script(0x456c796d) // Elym Ethiopic = Script(0x45746869) // Ethi Georgian = Script(0x47656f72) // Geor Glagolitic = Script(0x476c6167) // Glag Gothic = Script(0x476f7468) // Goth Grantha = Script(0x4772616e) // Gran Greek = Script(0x4772656b) // Grek Gujarati = Script(0x47756a72) // Gujr Gunjala_Gondi = Script(0x476f6e67) // Gong Gurmukhi = Script(0x47757275) // Guru Han = Script(0x48616e69) // Hani Hangul = Script(0x48616e67) // Hang Hanifi_Rohingya = Script(0x526f6867) // Rohg Hanunoo = Script(0x48616e6f) // Hano Hatran = Script(0x48617472) // Hatr Hebrew = Script(0x48656272) // Hebr Hiragana = Script(0x48697261) // Hira Imperial_Aramaic = Script(0x41726d69) // Armi Inherited = Script(0x5a696e68) // Zinh Inscriptional_Pahlavi = Script(0x50686c69) // Phli Inscriptional_Parthian = Script(0x50727469) // Prti Javanese = Script(0x4a617661) // Java Jurchen = Script(0x4a757263) // Jurc Kaithi = Script(0x4b746869) // Kthi Kannada = Script(0x4b6e6461) // Knda Katakana = Script(0x4b616e61) // Kana Katakana_Or_Hiragana = Script(0x48726b74) // Hrkt Kawi = Script(0x4b617769) // Kawi Kayah_Li = Script(0x4b616c69) // Kali Kharoshthi = Script(0x4b686172) // Khar Khitan_Small_Script = Script(0x4b697473) // Kits Khitan_large_script = Script(0x4b69746c) // Kitl Khmer = Script(0x4b686d72) // Khmr Khojki = Script(0x4b686f6a) // Khoj Khudawadi = Script(0x53696e64) // Sind Kpelle = Script(0x4b70656c) // Kpel Lao = Script(0x4c616f6f) // Laoo Latin = Script(0x4c61746e) // Latn Leke = Script(0x4c656b65) // Leke Lepcha = Script(0x4c657063) // Lepc Limbu = Script(0x4c696d62) // Limb Linear_A = Script(0x4c696e61) // Lina Linear_B = Script(0x4c696e62) // Linb Lisu = Script(0x4c697375) // Lisu Loma = Script(0x4c6f6d61) // Loma Lycian = Script(0x4c796369) // Lyci Lydian = Script(0x4c796469) // Lydi Mahajani = Script(0x4d61686a) // Mahj Makasar = Script(0x4d616b61) // Maka Malayalam = Script(0x4d6c796d) // Mlym Mandaic = Script(0x4d616e64) // Mand Manichaean = Script(0x4d616e69) // Mani Marchen = Script(0x4d617263) // Marc Masaram_Gondi = Script(0x476f6e6d) // Gonm Mathematical_notation = Script(0x5a6d7468) // Zmth Mayan_hieroglyphs = Script(0x4d617961) // Maya Medefaidrin = Script(0x4d656466) // Medf Meetei_Mayek = Script(0x4d746569) // Mtei Mende_Kikakui = Script(0x4d656e64) // Mend Meroitic_Cursive = Script(0x4d657263) // Merc Meroitic_Hieroglyphs = Script(0x4d65726f) // Mero Miao = Script(0x506c7264) // Plrd Modi = Script(0x4d6f6469) // Modi Mongolian = Script(0x4d6f6e67) // Mong Mro = Script(0x4d726f6f) // Mroo Multani = Script(0x4d756c74) // Mult Myanmar = Script(0x4d796d72) // Mymr Nabataean = Script(0x4e626174) // Nbat Nag_Mundari = Script(0x4e61676d) // Nagm Nandinagari = Script(0x4e616e64) // Nand New_Tai_Lue = Script(0x54616c75) // Talu Newa = Script(0x4e657761) // Newa Nko = Script(0x4e6b6f6f) // Nkoo Nushu = Script(0x4e736875) // Nshu Nyiakeng_Puachue_Hmong = Script(0x486d6e70) // Hmnp Ogham = Script(0x4f67616d) // Ogam Ol_Chiki = Script(0x4f6c636b) // Olck Old_Hungarian = Script(0x48756e67) // Hung Old_Italic = Script(0x4974616c) // Ital Old_North_Arabian = Script(0x4e617262) // Narb Old_Permic = Script(0x5065726d) // Perm Old_Persian = Script(0x5870656f) // Xpeo Old_Sogdian = Script(0x536f676f) // Sogo Old_South_Arabian = Script(0x53617262) // Sarb Old_Turkic = Script(0x4f726b68) // Orkh Old_Uyghur = Script(0x4f756772) // Ougr Oriya = Script(0x4f727961) // Orya Osage = Script(0x4f736765) // Osge Osmanya = Script(0x4f736d61) // Osma Pahawh_Hmong = Script(0x486d6e67) // Hmng Palmyrene = Script(0x50616c6d) // Palm Pau_Cin_Hau = Script(0x50617563) // Pauc Phags_Pa = Script(0x50686167) // Phag Phoenician = Script(0x50686e78) // Phnx Psalter_Pahlavi = Script(0x50686c70) // Phlp Ranjana = Script(0x52616e6a) // Ranj Rejang = Script(0x526a6e67) // Rjng Rongorongo = Script(0x526f726f) // Roro Runic = Script(0x52756e72) // Runr Samaritan = Script(0x53616d72) // Samr Sarati = Script(0x53617261) // Sara Saurashtra = Script(0x53617572) // Saur Sharada = Script(0x53687264) // Shrd Shavian = Script(0x53686177) // Shaw Shuishu = Script(0x53687569) // Shui Siddham = Script(0x53696464) // Sidd SignWriting = Script(0x53676e77) // Sgnw Sinhala = Script(0x53696e68) // Sinh Sogdian = Script(0x536f6764) // Sogd Sora_Sompeng = Script(0x536f7261) // Sora Soyombo = Script(0x536f796f) // Soyo Sundanese = Script(0x53756e64) // Sund Sunuwar = Script(0x53756e75) // Sunu Syloti_Nagri = Script(0x53796c6f) // Sylo Symbols = Script(0x5a73796d) // Zsym Syriac = Script(0x53797263) // Syrc Tagalog = Script(0x54676c67) // Tglg Tagbanwa = Script(0x54616762) // Tagb Tai_Le = Script(0x54616c65) // Tale Tai_Tham = Script(0x4c616e61) // Lana Tai_Viet = Script(0x54617674) // Tavt Takri = Script(0x54616b72) // Takr Tamil = Script(0x54616d6c) // Taml Tangsa = Script(0x546e7361) // Tnsa Tangut = Script(0x54616e67) // Tang Telugu = Script(0x54656c75) // Telu Tengwar = Script(0x54656e67) // Teng Thaana = Script(0x54686161) // Thaa Thai = Script(0x54686169) // Thai Tibetan = Script(0x54696274) // Tibt Tifinagh = Script(0x54666e67) // Tfng Tirhuta = Script(0x54697268) // Tirh Toto = Script(0x546f746f) // Toto Ugaritic = Script(0x55676172) // Ugar Unknown = Script(0x5a7a7a7a) // Zzzz Vai = Script(0x56616969) // Vaii Visible_Speech = Script(0x56697370) // Visp Vithkuqi = Script(0x56697468) // Vith Wancho = Script(0x5763686f) // Wcho Warang_Citi = Script(0x57617261) // Wara Woleai = Script(0x576f6c65) // Wole Yezidi = Script(0x59657a69) // Yezi Yi = Script(0x59696969) // Yiii Zanabazar_Square = Script(0x5a616e62) // Zanb )
Variables ¶
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 ¶
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 ¶
IsDerivedFrom returns `true` if `l` has the `root` as primary language.
func (Language) IsUndetermined ¶
IsUndetermined returns `true` if its primary language is "und". It is a shortcut for IsDerivedFrom("und").
func (Language) Primary ¶
Primary returns the root language of l, that is the part before the first '-' separator
func (Language) SimpleInheritance ¶
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 ¶
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 ¶
LookupScript looks up the script for a particular character (as defined by Unicode Standard Annex #24), and returns Unknown if not found.
func ParseScript ¶
ParseScript converts a 4 bytes string into its binary encoding, enforcing the conventional capitalized case. If [script] is longer, only its 4 first bytes are used.
type ScriptRange ¶
ScriptRange is an inclusive range of runes with constant script.