summaryrefslogtreecommitdiffstats
path: root/refresh-translations
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2017-09-07 18:56:12 +0200
committeranonym <anonym@riseup.net>2017-09-13 00:09:17 +0200
commit02a55ec59bf29f083a74d47d35eaf79cd67b779c (patch)
tree150abce39d8105e4b5740381feb97b553bde9b6c /refresh-translations
parent9dcf084257aba928345cec74ed483b402c1c94b4 (diff)
Rework how we handle the individual POT files of our applications.
Comparing the new temporary POT files we generate with the temporary POT files we generated last time (if ever, and if we did, for which branch?) is not relevant; these POT files are only used for merging into a new tails.pot and *that* one is relevant to diff against the old tails.pot.
Diffstat (limited to 'refresh-translations')
-rwxr-xr-xrefresh-translations37
1 files changed, 13 insertions, 24 deletions
diff --git a/refresh-translations b/refresh-translations
index 1f9738c..511ebf8 100755
--- a/refresh-translations
+++ b/refresh-translations
@@ -47,31 +47,20 @@ prog_potfile () {
echo "tmp/pot/${domain}.pot"
}
-refresh_pot () {
+create_pot () {
prog=$1
proglang=$2
-
- progpath="config/chroot_local-includes$prog"
- pot=$(prog_potfile $prog)
-
- mkdir -p "$(dirname $pot)"
-
+ progpath="config/chroot_local-includes${prog}"
if [ -e "${progpath}" ]; then
- orig="$(dirname ${progpath})/$(basename ${pot}).orig"
- cp "${pot}" "${orig}"
+ pot="$(prog_potfile "${prog}")"
+ mkdir -p "$(dirname ${pot})"
xgettext --language="${proglang}" --from-code=UTF-8 \
-o "${pot}" "${progpath}"
- normalize_pot "${pot}" "${orig}"
- if [ "${FORCE}" = yes ]; then
- echo "Force-updating '${pot}'."
- rm "${orig}"
- elif diff_without_pot_creation_date_and_comments "${pot}" "${orig}" >/dev/null; then
- echo "Only header or comment changes in '${orig}', restoring the old one."
- mv "${orig}" "${pot}"
- else
- echo "Real changes in ${pot}: keeping the updated one."
- rm "${orig}"
- fi
+ normalize_pot "${pot}"
+ else
+ echo "error: We are supposed to create a POT file for '${prog}'" \
+ "but '${progpath}' does not exist"
+ exit 1
fi
}
@@ -148,10 +137,10 @@ done
# Update POT files
mkdir -p tmp/pot
-for prog in $PERL_PROGS ; do refresh_pot $prog Perl ; done
-for prog in $PYTHON_PROGS ; do refresh_pot $prog Python ; done
-for prog in $SHELL_PROGS ; do refresh_pot $prog Shell ; done
-for prog in $JAVASCRIPT_PROGS ; do refresh_pot $prog JavaScript ; done
+for prog in $PERL_PROGS ; do create_pot $prog Perl ; done
+for prog in $PYTHON_PROGS ; do create_pot $prog Python ; done
+for prog in $SHELL_PROGS ; do create_pot $prog Shell ; done
+for prog in $JAVASCRIPT_PROGS ; do create_pot $prog JavaScript ; done
intltool_update_pot
# If left out files are detected, intltool-update --maintain writes