add ftl to the build process, and a sync-git script

also
- ensure po files are checked when updated
- add start of sync.ftl
This commit is contained in:
Damien Elmes 2020-02-16 17:21:19 +10:00
parent 6c9e9eb330
commit d1e587fca9
9 changed files with 38 additions and 4 deletions

View File

@ -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,

1
qt/i18n/.gitignore vendored
View File

@ -1,2 +1,3 @@
.build
po
ftl

View File

@ -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:

5
qt/i18n/copy-ftl-files Executable file
View File

@ -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/

View File

@ -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

12
qt/i18n/sync-git Executable file
View File

@ -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)

3
qt/i18n/update-ftl-templates Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
rsync -a --delete ../../rslib/src/i18n/*.ftl ftl/core/templates/

3
rslib/src/i18n/sync.ftl Normal file
View File

@ -0,0 +1,3 @@
media-added-count = Added: {$up}↑ {$down}↓
media-removed-count = Removed: {$up}↑ {$down}↓
media-checked-count = Checked: {$count}