Skip to content

Commit 933add6

Browse files
committed
Support internationalisation.
1 parent 2029c4e commit 933add6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2531
-305
lines changed

.travis.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@ compiler:
66
git:
77
depth: 1
88
env:
9+
- TRAVIS_TEST=unix
10+
- TRAVIS_TEST=docs
11+
- TRAVIS_TEST=translations
912
- TRAVIS_BOARD=feather_huzzah
10-
- TRAVIS_BOARD=arduino_zero
1113
- TRAVIS_BOARD=circuitplayground_express
14+
- TRAVIS_BOARD=pca10056
15+
- TRAVIS_BOARD=trinket_m0
16+
- TRAVIS_BOARD=feather_m4_express
17+
- TRAVIS_BOARD=arduino_zero
1218
- TRAVIS_BOARD=circuitplayground_express_crickit
1319
- TRAVIS_BOARD=feather_m0_basic
1420
- TRAVIS_BOARD=feather_m0_adalogger
1521
- TRAVIS_BOARD=feather_m0_rfm69
1622
- TRAVIS_BOARD=feather_m0_rfm9x
1723
- TRAVIS_BOARD=feather_m0_express
1824
- TRAVIS_BOARD=feather_m0_express_crickit
19-
- TRAVIS_BOARD=feather_m4_express
2025
- TRAVIS_BOARD=itsybitsy_m0_express
2126
- TRAVIS_BOARD=itsybitsy_m4_express
2227
- TRAVIS_BOARD=metro_m0_express
2328
- TRAVIS_BOARD=metro_m4_express
2429
- TRAVIS_BOARD=pirkey_m0
25-
- TRAVIS_BOARD=trinket_m0
2630
- TRAVIS_BOARD=gemma_m0
2731
- TRAVIS_BOARD=hallowing_m0_express
2832
- TRAVIS_BOARD=feather52832
29-
- TRAVIS_BOARD=pca10056
30-
- TRAVIS_TEST=unix
31-
- TRAVIS_TEST=docs
3233

3334
addons:
3435
artifacts:
@@ -56,8 +57,10 @@ before_script:
5657
# For huzzah builds
5758
- if [[ $TRAVIS_BOARD = "feather_huzzah" ]]; then wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar xavf xtensa-lx106-elf-standalone.tar.gz; PATH=$(readlink -f xtensa-lx106-elf/bin):$PATH; fi
5859
# For coverage testing (upgrade is used to get latest urllib3 version)
60+
- ([[ -z "$TRAVIS_TEST" ]] || sudo apt-get install -y python3-pip)
5961
- ([[ -z "$TRAVIS_TEST" ]] || sudo pip install --upgrade cpp-coveralls)
6062
- ([[ $TRAVIS_TEST != "docs" ]] || sudo pip install Sphinx sphinx-rtd-theme recommonmark)
63+
- ([[ $TRAVIS_TEST != "translations" ]] || sudo pip3 install polib)
6164
- gcc --version
6265
- ([[ -z "$TRAVIS_BOARD" ]] || arm-none-eabi-gcc --version)
6366
- python3 --version
@@ -103,6 +106,9 @@ script:
103106
- ([[ $TRAVIS_TEST != "docs" ]] || sphinx-build -E -W -b html . _build/html)
104107
- echo -en 'travis_fold:end:build_docs\\r'
105108

109+
- (echo 'Building translations' && echo -en 'travis_fold:start:build_translations\\r')
110+
- ([[ $TRAVIS_TEST != "translations" ]] || make check-translate)
111+
- echo -en 'travis_fold:end:build_translations\\r'
106112

107113
# run coveralls coverage analysis (try to, even if some builds/tests failed)
108114
#- (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)

Makefile

+15-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ CONFDIR = .
1717
FORCE = -E
1818
VERBOSE = -v
1919

20-
# User-friendly check for sphinx-build
21-
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
22-
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
23-
endif
20+
# Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the
21+
# full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the
22+
# executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
2423

2524
# Internal variables.
2625
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -190,3 +189,15 @@ pseudoxml:
190189
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
191190
@echo
192191
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
192+
193+
# phony target so we always run
194+
all-source:
195+
196+
locale/circuitpython.pot: all-source
197+
find . -iname "*.c" | xargs xgettext -L C --keyword=translate -o circuitpython.pot -p locale
198+
199+
translate: locale/circuitpython.pot
200+
for po in $(shell ls locale/*.po); do msgmerge -U $$po locale/circuitpython.pot; done
201+
202+
check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
203+
$(PYTHON) tools/check_translations.py $^

0 commit comments

Comments
 (0)