summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhenk84 <github@henk.geekmail.org>2023-03-06 13:01:46 +0100
committerGitHub <noreply@github.com>2023-03-06 12:01:46 +0000
commite68a41a91ee9d80ea4c245da3583d27f923eda65 (patch)
tree485c46f71f09546eb0903dd4f73d5152683f611b
parent26f846e11233055cbb027a77c3c03a4cf6ab0663 (diff)
Make language/update.sh safer, faster, cleaner.
Ref: #308 Co-authored-by: Hendrik Jäger <gitcommit@henk.geekmail.org>
-rwxr-xr-xlanguage/update.sh49
1 files changed, 40 insertions, 9 deletions
diff --git a/language/update.sh b/language/update.sh
index de4fd0555..27a6a1ef8 100755
--- a/language/update.sh
+++ b/language/update.sh
@@ -1,17 +1,48 @@
-#!/bin/bash
+#!/bin/sh
-rm -f anope.pot
-touch anope.pot
+if [ "${PWD##*/}" != "language" ]
+then
+ echo "Please run this script in the language/ subfolder of an anope source tree."
+ exit 1
+fi
-cd ..
-FILES=`find ./ -name *.cpp -o -name *.h -o -name *.conf | grep -v /docs/ | grep -v /modules/third/`
-xgettext -E -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ $FILES
-cd -
+# truncate
+: > anope.pot
+
+# find .cpp, .h, and .conf files
+# exclude docs and third party modules
+# run xgettext on found files
+find ../ \
+ ! -path '../docs/*' \
+ -a ! -path '../modules/third/*' \
+ -a \( -name '*.cpp' \
+ -o -name '*.h' \
+ -o -name '*.conf' \
+ \) \
+ -exec \
+ xgettext \
+ --escape \
+ --language=C++ \
+ --sort-output \
+ --default-domain=Anope \
+ --join-existing \
+ --output=anope.pot \
+ --from-code=utf-8 \
+ --keyword \
+ --keyword=_ \
+ {} +
for f in *.po
do
echo "Merging $f"
- msgmerge --no-location --no-wrap --sort-output --update --verbose $f `echo $f | cut -d'.' -f1`.pot
+ msgmerge \
+ --no-location \
+ --no-wrap \
+ --sort-output \
+ --update \
+ --verbose \
+ "${f}" \
+ "${f%%.*}.pot"
done
-rm -f *~
+rm -f -- *~