Skip to content

Commit

Permalink
Add tooling for checking translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
MrApplejuice committed May 13, 2024
1 parent b284fb0 commit 9973ccd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
7 changes: 1 addition & 6 deletions help.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ all: $(foreach x,$(help_image_list),$(TARGET_PATH)/$(x)) stringsxml
HELP_POSTFIXES := \
-nl \

stringsxml: $(foreach x,$(HELP_POSTFIXES),app/src/main/res/values$(x)/help_strings.xml)
stringsxml: app/src/main/res/values/help_strings.xml $(foreach x,$(HELP_POSTFIXES),app/src/main/res/values$(x)/help_strings.xml)

app/src/main/res/values/help_strings.xml: $(SOURCE_PATH)/help.md $(SOURCE_PATH)/process_markdown.py
cd $(SOURCE_PATH) \
Expand All @@ -49,11 +49,6 @@ endef

$(foreach x,$(HELP_POSTFIXES),$(eval $(call _target_gen,$(x))))

app/src/main/res/values/help_strings.xml: $(SOURCE_PATH)/help.md $(SOURCE_PATH)/process_markdown.py
cd $(SOURCE_PATH) \
&& python3 -m pipenv install -r requirements.txt \
&& python3 -m pipenv run python process_markdown.py $(abspath $<) $(abspath $@)

$(TARGET_PATH)/%.png: $(SOURCE_PATH)/screenshots/%.png
$(call convert_command,$<,$@)

Expand Down
24 changes: 24 additions & 0 deletions tools/workflows/check-translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

make -f help.makefile
if [[ $? -ne 0 ]] ; then
exit 1
fi

set -e
for xml in strings.xml help_strings.xml; do
echo "Checking $xml .."
find app/src/main/res/ -name "$xml" | grep -E "/values-[a-z]*/" | while read txml ; do
set +e
echo ".. against '${txml##*/res/}'"
python3 tools/verify-translation-file.py "app/src/main/res/values/$xml" "${txml}" > output.txt
errorcode=$?
cat output.txt | while read line ; do
echo " $line"
done
if [[ $errorcode -ne 0 ]] ; then
exit 1
fi
done
done

0 comments on commit 9973ccd

Please sign in to comment.