Initial QSfera import

This commit is contained in:
Курнат Андрей
2026-06-07 10:20:04 +03:00
commit 2315f25754
16485 changed files with 4826827 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
.idea/
+9
View File
@@ -0,0 +1,9 @@
# Changelog
## 1.1.1
* remove bh as it was deprecated in 2021
## 1.1.0
* added capitalization to native names
+7
View File
@@ -0,0 +1,7 @@
# Contribute
Report bugs on GitHub and discuss your ideas and feature requests before you open a pull request. Pull requests must pass the test suite and add new tests for each new feature. Bugs should be validated by tests. The Go code must be formatted by gofmt.
## Test coverage
New code must be tested to keep the test coverage above 80% at least.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Emvi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+40
View File
@@ -0,0 +1,40 @@
# ISO 639-1
[![Go Reference](https://pkg.go.dev/badge/github.com/emvi/iso-639-1?status.svg)](https://pkg.go.dev/github.com/emvi/iso-639-1?status)
[![CircleCI](https://circleci.com/gh/emvi/iso-639-1.svg?style=svg)](https://circleci.com/gh/emvi/iso-639-1)
[![Go Report Card](https://goreportcard.com/badge/github.com/emvi/iso-639-1)](https://goreportcard.com/report/github.com/emvi/iso-639-1)
<a href="https://discord.gg/fAYm4Cz"><img src="https://img.shields.io/discord/739184135649886288?logo=discord" alt="Chat on Discord"></a>
List of all ISO 639-1 language names, native names and two character codes as well as functions for convenient access.
The lists of all names and codes (`Codes`, `Names`, `NativeNames`, `Languages`) are build in the init function for quick read access.
For full documentation please read the Godocs.
## Installation
```
go get github.com/emvi/iso-639-1
```
## Example
```
fmt.Println(iso6391.Codes) // print all codes
fmt.Println(iso6391.Names) // print all names
fmt.Println(iso6391.NativeNames) // print all native names
fmt.Println(iso6391.Languages) // print all language objects {Code, Name, NativeName}
fmt.Println(iso6391.FromCode("en")) // prints {Code: "en", Name: "English", NativeName: "English"}
fmt.Println(iso6391.Name("en")) // prints "English"
fmt.Println(iso6391.NativeName("zh")) // prints "中文"
fmt.Println(iso6391.CodeFromName("English")) // prints "en"
fmt.Println(iso6391.ValidCode("en")) // prints true
// ... see Godoc for more functions
```
## Contribute
[See CONTRIBUTING.md](CONTRIBUTING.md)
## License
MIT
+24
View File
@@ -0,0 +1,24 @@
package iso6391
var (
// Codes is a list of all ISO 639-1 two character codes.
Codes []string
// Names is a list of all ISO 639-1 english language names.
Names []string
// NativeNames is a list of all ISO 639-1 native language names.
NativeNames []string
)
func init() {
Codes = make([]string, 0, len(Languages))
Names = make([]string, 0, len(Languages))
NativeNames = make([]string, 0, len(Languages))
for key, value := range Languages {
Codes = append(Codes, key)
Names = append(Names, value.Name)
NativeNames = append(NativeNames, value.NativeName)
}
}
+91
View File
@@ -0,0 +1,91 @@
package iso6391
// FromCode returns the language for given code.
func FromCode(code string) Language {
return Languages[code]
}
// FromName returns the language for given name.
func FromName(name string) Language {
for _, lang := range Languages {
if lang.Name == name {
return lang
}
}
return Language{}
}
// FromNativeName returns the language for given native name.
func FromNativeName(name string) Language {
for _, lang := range Languages {
if lang.NativeName == name {
return lang
}
}
return Language{}
}
// Name returns the language name in english for given code.
func Name(code string) string {
return FromCode(code).Name
}
// NativeName returns the language native name for given code.
func NativeName(code string) string {
return FromCode(code).NativeName
}
// CodeForName returns the language code for given name.
func CodeForName(name string) string {
for code, lang := range Languages {
if lang.Name == name {
return code
}
}
return ""
}
// CodeForNativeName returns the language code for given native name.
func CodeForNativeName(name string) string {
for code, lang := range Languages {
if lang.NativeName == name {
return code
}
}
return ""
}
// ValidCode returns true if the given code is a valid ISO 639-1 language code.
// The code must be passed in lowercase.
func ValidCode(code string) bool {
_, ok := Languages[code]
return ok
}
// ValidName returns true if the given name is a valid ISO 639-1 language name.
// The name must use uppercase characters (e.g. English, Hiri Motu, ...).
func ValidName(name string) bool {
for _, lang := range Languages {
if lang.Name == name {
return true
}
}
return false
}
// ValidNativeName returns true if the given code is a valid ISO 639-1 language native name.
// The name must be passed in its native form (e.g. English, 中文, ...).
func ValidNativeName(name string) bool {
for _, lang := range Languages {
if lang.NativeName == name {
return true
}
}
return false
}
+195
View File
@@ -0,0 +1,195 @@
package iso6391
// Language is an ISO 639-1 language with code, name and native name.
type Language struct {
Code string
Name string
NativeName string
}
// Languages is a map of all ISO 639-1 languages using the two character lowercase language code as key.
var Languages = map[string]Language{
"aa": {Code: "aa", Name: "Afar", NativeName: "Afaraf"},
"ab": {Code: "ab", Name: "Abkhaz", NativeName: "Аҧсуа бызшәа"},
"ae": {Code: "ae", Name: "Avestan", NativeName: "Avesta"},
"af": {Code: "af", Name: "Afrikaans", NativeName: "Afrikaans"},
"ak": {Code: "ak", Name: "Akan", NativeName: "Akan"},
"am": {Code: "am", Name: "Amharic", NativeName: "አማርኛ"},
"an": {Code: "an", Name: "Aragonese", NativeName: "Aragonés"},
"ar": {Code: "ar", Name: "Arabic", NativeName: "اللغة العربية"},
"as": {Code: "as", Name: "Assamese", NativeName: "অসমীয়া"},
"av": {Code: "av", Name: "Avaric", NativeName: "Авар мацӀ"},
"ay": {Code: "ay", Name: "Aymara", NativeName: "Aymar aru"},
"az": {Code: "az", Name: "Azerbaijani", NativeName: "Azərbaycan dili"},
"ba": {Code: "ba", Name: "Bashkir", NativeName: "Башҡорт теле"},
"be": {Code: "be", Name: "Belarusian", NativeName: "Беларуская мова"},
"bg": {Code: "bg", Name: "Bulgarian", NativeName: "Български език"},
"bi": {Code: "bi", Name: "Bislama", NativeName: "Bislama"},
"bm": {Code: "bm", Name: "Bambara", NativeName: "Bamanankan"},
"bn": {Code: "bn", Name: "Bengali", NativeName: "বাংলা"},
"bo": {Code: "bo", Name: "Tibetan Standard", NativeName: "བོད་ཡིག"},
"br": {Code: "br", Name: "Breton", NativeName: "Brezhoneg"},
"bs": {Code: "bs", Name: "Bosnian", NativeName: "Bosanski jezik"},
"ca": {Code: "ca", Name: "Catalan", NativeName: "Català"},
"ce": {Code: "ce", Name: "Chechen", NativeName: "Нохчийн мотт"},
"ch": {Code: "ch", Name: "Chamorro", NativeName: "Chamoru"},
"co": {Code: "co", Name: "Corsican", NativeName: "Corsu"},
"cr": {Code: "cr", Name: "Cree", NativeName: "ᓀᐦᐃᔭᐍᐏᐣ"},
"cs": {Code: "cs", Name: "Czech", NativeName: "Čeština"},
"cu": {Code: "cu", Name: "Old Church Slavonic", NativeName: "Ѩзыкъ словѣньскъ"},
"cv": {Code: "cv", Name: "Chuvash", NativeName: "Чӑваш чӗлхи"},
"cy": {Code: "cy", Name: "Welsh", NativeName: "Cymraeg"},
"da": {Code: "da", Name: "Danish", NativeName: "Dansk"},
"de": {Code: "de", Name: "German", NativeName: "Deutsch"},
"dv": {Code: "dv", Name: "Divehi", NativeName: "Dhivehi"},
"dz": {Code: "dz", Name: "Dzongkha", NativeName: "རྫོང་ཁ"},
"ee": {Code: "ee", Name: "Ewe", NativeName: "Eʋegbe"},
"el": {Code: "el", Name: "Greek", NativeName: "Ελληνικά"},
"en": {Code: "en", Name: "English", NativeName: "English"},
"eo": {Code: "eo", Name: "Esperanto", NativeName: "Esperanto"},
"es": {Code: "es", Name: "Spanish", NativeName: "Español"},
"et": {Code: "et", Name: "Estonian", NativeName: "Eesti"},
"eu": {Code: "eu", Name: "Basque", NativeName: "Euskara"},
"fa": {Code: "fa", Name: "Persian", NativeName: "فارسی"},
"ff": {Code: "ff", Name: "Fula", NativeName: "Fulfulde"},
"fi": {Code: "fi", Name: "Finnish", NativeName: "Suomi"},
"fj": {Code: "fj", Name: "Fijian", NativeName: "Vakaviti"},
"fo": {Code: "fo", Name: "Faroese", NativeName: "Føroyskt"},
"fr": {Code: "fr", Name: "French", NativeName: "Français"},
"fy": {Code: "fy", Name: "Western Frisian", NativeName: "Frysk"},
"ga": {Code: "ga", Name: "Irish", NativeName: "Gaeilge"},
"gd": {Code: "gd", Name: "Scottish Gaelic", NativeName: "Gàidhlig"},
"gl": {Code: "gl", Name: "Galician", NativeName: "Galego"},
"gn": {Code: "gn", Name: "Guaraní", NativeName: "Avañeẽ"},
"gu": {Code: "gu", Name: "Gujarati", NativeName: "ગુજરાતી"},
"gv": {Code: "gv", Name: "Manx", NativeName: "Gaelg"},
"ha": {Code: "ha", Name: "Hausa", NativeName: "هَوُسَ"},
"he": {Code: "he", Name: "Hebrew", NativeName: "עברית"},
"hi": {Code: "hi", Name: "Hindi", NativeName: "हिन्दी"},
"ho": {Code: "ho", Name: "Hiri Motu", NativeName: "Hiri Motu"},
"hr": {Code: "hr", Name: "Croatian", NativeName: "Hrvatski jezik"},
"ht": {Code: "ht", Name: "Haitian", NativeName: "Kreyòl ayisyen"},
"hu": {Code: "hu", Name: "Hungarian", NativeName: "Magyar"},
"hy": {Code: "hy", Name: "Armenian", NativeName: "Հայերեն"},
"hz": {Code: "hz", Name: "Herero", NativeName: "Otjiherero"},
"ia": {Code: "ia", Name: "Interlingua", NativeName: "Interlingua"},
"id": {Code: "id", Name: "Indonesian", NativeName: "Indonesian"},
"ie": {Code: "ie", Name: "Interlingue", NativeName: "Interlingue"},
"ig": {Code: "ig", Name: "Igbo", NativeName: "Asụsụ Igbo"},
"ii": {Code: "ii", Name: "Nuosu", NativeName: "ꆈꌠ꒿ Nuosuhxop"},
"ik": {Code: "ik", Name: "Inupiaq", NativeName: "Iñupiaq"},
"io": {Code: "io", Name: "Ido", NativeName: "Ido"},
"is": {Code: "is", Name: "Icelandic", NativeName: "Íslenska"},
"it": {Code: "it", Name: "Italian", NativeName: "Italiano"},
"iu": {Code: "iu", Name: "Inuktitut", NativeName: "ᐃᓄᒃᑎᑐᑦ"},
"ja": {Code: "ja", Name: "Japanese", NativeName: "日本語"},
"jv": {Code: "jv", Name: "Javanese", NativeName: "Basa Jawa"},
"ka": {Code: "ka", Name: "Georgian", NativeName: "Ქართული"},
"kg": {Code: "kg", Name: "Kongo", NativeName: "Kikongo"},
"ki": {Code: "ki", Name: "Kikuyu", NativeName: "Gĩkũyũ"},
"kj": {Code: "kj", Name: "Kwanyama", NativeName: "Kuanyama"},
"kk": {Code: "kk", Name: "Kazakh", NativeName: "Қазақ тілі"},
"kl": {Code: "kl", Name: "Kalaallisut", NativeName: "Kalaallisut"},
"km": {Code: "km", Name: "Khmer", NativeName: "ខេមរភាសា"},
"kn": {Code: "kn", Name: "Kannada", NativeName: "ಕನ್ನಡ"},
"ko": {Code: "ko", Name: "Korean", NativeName: "한국어"},
"kr": {Code: "kr", Name: "Kanuri", NativeName: "Kanuri"},
"ks": {Code: "ks", Name: "Kashmiri", NativeName: "कश्मीरी"},
"ku": {Code: "ku", Name: "Kurdish", NativeName: "Kurdî"},
"kv": {Code: "kv", Name: "Komi", NativeName: "Коми кыв"},
"kw": {Code: "kw", Name: "Cornish", NativeName: "Kernewek"},
"ky": {Code: "ky", Name: "Kyrgyz", NativeName: "Кыргызча"},
"la": {Code: "la", Name: "Latin", NativeName: "Latine"},
"lb": {Code: "lb", Name: "Luxembourgish", NativeName: "Lëtzebuergesch"},
"lg": {Code: "lg", Name: "Ganda", NativeName: "Luganda"},
"li": {Code: "li", Name: "Limburgish", NativeName: "Limburgs"},
"ln": {Code: "ln", Name: "Lingala", NativeName: "Lingála"},
"lo": {Code: "lo", Name: "Lao", NativeName: "ພາສາ"},
"lt": {Code: "lt", Name: "Lithuanian", NativeName: "Lietuvių kalba"},
"lu": {Code: "lu", Name: "Luba-Katanga", NativeName: "Tshiluba"},
"lv": {Code: "lv", Name: "Latvian", NativeName: "Latviešu valoda"},
"mg": {Code: "mg", Name: "Malagasy", NativeName: "Fiteny malagasy"},
"mh": {Code: "mh", Name: "Marshallese", NativeName: "Kajin M̧ajeļ"},
"mi": {Code: "mi", Name: "Māori", NativeName: "Te reo Māori"},
"mk": {Code: "mk", Name: "Macedonian", NativeName: "Македонски јазик"},
"ml": {Code: "ml", Name: "Malayalam", NativeName: "മലയാളം"},
"mn": {Code: "mn", Name: "Mongolian", NativeName: "Монгол хэл"},
"mr": {Code: "mr", Name: "Marathi", NativeName: "मराठी"},
"ms": {Code: "ms", Name: "Malay", NativeName: "هاس ملايو‎"},
"mt": {Code: "mt", Name: "Maltese", NativeName: "Malti"},
"my": {Code: "my", Name: "Burmese", NativeName: "ဗမာစာ"},
"na": {Code: "na", Name: "Nauru", NativeName: "Ekakairũ Naoero"},
"nb": {Code: "nb", Name: "Norwegian Bokmål", NativeName: "Norsk bokmål"},
"nd": {Code: "nd", Name: "Northern Ndebele", NativeName: "IsiNdebele"},
"ne": {Code: "ne", Name: "Nepali", NativeName: "नेपाली"},
"ng": {Code: "ng", Name: "Ndonga", NativeName: "Owambo"},
"nl": {Code: "nl", Name: "Dutch", NativeName: "Nederlands"},
"nn": {Code: "nn", Name: "Norwegian Nynorsk", NativeName: "Norsk nynorsk"},
"no": {Code: "no", Name: "Norwegian", NativeName: "Norsk"},
"nr": {Code: "nr", Name: "Southern Ndebele", NativeName: "IsiNdebele"},
"nv": {Code: "nv", Name: "Navajo", NativeName: "Diné bizaad"},
"ny": {Code: "ny", Name: "Chichewa", NativeName: "ChiCheŵa"},
"oc": {Code: "oc", Name: "Occitan", NativeName: "Occitan"},
"oj": {Code: "oj", Name: "Ojibwe", NativeName: "ᐊᓂᔑᓈᐯᒧᐎᓐ"},
"om": {Code: "om", Name: "Oromo", NativeName: "Afaan Oromoo"},
"or": {Code: "or", Name: "Oriya", NativeName: "ଓଡ଼ିଆ"},
"os": {Code: "os", Name: "Ossetian", NativeName: "Ирон æвзаг"},
"pa": {Code: "pa", Name: "Panjabi", NativeName: "ਪੰਜਾਬੀ"},
"pi": {Code: "pi", Name: "Pāli", NativeName: "पाऴि"},
"pl": {Code: "pl", Name: "Polish", NativeName: "Język polski"},
"ps": {Code: "ps", Name: "Pashto", NativeName: "پښتو"},
"pt": {Code: "pt", Name: "Portuguese", NativeName: "Português"},
"qu": {Code: "qu", Name: "Quechua", NativeName: "Runa Simi"},
"rm": {Code: "rm", Name: "Romansh", NativeName: "Rumantsch grischun"},
"rn": {Code: "rn", Name: "Kirundi", NativeName: "Ikirundi"},
"ro": {Code: "ro", Name: "Romanian", NativeName: "Română"},
"ru": {Code: "ru", Name: "Russian", NativeName: "Русский"},
"rw": {Code: "rw", Name: "Kinyarwanda", NativeName: "Ikinyarwanda"},
"sa": {Code: "sa", Name: "Sanskrit", NativeName: "संस्कृतम्"},
"sc": {Code: "sc", Name: "Sardinian", NativeName: "Sardu"},
"sd": {Code: "sd", Name: "Sindhi", NativeName: "सिन्धी"},
"se": {Code: "se", Name: "Northern Sami", NativeName: "Davvisámegiella"},
"sg": {Code: "sg", Name: "Sango", NativeName: "Yângâ tî sängö"},
"si": {Code: "si", Name: "Sinhala", NativeName: "සිංහල"},
"sk": {Code: "sk", Name: "Slovak", NativeName: "Slovenčina"},
"sl": {Code: "sl", Name: "Slovene", NativeName: "Slovenski jezik"},
"sm": {Code: "sm", Name: "Samoan", NativeName: "Gagana faa Samoa"},
"sn": {Code: "sn", Name: "Shona", NativeName: "ChiShona"},
"so": {Code: "so", Name: "Somali", NativeName: "Soomaaliga"},
"sq": {Code: "sq", Name: "Albanian", NativeName: "Shqip"},
"sr": {Code: "sr", Name: "Serbian", NativeName: "Српски језик"},
"ss": {Code: "ss", Name: "Swati", NativeName: "SiSwati"},
"st": {Code: "st", Name: "Southern Sotho", NativeName: "Sesotho"},
"su": {Code: "su", Name: "Sundanese", NativeName: "Basa Sunda"},
"sv": {Code: "sv", Name: "Swedish", NativeName: "Svenska"},
"sw": {Code: "sw", Name: "Swahili", NativeName: "Kiswahili"},
"ta": {Code: "ta", Name: "Tamil", NativeName: "தமிழ்"},
"te": {Code: "te", Name: "Telugu", NativeName: "తెలుగు"},
"tg": {Code: "tg", Name: "Tajik", NativeName: "Тоҷикӣ"},
"th": {Code: "th", Name: "Thai", NativeName: "ไทย"},
"ti": {Code: "ti", Name: "Tigrinya", NativeName: "ትግርኛ"},
"tk": {Code: "tk", Name: "Turkmen", NativeName: "Türkmen"},
"tl": {Code: "tl", Name: "Tagalog", NativeName: "Wikang Tagalog"},
"tn": {Code: "tn", Name: "Tswana", NativeName: "Setswana"},
"to": {Code: "to", Name: "Tonga", NativeName: "Faka Tonga"},
"tr": {Code: "tr", Name: "Turkish", NativeName: "Türkçe"},
"ts": {Code: "ts", Name: "Tsonga", NativeName: "Xitsonga"},
"tt": {Code: "tt", Name: "Tatar", NativeName: "Татар теле"},
"tw": {Code: "tw", Name: "Twi", NativeName: "Twi"},
"ty": {Code: "ty", Name: "Tahitian", NativeName: "Reo Tahiti"},
"ug": {Code: "ug", Name: "Uyghur", NativeName: "ئۇيغۇرچە‎"},
"uk": {Code: "uk", Name: "Ukrainian", NativeName: "Українська"},
"ur": {Code: "ur", Name: "Urdu", NativeName: "اردو"},
"uz": {Code: "uz", Name: "Uzbek", NativeName: "Ўзбек"},
"ve": {Code: "ve", Name: "Venda", NativeName: "Tshivenḓa"},
"vi": {Code: "vi", Name: "Vietnamese", NativeName: "Tiếng Việt"},
"vo": {Code: "vo", Name: "Volapük", NativeName: "Volapük"},
"wa": {Code: "wa", Name: "Walloon", NativeName: "Walon"},
"wo": {Code: "wo", Name: "Wolof", NativeName: "Wollof"},
"xh": {Code: "xh", Name: "Xhosa", NativeName: "IsiXhosa"},
"yi": {Code: "yi", Name: "Yiddish", NativeName: "ייִדיש"},
"yo": {Code: "yo", Name: "Yoruba", NativeName: "Yorùbá"},
"za": {Code: "za", Name: "Zhuang", NativeName: "Saɯ cueŋƅ"},
"zh": {Code: "zh", Name: "Chinese", NativeName: "中文"},
"zu": {Code: "zu", Name: "Zulu", NativeName: "IsiZulu"},
}