Removing a string from all translations.
The following is a helper script remove_string.sh
to remove all references of a string id from the translated resources:
#!/bin/bash
#
# Copyright (C) 2013 Reece H. Dunn
# License: GPLv3+
#
# Helper utility for removing a string/string-list item in all string resources.
ls res/values*/strings.xml | while read STRINGS ; do
xmlstarlet ed -d "/resources/*[@name='${1}']" ${STRINGS} > /tmp/strings.xml
mv /tmp/strings.xml ${STRINGS}
done
The latest version of this file can be found at https://raw.github.com/rhdunn/espeak/android/android/remove_string.sh.
This will reformat the strings.xml files, so it is recommended to run the script initially with a bogus name, e.g.:
./remove_string.sh zzzzzzzzzz
This change can be checked in to make future changes minimal. The above can also be run after translations or the main strings.xml file has been edited to keep it in a uniform format.
To delete a string id, you can run:
./remove_string.sh <string_id>
Written by Reece Dunn
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Related Tags
#android
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#