From e55919322296aa5a69e607b04ed1ec622b7a2330 Mon Sep 17 00:00:00 2001 From: Marco Ciampa Date: Mon, 16 Nov 2015 10:57:39 +0100 Subject: [PATCH] Added ability to update single locale to script --- update-po-files.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/update-po-files.sh b/update-po-files.sh index 5b4530e13e..3965e27aea 100755 --- a/update-po-files.sh +++ b/update-po-files.sh @@ -10,6 +10,11 @@ # ##################################### +if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then + echo "Usage: $0 [locale]" + exit +fi + SOURCEDIR=../kicad-source-mirror #Set this first!!! #Autovars @@ -31,6 +36,21 @@ xgettext -f $LOCALDIR/POTFILES -k_ -k_HKI --force-po --from-code utf-8 -o $LOCAL rm $LOCALDIR/POTFILES +#check if present in locale list +validate() { echo $LINGUAS | grep -F -q -w "$1"; } + +#If supplied, update only the specified locale +if [ ! "$1" = "" ] ; then + if ! validate "$1"; then + echo "Error!" + echo "Locale argument \"$1\" not present in current locale list:" + for i in $LINGUAS; do echo -n "$i " ; done + exit 1 + else + LINGUAS="$1" + fi +fi + for i in $LINGUAS do msgmerge --force-po $LOCALDIR/$i/kicad.po $LOCALDIR/kicad.pot -o $LOCALDIR/$i/kicad.po 2>&1 # >> /dev/null