update langs to use native names fix #339

This commit is contained in:
Cloudburst 2023-02-07 10:04:27 +00:00
parent 2ff90c03ca
commit f939e4cff2
3 changed files with 39 additions and 39 deletions

5
.github/locales.py vendored
View file

@ -7,7 +7,7 @@ SETTINGS_PATH = "app/src/main/java/com/lagradost/cloudstream3/ui/settings/Settin
START_MARKER = "/* begin language list */"
END_MARKER = "/* end language list */"
XML_NAME = "app/src/main/res/values-"
ISO_MAP_URL = "https://gist.githubusercontent.com/Josantonius/b455e315bc7f790d14b136d61d9ae469/raw"
ISO_MAP_URL = "https://raw.githubusercontent.com/haliaeetus/iso-639/master/data/iso_639-1.min.json"
INDENT = " "*4
iso_map = requests.get(ISO_MAP_URL, timeout=300).json()
@ -27,7 +27,8 @@ for lang in re.finditer(r'Triple\("(.*)", "(.*)", "(.*)"\)', rest):
for folder in glob.glob(f"{XML_NAME}*"):
iso = folder[len(XML_NAME):]
if iso not in languages.keys():
languages[iso] = ("", iso_map.get(iso.lower(),iso))
entry = iso_map.get(iso.lower(),{'nativeName':iso})
languages[iso] = ("", entry['nativeName'].split(',')[0])
# Create triples
triples = []

View file

@ -56,45 +56,44 @@ fun getCurrentLocale(context: Context): String {
// https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes leave blank for auto
val appLanguages = arrayListOf(
/* begin language list */
Triple("", "Arabic", "ar"),
Triple("", "Bulgarian", "bg"),
Triple("", "Bengali", "bn"),
Triple("", "العربية", "ar"),
Triple("", "български език", "bg"),
Triple("", "বাংলা", "bn"),
Triple("\uD83C\uDDE7\uD83C\uDDF7", "Brazilian Portuguese", "bp"),
Triple("", "Czech", "cs"),
Triple("", "German", "de"),
Triple("", "Greek", "el"),
Triple("", "English", "en"),
Triple("", "čeština", "cs"),
Triple("", "Deutsch", "de"),
Triple("", "ελληνικά", "el"),
Triple("", "Esperanto", "eo"),
Triple("", "Spanish", "es"),
Triple("", "Farsi", "fa"),
Triple("", "French", "fr"),
Triple("", "Hindi", "hi"),
Triple("", "Croatian", "hr"),
Triple("", "Hungarian", "hu"),
Triple("\uD83C\uDDEE\uD83C\uDDE9", "Indonesian", "in"),
Triple("", "Italian", "it"),
Triple("\uD83C\uDDEE\uD83C\uDDF1", "Hebrew", "iw"),
Triple("", "Kannada", "kn"),
Triple("", "Macedonian", "mk"),
Triple("", "Malayalam", "ml"),
Triple("", "Moldavian", "mo"),
Triple("", "Dutch", "nl"),
Triple("", "Norwegian Nynorsk", "nn"),
Triple("", "Norwegian", "no"),
Triple("", "Polish", "pl"),
Triple("\uD83C\uDDF5\uD83C\uDDF9", "Portuguese", "pt"),
Triple("", "Romanian", "ro"),
Triple("", "Russian", "ru"),
Triple("", "Slovak", "sk"),
Triple("", "Somali", "so"),
Triple("", "Swedish", "sv"),
Triple("", "Tamil", "ta"),
Triple("", "Tagalog", "tl"),
Triple("", "Turkish", "tr"),
Triple("", "Ukrainian", "uk"),
Triple("", "Urdu", "ur"),
Triple("", "Viet Nam", "vi"),
Triple("", "Chinese Simplified", "zh"),
Triple("", "Español", "es"),
Triple("", "فارسی", "fa"),
Triple("", "français", "fr"),
Triple("", "हिन्दी", "hi"),
Triple("", "hrvatski jezik", "hr"),
Triple("", "magyar", "hu"),
Triple("", "in", "in"),
Triple("", "Italiano", "it"),
Triple("\uD83C\uDDEE\uD83C\uDDF1", "עִברִית", "iw"),
Triple("", "ಕನ್ನಡ", "kn"),
Triple("", "македонски јазик", "mk"),
Triple("", "മലയാളം", "ml"),
Triple("🦍", "Monke", "mo"),
Triple("", "Nederlands", "nl"),
Triple("", "Norsk nynorsk", "nn"),
Triple("", "Norsk", "no"),
Triple("", "język polski", "pl"),
Triple("\uD83C\uDDF5\uD83C\uDDF9", "Português", "pt"),
Triple("", "Română", "ro"),
Triple("", "Русский", "ru"),
Triple("", "slovenčina", "sk"),
Triple("", "Soomaaliga", "so"),
Triple("", "svenska", "sv"),
Triple("", "தமிழ்", "ta"),
Triple("", "Wikang Tagalog", "tl"),
Triple("", "Türkçe", "tr"),
Triple("", "Українська", "uk"),
Triple("", "اردو", "ur"),
Triple("", "Tiếng Việt", "vi"),
Triple("", "中文 (Zhōngwén)", "zh"),
Triple("\uD83C\uDDF9\uD83C\uDDFC", "Chinese Traditional", "zh-rTW"),
/* end language list */
).sortedBy { it.second } //ye, we go alphabetical, so ppl don't put their lang on top