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