mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
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:
parent
6c9e9eb330
commit
d1e587fca9
9 changed files with 38 additions and 4 deletions
|
@ -180,7 +180,7 @@ def proto_progress_to_native(progress: pb.Progress) -> Progress:
|
||||||
|
|
||||||
class RustBackend:
|
class RustBackend:
|
||||||
def __init__(self, col_path: str, media_folder_path: str, media_db_path: str):
|
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(
|
init_msg = pb.BackendInit(
|
||||||
collection_path=col_path,
|
collection_path=col_path,
|
||||||
media_folder_path=media_folder_path,
|
media_folder_path=media_folder_path,
|
||||||
|
|
1
qt/i18n/.gitignore
vendored
1
qt/i18n/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
.build
|
.build
|
||||||
po
|
po
|
||||||
|
ftl
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import os, re, sys
|
import os, re, sys
|
||||||
po_dir = "translations/anki.pot"
|
po_dir = "po/desktop"
|
||||||
|
|
||||||
msg_re = re.compile(r"^(msgid|msgid_plural|msgstr|)(\[[\d]\])? \"(.*)\"$")
|
msg_re = re.compile(r"^(msgid|msgid_plural|msgstr|)(\[[\d]\])? \"(.*)\"$")
|
||||||
cont_re = re.compile(r"^\"(.*)\"$")
|
cont_re = re.compile(r"^\"(.*)\"$")
|
||||||
|
@ -100,8 +100,11 @@ def fix_po(path):
|
||||||
return len(problems)
|
return len(problems)
|
||||||
|
|
||||||
problems = 0
|
problems = 0
|
||||||
for po in os.listdir(po_dir):
|
for fname in os.listdir(po_dir):
|
||||||
path = os.path.join(po_dir, po)
|
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)
|
problems += fix_po(path)
|
||||||
|
|
||||||
if problems:
|
if problems:
|
||||||
|
|
5
qt/i18n/copy-ftl-files
Executable file
5
qt/i18n/copy-ftl-files
Executable 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/
|
|
@ -4,6 +4,13 @@ if [ ! -d po ]; then
|
||||||
git clone https://github.com/ankitects/anki-desktop-i18n po
|
git clone https://github.com/ankitects/anki-desktop-i18n po
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -d ftl ]; then
|
||||||
|
git clone https://github.com/ankitects/anki-core-i18n ftl
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Updating translations from git..."
|
echo "Updating translations from git..."
|
||||||
(cd po && git pull)
|
(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
12
qt/i18n/sync-git
Executable 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
3
qt/i18n/update-ftl-templates
Executable 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
3
rslib/src/i18n/sync.ftl
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
media-added-count = Added: {$up}↑ {$down}↓
|
||||||
|
media-removed-count = Removed: {$up}↑ {$down}↓
|
||||||
|
media-checked-count = Checked: {$count}
|
Loading…
Reference in a new issue