integrate i18n into new structure

This commit is contained in:
Damien Elmes 2020-01-03 08:24:59 +10:00
parent 1165e95ad3
commit e92ba88af1
8 changed files with 25 additions and 31 deletions

View file

@ -26,13 +26,17 @@ all: check
./tools/build_ui.sh
@touch $@
.build/i18n: $(wildcard i18n/translations/anki.pot/*)
(cd i18n && ./build-mo-files && ./copy-qt-files)
@touch $@
TSDEPS := $(wildcard ts/src/*.ts)
.build/js: $(TSDEPS)
(cd ts && npm i && npm run build)
@touch $@
BUILD_STEPS := .build/run-deps .build/dev-deps .build/js .build/ui
BUILD_STEPS := .build/run-deps .build/dev-deps .build/js .build/ui .build/i18n
# Checking
######################

View file

@ -1,21 +0,0 @@
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
$(shell mkdir -p .build)
.PHONY: develop
develop: .build/develop
.PHONY: clean
clean:
.PHONY: build
build:
.build/develop: $(wildcard translations/anki.pot/*)
./build-mo-files
./copy-qt-files
@touch $@

View file

@ -3,7 +3,7 @@
# build mo files
#
targetDir="../anki-qt/aqt_data/locale"
targetDir="../aqt_data/locale"
mkdir -p $targetDir
echo "Compiling *.po..."

View file

@ -2,8 +2,8 @@
set -e
out=../anki-qt/aqt_data/locale
out=../aqt_data/locale
mkdir -p $out
qtTranslations=$(python -c "from PyQt5.QtCore import *; print(QLibraryInfo.location(QLibraryInfo.TranslationsPath))")
rsync -av $qtTranslations/qt* $out
rsync -a $qtTranslations/qt* $out

View file

@ -1,4 +1,8 @@
#!/bin/bash
#
# Sends the latest strings from the source code to crowdin.
# To use this, key must be set to a crowdin API key.
#
set -e

View file

@ -1,4 +1,9 @@
#!/bin/bash
#
# Pulls the latest translations from crowdin and commits them here.
# To use this, key must be set to a crowdin API key.
# Aborts if there are any uncommited changes prior to running.
#
set -e
@ -9,6 +14,11 @@ if [ "$key" = "" ]; then
exit 1
fi
if ! git diff-index --quiet HEAD --; then
echo "working directory is not clean"
exit 1
fi
# fetch translations from crowdin
if [ ! -f all.zip ]; then
curl https://api.crowdin.com/api/project/$proj/export?key=$key

View file

@ -5,10 +5,10 @@
all=all.files
echo "Updating anki.pot..."
for i in ../anki-lib-python/anki/{*.py,importing/*.py,template/*.py}; do
for i in ../../pylib/anki/{*.py,importing/*.py,template/*.py}; do
echo $i >> $all
done
for i in ../anki-qt/aqt/{*.py,forms/*.py}; do
for i in ../aqt/{*.py,forms/*.py}; do
echo $i >> $all
done

View file

@ -3,7 +3,7 @@
set -e
CHECKABLE="rslib pylib qt"
DEVEL="rspy pylib qt i18n"
DEVEL="rspy pylib qt"
if [ "$UNOPT" = "" ]; then
BUILDFLAGS="--release --strip"
@ -23,6 +23,3 @@ fi
# add qt if missing
python -c 'import PyQt5' 2>/dev/null || pip install -r qt/requirements.qt
# fetch i18n files
test -d i18n || git clone --depth 1 https://github.com/ankitects/anki-i18n i18n