Skip to content

Commit

Permalink
fix: i18n: xgettext doesnt support f-string
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Dec 3, 2024
1 parent 9431074 commit 457bdd7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
14 changes: 7 additions & 7 deletions biliarchiver/_biliarchiver_upload_bvid.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,24 @@ def _upload_bvid(
)
continue
if not os.path.exists(f"{videos_basepath}/{local_identifier}/_downloaded.mark"):
print(f"{local_identifier} " + _("没有下载完成"))
print(local_identifier, _("没有下载完成"))
continue

pid = local_identifier.split("_")[-1][1:]
file_basename = local_identifier[len(BILIBILI_IDENTIFIER_PERFIX) + 1 :]

print(f"=== {_('开始上传')} {local_identifier} => {remote_identifier} ===")
print("=== " + _('开始上传') + f" {local_identifier} => {remote_identifier} ===")
item = get_item(remote_identifier)
if item.exists and not update_existing:
print(f"item {remote_identifier} {_('已存在')} (item.exists)")
print(_("{} 已存在,跳过 (item.exists)").format(remote_identifier))

# check if the user is the same
if item.metadata.get("uploader") != get_username(access_key=access_key, secret_key=secret_key):
print(f"{remote_identifier} {_('不是你上传的,跳过')} (item.metadata.creator)")
print(f"{remote_identifier} "+ _('不是你上传的,跳过') + " (item.metadata.uploader)")
return

if item.metadata.get("upload-state") == "uploaded":
print(f"{remote_identifier} {_('已经上传过了,跳过')} (item.metadata.uploaded)")
print(f"{remote_identifier} " + _('已经上传过了,跳过') + " (item.metadata.uploaded)")
with open(
f"{videos_basepath}/{local_identifier}/_uploaded.mark",
"w",
Expand Down Expand Up @@ -306,7 +306,7 @@ def _upload_bvid(
print(f"400 Bad Request error encountered for {remote_identifier}. No more retries will be attempted.")
print(f"Error message: {e.response.text}")
if item.metadata.get("uploader") != get_username(access_key=access_key, secret_key=secret_key):
print(f"{remote_identifier} {_('不是你上传的,跳过')} (item.metadata.creator)")
print(_("{} 不是你上传的,跳过 (item.metadata.creator)").format(remote_identifier))
return
if e.response.status_code == 403:
print(f"403 Forbidden error encountered for {remote_identifier}. Retrying with title as description.")
Expand Down Expand Up @@ -347,7 +347,7 @@ def _upload_bvid(
encoding="utf-8",
) as f:
f.write("")
print(f"==== {remote_identifier} {_('上传完成')} ====")
print(f"==== {remote_identifier} " + _('上传完成') + " ====")

if delete_after_upload and len(local_identifiers) > 0:
try:
Expand Down
28 changes: 26 additions & 2 deletions biliarchiver/locales/biliarchiver.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-08 14:57+0800\n"
"POT-Creation-Date: 2024-12-03 09:37+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -502,6 +502,30 @@ msgstr ""
msgid "没有下载完成"
msgstr ""

#: biliarchiver/_biliarchiver_upload_bvid.py:311
#: biliarchiver/_biliarchiver_upload_bvid.py:104
msgid "开始上传"
msgstr ""

#: biliarchiver/_biliarchiver_upload_bvid.py:107
msgid "{} 已存在,跳过 (item.exists)"
msgstr ""

#: biliarchiver/_biliarchiver_upload_bvid.py:111
msgid "不是你上传的,跳过"
msgstr ""

#: biliarchiver/_biliarchiver_upload_bvid.py:115
msgid "已经上传过了,跳过"
msgstr ""

#: biliarchiver/_biliarchiver_upload_bvid.py:309
msgid "{} 不是你上传的,跳过 (item.metadata.creator)"
msgstr ""

#: biliarchiver/_biliarchiver_upload_bvid.py:350
msgid "上传完成"
msgstr ""

#: biliarchiver/_biliarchiver_upload_bvid.py:358
msgid "已删除视频文件夹 {}"
msgstr ""

0 comments on commit 457bdd7

Please sign in to comment.