don't abort build if mo file fails; rename files for consistency
Issues are now checked for in CI, so there's no need to break the build for everyone each time there's a problem with the gettext catalogs.
This commit is contained in:
parent
a634188ec5
commit
46fadc2a82
4
Makefile
4
Makefile
@ -112,10 +112,10 @@ add-buildhash:
|
|||||||
pull-i18n:
|
pull-i18n:
|
||||||
(cd rslib/ftl && scripts/fetch-latest-translations)
|
(cd rslib/ftl && scripts/fetch-latest-translations)
|
||||||
(cd qt/ftl && scripts/fetch-latest-translations)
|
(cd qt/ftl && scripts/fetch-latest-translations)
|
||||||
(cd qt/i18n && ./pull-git)
|
(cd qt/po && scripts/fetch-latest-translations)
|
||||||
|
|
||||||
.PHONY: push-i18n
|
.PHONY: push-i18n
|
||||||
push-i18n: pull-i18n
|
push-i18n: pull-i18n
|
||||||
(cd rslib/ftl && scripts/upload-latest-templates)
|
(cd rslib/ftl && scripts/upload-latest-templates)
|
||||||
(cd qt/ftl && scripts/upload-latest-templates)
|
(cd qt/ftl && scripts/upload-latest-templates)
|
||||||
(cd qt/i18n && ./sync-po-git)
|
(cd qt/po && scripts/upload-latest-template)
|
||||||
|
@ -25,8 +25,10 @@ all: check
|
|||||||
./tools/build_ui.sh
|
./tools/build_ui.sh
|
||||||
@touch $@
|
@touch $@
|
||||||
|
|
||||||
.build/i18n: $(wildcard i18n/po/desktop/*/anki.po)
|
.build/i18n: $(wildcard po/repo/desktop/*/anki.po)
|
||||||
(cd i18n && ./pull-git && ./build-mo-files && ./copy-qt-files)
|
(cd po && ./scripts/fetch-latest-translations && \
|
||||||
|
./scripts/build-mo-files && \
|
||||||
|
./scripts/copy-qt-files)
|
||||||
@touch $@
|
@touch $@
|
||||||
|
|
||||||
TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss)
|
TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss)
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# build mo files
|
|
||||||
#
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
targetDir="../aqt_data/locale/gettext"
|
|
||||||
mkdir -p $targetDir
|
|
||||||
|
|
||||||
echo "Compiling *.po..."
|
|
||||||
for file in po/desktop/*/anki.po
|
|
||||||
do
|
|
||||||
outdir=$(echo "$file" | \
|
|
||||||
perl -pe "s%po/desktop/(.*)/anki.po%$targetDir/\1/LC_MESSAGES%")
|
|
||||||
outfile="$outdir/anki.mo"
|
|
||||||
mkdir -p $outdir
|
|
||||||
msgmerge -q "$file" po/desktop/anki.pot | msgfmt - --output-file="$outfile"
|
|
||||||
done
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ! -d po ]; then
|
|
||||||
git clone https://github.com/ankitects/anki-desktop-i18n po
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Updating translations from git..."
|
|
||||||
(cd po && git pull)
|
|
||||||
|
|
||||||
# make sure gettext translations haven't broken something
|
|
||||||
(cd po && python check-po-files.py)
|
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
# pull any pending changes from git repos
|
|
||||||
./pull-git
|
|
||||||
|
|
||||||
# upload changes to .pot
|
|
||||||
./update-po-template
|
|
||||||
(cd po && git add desktop; git commit -m update; git push)
|
|
2
qt/i18n/.gitignore → qt/po/.gitignore
vendored
2
qt/i18n/.gitignore → qt/po/.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
.build
|
.build
|
||||||
po
|
repo
|
||||||
ftl
|
ftl
|
20
qt/po/scripts/build-mo-files
Executable file
20
qt/po/scripts/build-mo-files
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# build mo files
|
||||||
|
#
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
targetDir="../aqt_data/locale/gettext"
|
||||||
|
mkdir -p $targetDir
|
||||||
|
|
||||||
|
echo "Compiling *.repo..."
|
||||||
|
for file in repo/desktop/*/anki.po
|
||||||
|
do
|
||||||
|
outdir=$(echo "$file" | \
|
||||||
|
perl -pe "s%repo/desktop/(.*)/anki.po%$targetDir/\1/LC_MESSAGES%")
|
||||||
|
outfile="$outdir/anki.mo"
|
||||||
|
mkdir -p $outdir
|
||||||
|
(msgmerge -q "$file" repo/desktop/anki.pot | msgfmt - --output-file="$outfile") || (
|
||||||
|
echo "error building $file"
|
||||||
|
)
|
||||||
|
done
|
9
qt/po/scripts/fetch-latest-translations
Executable file
9
qt/po/scripts/fetch-latest-translations
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Downloading latest translations..."
|
||||||
|
|
||||||
|
if [ ! -d repo ]; then
|
||||||
|
git clone https://github.com/ankitects/anki-desktop-i18n repo
|
||||||
|
fi
|
||||||
|
|
||||||
|
(cd repo && git pull)
|
@ -16,5 +16,5 @@ for i in qt/aqt/{*.py,forms/*.py}; do
|
|||||||
echo $i >> $all
|
echo $i >> $all
|
||||||
done
|
done
|
||||||
|
|
||||||
xgettext -cT: -s --no-wrap --files-from=$all --output=qt/i18n/po/desktop/anki.pot
|
xgettext -cT: -s --no-wrap --files-from=$all --output=qt/po/repo/desktop/anki.pot
|
||||||
rm $all
|
rm $all
|
6
qt/po/scripts/upload-latest-template
Executable file
6
qt/po/scripts/upload-latest-template
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
./update-po-template
|
||||||
|
(cd repo && git add desktop; git commit -m update; git push)
|
Loading…
Reference in New Issue
Block a user