diff --git a/pylib/anki/rsbackend.py b/pylib/anki/rsbackend.py index e9ef77a02..2d73a41b6 100644 --- a/pylib/anki/rsbackend.py +++ b/pylib/anki/rsbackend.py @@ -180,7 +180,7 @@ def proto_progress_to_native(progress: pb.Progress) -> Progress: class RustBackend: def __init__(self, col_path: str, media_folder_path: str, media_db_path: str): - ftl_folder = os.path.join(anki.lang.locale_folder, "ftl") + ftl_folder = os.path.join(anki.lang.locale_folder, "fluent") init_msg = pb.BackendInit( collection_path=col_path, media_folder_path=media_folder_path, diff --git a/qt/i18n/.gitignore b/qt/i18n/.gitignore index 86501593b..ce405b957 100644 --- a/qt/i18n/.gitignore +++ b/qt/i18n/.gitignore @@ -1,2 +1,3 @@ .build po +ftl diff --git a/qt/i18n/check-po-files.py b/qt/i18n/check-po-files.py index 68f397da6..44ba725c3 100644 --- a/qt/i18n/check-po-files.py +++ b/qt/i18n/check-po-files.py @@ -4,7 +4,7 @@ # import os, re, sys -po_dir = "translations/anki.pot" +po_dir = "po/desktop" msg_re = re.compile(r"^(msgid|msgid_plural|msgstr|)(\[[\d]\])? \"(.*)\"$") cont_re = re.compile(r"^\"(.*)\"$") @@ -100,8 +100,11 @@ def fix_po(path): return len(problems) problems = 0 -for po in os.listdir(po_dir): - path = os.path.join(po_dir, po) +for fname in os.listdir(po_dir): + path = os.path.join(po_dir, fname) + if not os.path.isdir(path): + continue + path = os.path.join(path, "anki.po") problems += fix_po(path) if problems: diff --git a/qt/i18n/copy-ftl-files b/qt/i18n/copy-ftl-files new file mode 100755 index 000000000..448ee784a --- /dev/null +++ b/qt/i18n/copy-ftl-files @@ -0,0 +1,5 @@ +#!/bin/bash + +targetDir=../aqt_data/locale/fluent +test -d $targetDir || mkdir -p $targetDir +rsync -a --delete --exclude=templates ftl/core/* $targetDir/ diff --git a/qt/i18n/pull-git b/qt/i18n/pull-git index 7e74bf79c..adc5ae027 100755 --- a/qt/i18n/pull-git +++ b/qt/i18n/pull-git @@ -4,6 +4,13 @@ if [ ! -d po ]; then git clone https://github.com/ankitects/anki-desktop-i18n po fi +if [ ! -d ftl ]; then + git clone https://github.com/ankitects/anki-core-i18n ftl +fi + echo "Updating translations from git..." (cd po && git pull) +(cd ftl && git pull) +# make sure gettext translations haven't broken something +python check-po-files.py diff --git a/qt/i18n/sync-git b/qt/i18n/sync-git new file mode 100755 index 000000000..6f54e45af --- /dev/null +++ b/qt/i18n/sync-git @@ -0,0 +1,12 @@ +#!/bin/bash + +# pull any pending changes from git repos +./pull-git + +# upload changes to .pot +./update-po-template +(cd po && git commit -m update; git push) + +# upload changes to ftl templates +./update-ftl-templates +(cd ftl && git add core; git commit -m update; git push) diff --git a/qt/i18n/update-ftl-templates b/qt/i18n/update-ftl-templates new file mode 100755 index 000000000..541033a91 --- /dev/null +++ b/qt/i18n/update-ftl-templates @@ -0,0 +1,3 @@ +#!/bin/bash + +rsync -a --delete ../../rslib/src/i18n/*.ftl ftl/core/templates/ diff --git a/qt/i18n/update-pot b/qt/i18n/update-po-template similarity index 100% rename from qt/i18n/update-pot rename to qt/i18n/update-po-template diff --git a/rslib/src/i18n/sync.ftl b/rslib/src/i18n/sync.ftl new file mode 100644 index 000000000..df3de8703 --- /dev/null +++ b/rslib/src/i18n/sync.ftl @@ -0,0 +1,3 @@ +media-added-count = Added: {$up}↑ {$down}↓ +media-removed-count = Removed: {$up}↑ {$down}↓ +media-checked-count = Checked: {$count}