Skip to content

Commit

Permalink
handles base case where no translation catalogs are present
Browse files Browse the repository at this point in the history
  • Loading branch information
cfm committed Sep 2, 2021
1 parent daac963 commit b62af0a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ version:
##############

LOCALE_DIR=securedrop_client/locale
LOCALES=$(shell find ${LOCALE_DIR} -name "*.po")
POT=${LOCALE_DIR}/messages.pot
SUPPORTED_LOCALES_LIST=l10n.txt
VERSION=$(shell python -c "import securedrop_client; print(securedrop_client.__version__)")
Expand Down Expand Up @@ -194,19 +195,27 @@ $(POT): securedrop_client
# msgmerge even though pybabel.update() is available. Here we use
# "pybabel update" for consistency with "pybabel extract".
${LOCALE_DIR}/%/LC_MESSAGES/messages.po: ${POT}
ifeq ($(strip $(LOCALES)),)
@echo "no translation catalogs to update"
else
@pybabel update \
--locale $$(echo $@ | grep -Eio "[a-zA-Z_]+/LC_MESSAGES/messages.po" | sed 's/\/LC_MESSAGES\/messages.po//') \
--input-file ${POT} \
--output-file $@ \
--no-wrap \
--previous
@sed -i -e '/^"POT-Creation-Date/d' $@
endif

# Compile a locale's PO to MO for (a) development runtime or (b) packaging.
${LOCALE_DIR}/%/LC_MESSAGES/messages.mo: ${LOCALE_DIR}/%/LC_MESSAGES/messages.po
ifeq ($(strip $(LOCALES)),)
@echo "no translation catalogs to compile"
else
@pybabel compile \
--directory ${LOCALE_DIR} \
--statistics
endif

# List languages 100% translated in Weblate.
.PHONY: supported-languages
Expand Down

0 comments on commit b62af0a

Please sign in to comment.