From 6fbf788693c34d7b605af52019c5ca0a8323a6c9 Mon Sep 17 00:00:00 2001 From: Tony George Date: Sat, 3 Feb 2018 20:45:56 +0530 Subject: [PATCH] Added a script for merging launchpad translations --- merge-launchpad-translations.sh | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 merge-launchpad-translations.sh diff --git a/merge-launchpad-translations.sh b/merge-launchpad-translations.sh new file mode 100755 index 00000000..26c5ed46 --- /dev/null +++ b/merge-launchpad-translations.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +backup=`pwd` +DIR="$( cd "$( dirname "$0" )" && pwd )" +cd "$DIR" + +. ./BUILD_CONFIG + +languages="am ar az bg ca cs da de el en_GB es et eu fi fr he hi hr hu ia id is it ko lt nb ne nl pl pt pt_BR ro ru sk sr sv tr uk vi zh_CN" + +echo "" +echo "==========================================================================" +echo " Update PO files in po/ with downloaded translations placed in po-lp/" +echo "==========================================================================" +echo "" + +for lang in $languages; do + # remove headers in po-lp/*.po so that msgcat does not create malformed headers + sed -i '/^#/d' po-lp/${app_name}-$lang.po + msgcat -o po/${app_name}-$lang.po po-lp/${app_name}-$lang.po po/${app_name}-$lang.po + sed -i '/#-#-#-#-#/d' po/${app_name}-$lang.po + sed -i '/#, fuzzy/d' po/${app_name}-$lang.po +done + +echo "" +echo "==========================================================================" +echo " Update PO files in po/ with latest POT file" +echo "==========================================================================" +echo "" + +for lang in $languages; do + msgmerge --update -v po/${app_name}-$lang.po ${app_name}.pot +done + +cd "$backup"