For some reason, fr.lproj and French.lproj weren't good enough, so there's some fr_FR.lproj popping up, and not only for French, but a variety of languages. The ISO language code for Spanish is "es," so the language pack should be either "Spanish" or "es," but now I'm seeing "sp", "sp_es" and "es_ES." "Sp" isn't an recognized code for any language.
For a script that essentially greps a list of 60 languages in the old format, I don't want to have to add another 30 to deal with these new names popping up. It's easy to add them to the list, but without rewriting the script, it means the user has to be asked "yes or no" for even more languages.
I never thought it would become a project I had to maintain anyway. I will rewrite it so that it's flexible and can handle new languages on it's own, and to lessen the number of times the user has to say yes to each language, but here is a simpler script to use for the time being.
Since most people want to remove everything except English and Japanese anyway, this simple script will do that. It only asks one question "Do you want to delete everything except English and Japanese?" and if you say yes, it does it. It won't have any problem with new language codes because it gets a list of all languages, filters out English and Japanese and deletes everything that is left. Simple. Almost as simple as my very first post on the subject.
Enjoy.
#! /bin/sh
# Thu Feb 4 2010
if [ `id -u` != 0 ]; then echo "Oops, you need to be root to run this script"; exit 0; fi
while [[ $choice != 'y' ]] && [[ $choice != 'n' ]]
do
echo "Do you want to delete all language packs
except English and Japanese (for emoji
keyboards)?
y or n?"
read choice
done
if [[ $choice = 'y' ]]; then
echo "Please wait while I delete the chosen
language packs. This may take a minute
or two..."
updatedb && locate lproj | grep -E lproj$ | grep -v -i ja | grep -v -i English | grep -v -i \/en > .deletelist_fubaya
while read file; do rm -rf "$file"; done < .deletelist_fubaya
num=$(cat .deletelist_fubaya | wc -l)
rm .deletelist_fubaya
echo
echo "$num language pack directories deleted"
fi
[[ $choice = 'n' ]] && echo "Ok, I won't delete anything."; exit 0
# end of script