Skip to content

Instantly share code, notes, and snippets.

@nickdowell
Created April 25, 2014 12:52
Show Gist options
  • Save nickdowell/11288603 to your computer and use it in GitHub Desktop.
Save nickdowell/11288603 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -o errexit
set -o pipefail
langs=(de es fr pt)
for path in en.lproj/*.xib; do
git diff --quiet $path && git diff --cached --quiet $path || {
echo -n "updating localizations for $path"
orig_base="$(mktemp -t $0).xib"
git show HEAD:Resources/Localisation/$path > $orig_base
for lang in "${langs[@]}"; do
orig_trans=$PWD/$lang.lproj/$(basename $path)
echo -n "."
new_trans="$(mktemp -t $0).xib"
xcrun ibtool \
--previous-file $orig_base \
--incremental-file $orig_trans \
--localize-incremental \
--write $new_trans \
$PWD/$path
mv $new_trans $orig_trans
done
echo ""
rm $orig_base
}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment