From c6ad713df8e899551ac57d72cb361e10a4c9c741 Mon Sep 17 00:00:00 2001 From: Cory Francis Myers Date: Wed, 1 Sep 2021 18:45:59 -0700 Subject: [PATCH] handles base case where no translation catalogs are present --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index a70ecbb767..023761122b 100644 --- a/Makefile +++ b/Makefile @@ -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__)") @@ -194,6 +195,9 @@ $(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} \ @@ -201,12 +205,17 @@ ${LOCALE_DIR}/%/LC_MESSAGES/messages.po: ${POT} --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