create changelog entry
[debian/openrocket] / core / scripts / renameTranslationKeys.sh
1 #!/bin/bash
2
3 #
4 # Rename translation keys in translation files.
5 #
6 # Usage:
7 #    renameTranslationKeys.sh <mapping files...>
8 #
9 # The mapping files contain "<original> <new>" key pairs.
10 # Empty lines and lines starting with "#" are ignored.
11 # All translation files are modified at once.
12 #
13
14 TRANSLATIONS=messages*.properties
15
16 cat "$@" | while read line; do
17
18     if echo "$line" | grep -q "^\s*$\|^\s*#"; then
19         continue
20     fi
21
22     if ! echo "$line" | egrep -q "^\s*[a-zA-Z0-9._-]+\s+[a-zA-Z0-9._-]+\s*$"; then
23         echo "Invalid line:  $line"
24     fi
25
26     from="`echo $line | cut -d" " -f1`"
27     to="`echo $line | cut -d" " -f2`"
28
29     sed -i "s/^${from}\s*=\s*/${to} = /" $TRANSLATIONS
30
31 done