feat: added priority to languages
This commit is contained in:
parent
3e6884ad8a
commit
3e692dd74f
@ -119,6 +119,10 @@ class CustomLanguageCode:
|
|||||||
def native_name(self) -> str:
|
def native_name(self) -> str:
|
||||||
return self._get_additional_data()["native_name"]
|
return self._get_additional_data()["native_name"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def priority(self) -> int:
|
||||||
|
return self._get_additional_data().get("priority", 0)
|
||||||
|
|
||||||
|
|
||||||
class Article(CustomPath):
|
class Article(CustomPath):
|
||||||
def __init__(self, path: CustomPath):
|
def __init__(self, path: CustomPath):
|
||||||
@ -209,6 +213,7 @@ class Template:
|
|||||||
|
|
||||||
overview_card_template = self.get_overview_card_template()
|
overview_card_template = self.get_overview_card_template()
|
||||||
|
|
||||||
|
self.articles.sort(key=lambda a: a.language_code.priority, reverse=True)
|
||||||
overview_cards = "\n".join(self._replace_keywords(
|
overview_cards = "\n".join(self._replace_keywords(
|
||||||
overview_card_template,
|
overview_card_template,
|
||||||
**a.get_article_keys(),
|
**a.get_article_keys(),
|
||||||
|
@ -102,7 +102,7 @@ LANGUAGE_INFORMATION = {
|
|||||||
"ar_sy": {
|
"ar_sy": {
|
||||||
"flag": "🇸🇾",
|
"flag": "🇸🇾",
|
||||||
"name": "Arabic (Syria)",
|
"name": "Arabic (Syria)",
|
||||||
"native_name": "العربية (سوريا)"
|
"native_name": "العربية (سوريا)",
|
||||||
"priority": 50,
|
"priority": 50,
|
||||||
},
|
},
|
||||||
"ar_tn": {
|
"ar_tn": {
|
||||||
@ -281,7 +281,7 @@ LANGUAGE_INFORMATION = {
|
|||||||
"en_us": {
|
"en_us": {
|
||||||
"flag": "🇺🇸",
|
"flag": "🇺🇸",
|
||||||
"name": "English (US)",
|
"name": "English (US)",
|
||||||
"native_name": "English (US)"
|
"native_name": "English (US)",
|
||||||
},
|
},
|
||||||
"es": {
|
"es": {
|
||||||
"flag": "🇪🇸",
|
"flag": "🇪🇸",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user