4 # Rename translation keys in translation files.
7 # renameTranslationKeys.sh <mapping files...>
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.
14 TRANSLATIONS=messages*.properties
16 cat "$@" | while read line; do
18 if echo "$line" | grep -q "^\s*$\|^\s*#"; then
22 if ! echo "$line" | egrep -q "^\s*[a-zA-Z0-9._-]+\s+[a-zA-Z0-9._-]+\s*$"; then
23 echo "Invalid line: $line"
26 from="`echo $line | cut -d" " -f1`"
27 to="`echo $line | cut -d" " -f2`"
29 sed -i "s/^${from}\s*=\s*/${to} = /" $TRANSLATIONS