Documentation ¶
Index ¶
Constants ¶
const ( Adlam = Script(0x61646c6d) Ahom = Script(0x61686f6d) Anatolian_Hieroglyphs = Script(0x686c7577) Arabic = Script(0x61726162) Armenian = Script(0x61726d6e) Avestan = Script(0x61767374) Balinese = Script(0x62616c69) Bamum = Script(0x62616d75) Bassa_Vah = Script(0x62617373) Batak = Script(0x6261746b) Bengali = Script(0x62656e67) Bhaiksuki = Script(0x62686b73) Bopomofo = Script(0x626f706f) Brahmi = Script(0x62726168) Braille = Script(0x62726169) Buginese = Script(0x62756769) Buhid = Script(0x62756864) Canadian_Aboriginal = Script(0x63616e73) Carian = Script(0x63617269) Caucasian_Albanian = Script(0x61676862) Chakma = Script(0x63616b6d) Cham = Script(0x6368616d) Cherokee = Script(0x63686572) Chorasmian = Script(0x63687273) Common = Script(0x7a797979) Coptic = Script(0x636f7074) Cuneiform = Script(0x78737578) Cypriot = Script(0x63707274) Cyrillic = Script(0x6379726c) Deseret = Script(0x64737274) Devanagari = Script(0x64657661) Dives_Akuru = Script(0x6469616b) Dogra = Script(0x646f6772) Duployan = Script(0x6475706c) Egyptian_Hieroglyphs = Script(0x65677970) Elbasan = Script(0x656c6261) Elymaic = Script(0x656c796d) Ethiopic = Script(0x65746869) Georgian = Script(0x67656f72) Glagolitic = Script(0x676c6167) Gothic = Script(0x676f7468) Grantha = Script(0x6772616e) Greek = Script(0x6772656b) Gujarati = Script(0x67756a72) Gunjala_Gondi = Script(0x676f6e67) Gurmukhi = Script(0x67757275) Han = Script(0x68616e69) Hangul = Script(0x68616e67) Hanifi_Rohingya = Script(0x726f6867) Hanunoo = Script(0x68616e6f) Hatran = Script(0x68617472) Hebrew = Script(0x68656272) Hiragana = Script(0x68697261) Imperial_Aramaic = Script(0x61726d69) Inherited = Script(0x7a696e68) Inscriptional_Pahlavi = Script(0x70686c69) Inscriptional_Parthian = Script(0x70727469) Javanese = Script(0x6a617661) Kaithi = Script(0x6b746869) Kannada = Script(0x6b6e6461) Katakana = Script(0x6b616e61) Katakana_Or_Hiragana = Script(0x68726b74) Kayah_Li = Script(0x6b616c69) Kharoshthi = Script(0x6b686172) Khitan_Small_Script = Script(0x6b697473) Khmer = Script(0x6b686d72) Khojki = Script(0x6b686f6a) Khudawadi = Script(0x73696e64) Lao = Script(0x6c616f6f) Latin = Script(0x6c61746e) Lepcha = Script(0x6c657063) Limbu = Script(0x6c696d62) Linear_A = Script(0x6c696e61) Linear_B = Script(0x6c696e62) Lisu = Script(0x6c697375) Lycian = Script(0x6c796369) Lydian = Script(0x6c796469) Mahajani = Script(0x6d61686a) Makasar = Script(0x6d616b61) Malayalam = Script(0x6d6c796d) Mandaic = Script(0x6d616e64) Manichaean = Script(0x6d616e69) Marchen = Script(0x6d617263) Masaram_Gondi = Script(0x676f6e6d) Medefaidrin = Script(0x6d656466) Meetei_Mayek = Script(0x6d746569) Mende_Kikakui = Script(0x6d656e64) Meroitic_Cursive = Script(0x6d657263) Meroitic_Hieroglyphs = Script(0x6d65726f) Miao = Script(0x706c7264) Modi = Script(0x6d6f6469) Mongolian = Script(0x6d6f6e67) Mro = Script(0x6d726f6f) Multani = Script(0x6d756c74) Myanmar = Script(0x6d796d72) Nabataean = Script(0x6e626174) Nandinagari = Script(0x6e616e64) New_Tai_Lue = Script(0x74616c75) Newa = Script(0x6e657761) Nko = Script(0x6e6b6f6f) Nushu = Script(0x6e736875) Nyiakeng_Puachue_Hmong = Script(0x686d6e70) Ogham = Script(0x6f67616d) Ol_Chiki = Script(0x6f6c636b) Old_Hungarian = Script(0x68756e67) Old_Italic = Script(0x6974616c) Old_North_Arabian = Script(0x6e617262) Old_Permic = Script(0x7065726d) Old_Persian = Script(0x7870656f) Old_Sogdian = Script(0x736f676f) Old_South_Arabian = Script(0x73617262) Old_Turkic = Script(0x6f726b68) Oriya = Script(0x6f727961) Osage = Script(0x6f736765) Osmanya = Script(0x6f736d61) Pahawh_Hmong = Script(0x686d6e67) Palmyrene = Script(0x70616c6d) Pau_Cin_Hau = Script(0x70617563) Phags_Pa = Script(0x70686167) Phoenician = Script(0x70686e78) Psalter_Pahlavi = Script(0x70686c70) Rejang = Script(0x726a6e67) Runic = Script(0x72756e72) Samaritan = Script(0x73616d72) Saurashtra = Script(0x73617572) Sharada = Script(0x73687264) Shavian = Script(0x73686177) Siddham = Script(0x73696464) SignWriting = Script(0x73676e77) Sinhala = Script(0x73696e68) Sogdian = Script(0x736f6764) Sora_Sompeng = Script(0x736f7261) Soyombo = Script(0x736f796f) Sundanese = Script(0x73756e64) Syloti_Nagri = Script(0x73796c6f) Syriac = Script(0x73797263) Tagalog = Script(0x74676c67) Tagbanwa = Script(0x74616762) Tai_Le = Script(0x74616c65) Tai_Tham = Script(0x6c616e61) Tai_Viet = Script(0x74617674) Takri = Script(0x74616b72) Tamil = Script(0x74616d6c) Tangut = Script(0x74616e67) Telugu = Script(0x74656c75) Thaana = Script(0x74686161) Thai = Script(0x74686169) Tibetan = Script(0x74696274) Tifinagh = Script(0x74666e67) Tirhuta = Script(0x74697268) Ugaritic = Script(0x75676172) Unknown = Script(0x7a7a7a7a) Vai = Script(0x76616969) Wancho = Script(0x7763686f) Warang_Citi = Script(0x77617261) Yezidi = Script(0x79657a69) Yi = Script(0x79696969) Zanabazar_Square = Script(0x7a616e62) )
Variables ¶
This section is empty.
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 ¶ added in v0.0.2
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 ¶ added in v0.0.6
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 ¶ added in v0.0.4
IsDerivedFrom returns `true` if `l` has the `root` as primary language.
func (Language) IsUndetermined ¶ added in v0.0.6
IsUndetermined returns `true` if its primary language is "und". It is a shortcut for IsDerivedFrom("und").
func (Language) SimpleInheritance ¶ added in v0.0.4
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.
type LanguageComparison ¶ added in v0.0.6
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 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 simply converts a 4 bytes string into its binary encoding.
func (Script) IsRealScript ¶
IsRealScript return `true` if `s` if valid, and neither common or inherited.
func (Script) IsSameScript ¶
IsSameScript compares two scripts: if one them is not 'real' (see IsRealScript), they are compared equal.