Skip to content

Commit

Permalink
workaround existed hardcoded text
Browse files Browse the repository at this point in the history
  • Loading branch information
jokester committed Dec 15, 2024
1 parent b55eaad commit 36106ff
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 103 deletions.
11 changes: 6 additions & 5 deletions app/models/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Language(Document):
},
{
"en_name": "Korean",
"lo_name": hardcode_text("韩语"),
"lo_name": hardcode_text("韩语") or hardcode_text("朝鲜语(韩语)"),
"code": "ko",
"g_tra_code": "ko",
"g_ocr_code": "ko",
Expand Down Expand Up @@ -482,7 +482,7 @@ class Language(Document):
},
{
"en_name": "Marathi",
"lo_name": hardcode_text("马拉地语"),
"lo_name": hardcode_text("马拉地语") or hardcode_text("马拉语"),
"code": "mr",
"g_tra_code": "mr",
"g_ocr_code": "mr",
Expand Down Expand Up @@ -518,7 +518,8 @@ class Language(Document):
},
{
"en_name": "Nyanja (Chichewa)",
"lo_name": hardcode_text("齐切瓦语 (尼扬贾语)"),
"lo_name": hardcode_text("齐切瓦语 (尼扬贾语)")
or hardcode_text("齐切瓦语"),
"code": "ny",
"g_tra_code": "ny",
"g_ocr_code": "",
Expand Down Expand Up @@ -637,7 +638,7 @@ class Language(Document):
},
{
"en_name": "Slovenian",
"lo_name": hardcode_text("斯洛文尼亚语"),
"lo_name": hardcode_text("斯洛文尼亚语") or hardcode_text("斯卡洛文语"),
"code": "sl",
"g_tra_code": "sl",
"g_ocr_code": "sl",
Expand Down Expand Up @@ -910,7 +911,7 @@ def to_api(self) -> Dict[str, Any]:
"id": str(self.id),
"en_name": self.en_name,
# in non-zh locales gettext(hardcoded_id) should return localized name
# otherwise the hardcoded_id is just in zh
# otherwise the hardcoded_id is just zh
"lo_name": gettext(self.lo_name) or self.lo_name,
"i18n_name": self.i18n_name,
"no_space": self.no_space,
Expand Down
111 changes: 61 additions & 50 deletions app/translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-12-15 16:54+0900\n"
"POT-Creation-Date: 2024-12-15 18:26+0900\n"
"PO-Revision-Date: 2017-04-14 15:38+0800\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en_US\n"
Expand Down Expand Up @@ -1046,6 +1046,10 @@ msgstr "English"
msgid "韩语"
msgstr "Korean"

#: app/models/language.py:50
msgid "朝鲜语(韩语)"
msgstr "Korean"

#: app/models/language.py:74
msgid "南非荷兰语"
msgstr "Afrikaans"
Expand Down Expand Up @@ -1139,7 +1143,6 @@ msgid "法语"
msgstr "French"

#: app/models/language.py:235
#, fuzzy
msgid "弗里斯兰语"
msgstr "Frisian"

Expand Down Expand Up @@ -1200,7 +1203,6 @@ msgid "伊博语"
msgstr "Igbo"

#: app/models/language.py:341
#, fuzzy
msgid "印度尼西亚语"
msgstr "Indonesian"

Expand Down Expand Up @@ -1284,6 +1286,10 @@ msgstr "Maori"
msgid "马拉地语"
msgstr "Marathi"

#: app/models/language.py:485
msgid "马拉语"
msgstr "Marathi"

#: app/models/language.py:492
msgid "蒙古语"
msgstr "Mongolian"
Expand All @@ -1304,164 +1310,163 @@ msgstr "Norwegian"
msgid "齐切瓦语 (尼扬贾语)"
msgstr "Nyanja (Chichewa)"

#: app/models/language.py:528
#: app/models/language.py:522
msgid "齐切瓦语"
msgstr "Nyanja (Chichewa)"

#: app/models/language.py:529
msgid "普什图语"
msgstr "Pashto"

#: app/models/language.py:535
#: app/models/language.py:536
msgid "波斯语"
msgstr "Persian"

#: app/models/language.py:542
#: app/models/language.py:543
msgid "波兰语"
msgstr "Polish"

#: app/models/language.py:549
#: app/models/language.py:550
msgid "葡萄牙语"
msgstr "Portuguese"

#: app/models/language.py:556
#: app/models/language.py:557
msgid "旁遮普语"
msgstr "Punjabi"

#: app/models/language.py:563
#: app/models/language.py:564
msgid "罗马尼亚语"
msgstr "Romanian"

#: app/models/language.py:570
#: app/models/language.py:571
msgid "俄语"
msgstr "Russian"

#: app/models/language.py:577
#: app/models/language.py:578
msgid "萨摩亚语"
msgstr "Samoan"

#: app/models/language.py:584
#: app/models/language.py:585
msgid "苏格兰盖尔语"
msgstr "Scots Gaelic"

#: app/models/language.py:591
#: app/models/language.py:592
msgid "梵文"
msgstr "Sanskrit"

#: app/models/language.py:598
#: app/models/language.py:599
msgid "塞尔维亚语"
msgstr "Serbian"

#: app/models/language.py:605
#: app/models/language.py:606
msgid "塞索托语"
msgstr "Sesotho"

#: app/models/language.py:612
#: app/models/language.py:613
msgid "绍纳语"
msgstr "Shona"

#: app/models/language.py:619
#: app/models/language.py:620
msgid "信德语"
msgstr "Sindhi"

#: app/models/language.py:626
#: app/models/language.py:627
msgid "僧伽罗语"
msgstr "Sinhala (Sinhalese)"

#: app/models/language.py:633
#: app/models/language.py:634
msgid "斯洛伐克语"
msgstr "Slovak"

#: app/models/language.py:640
#: app/models/language.py:641
msgid "斯洛文尼亚语"
msgstr "Slovenian"

#: app/models/language.py:647
#: app/models/language.py:641
msgid "斯卡洛文语"
msgstr "Slovenian"

#: app/models/language.py:648
msgid "索马里语"
msgstr "Somali"

#: app/models/language.py:654
#: app/models/language.py:655
msgid "西班牙语"
msgstr "Spanish"

#: app/models/language.py:661
#: app/models/language.py:662
msgid "巽他语"
msgstr "Sundanese"

#: app/models/language.py:668
#: app/models/language.py:669
msgid "斯瓦希里语"
msgstr "Swahili"

#: app/models/language.py:675
#: app/models/language.py:676
msgid "瑞典语"
msgstr "Swedish"

#: app/models/language.py:682
#: app/models/language.py:683
msgid "他加禄语(菲律宾语)"
msgstr "Tagalog (Filipino)"

#: app/models/language.py:689
#: app/models/language.py:690
msgid "塔吉克语"
msgstr "Tajik"

#: app/models/language.py:696
#: app/models/language.py:697
msgid "泰米尔语"
msgstr "Tamil"

#: app/models/language.py:703
#: app/models/language.py:704
msgid "泰卢固语"
msgstr "Telugu"

#: app/models/language.py:710
#: app/models/language.py:711
msgid "泰语"
msgstr "Thai"

#: app/models/language.py:717
#: app/models/language.py:718
msgid "土耳其语"
msgstr "Turkish"

#: app/models/language.py:724
#: app/models/language.py:725
msgid "乌克兰语"
msgstr "Ukrainian"

#: app/models/language.py:731
#: app/models/language.py:732
msgid "乌尔都语"
msgstr "Urdu"

#: app/models/language.py:738
#: app/models/language.py:739
msgid "乌兹别克语"
msgstr "Uzbek"

#: app/models/language.py:745
#: app/models/language.py:746
msgid "越南语"
msgstr "Vietnamese"

#: app/models/language.py:752
#: app/models/language.py:753
msgid "威尔士语"
msgstr "Welsh"

#: app/models/language.py:759
#: app/models/language.py:760
msgid "科萨语"
msgstr "Xhosa"

#: app/models/language.py:766
#: app/models/language.py:767
msgid "意第绪语"
msgstr "Yiddish"

#: app/models/language.py:773
#: app/models/language.py:774
msgid "约鲁巴语"
msgstr "Yoruba"

#: app/models/language.py:780
#: app/models/language.py:781
msgid "祖鲁语"
msgstr "Zulu"

#: app/models/language.py:791
msgid "Language collection already initialized."
msgstr "已存在语言表,跳过初始化"

#: app/models/language.py:805
#, python-format
msgid "Initialized Language collection with %d languages"
msgstr "初始化语言表,共添加 %d 种语言"

#: app/models/language.py:900
#: app/models/language.py:903
msgid "Language can not be deleted"
msgstr ""

Expand Down Expand Up @@ -1874,3 +1879,9 @@ msgstr "No valid parameters."
#~ msgid "此邮箱已存在,您可以直接登录或尝试其他邮箱"
#~ msgstr ""

#~ msgid "Language collection already initialized."
#~ msgstr "已存在语言表,跳过初始化"

#~ msgid "Initialized Language collection with %d languages"
#~ msgstr "初始化语言表,共添加 %d 种语言"

Loading

0 comments on commit 36106ff

Please sign in to comment.