dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17931
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7341: Shell script for cleaning translation property files.
------------------------------------------------------------
revno: 7341
committer: Jason P. Pickering <jason.p.pickering@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-21 08:02:17 +0000
message:
Shell script for cleaning translation property files.
added:
resources/util/clean_translations.sh
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added file 'resources/util/clean_translations.sh'
--- resources/util/clean_translations.sh 1970-01-01 00:00:00 +0000
+++ resources/util/clean_translations.sh 2012-06-21 08:02:17 +0000
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+if [[ $# -lt 1 ]]; then
+ echo "Usage: $0 original-properties-file translation-properties-file"
+ exit 1
+fi
+
+declare -A array1
+declare -A array2
+PROP_FILE="cleaned.properties"
+
+while IFS='=' read -r key val; do
+ [[ $key = '#'* ]] && continue
+ array1["$key"]="$val"
+done < $1
+
+
+while IFS='=' read -r key val; do
+ [[ $key = '#'* ]] && continue
+ array2["$key"]="$val"
+done < $2
+
+for key in "${!array1[@]}"; do
+ echo "$key=${array2[$key]}" >> ${PROP_FILE}
+done