Skip to content

Instantly share code, notes, and snippets.

@justinvoss
Created March 18, 2010 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinvoss/335931 to your computer and use it in GitHub Desktop.
Save justinvoss/335931 to your computer and use it in GitHub Desktop.
A script for launching OS X apps using any given human language.
#!/bin/bash
# A script for launching OS X apps using any given human language.
if [ $# -ne 2 ]; then
echo "Usage: $0 [language] [application]"
echo "Example:"
echo " $0 fr_CA /Applications/iCal.app"
exit 1
fi
language_code=$1
app_bundle=$2
if [[ $app_bundle != /* ]]; then
app_bundle=`pwd`/$app_bundle
fi
app_bundle_ident=`defaults read "$app_bundle/Contents/Info" CFBundleIdentifier`
bundle_executable=`defaults read "$app_bundle/Contents/Info" CFBundleExecutable`
echo "Setting AppleLanguages to $language_code..."
defaults write $app_bundle_ident "AppleLanguages" "($language_code)"
"$app_bundle/Contents/MacOS/$bundle_executable"
echo "Deleting AppleLanguages key..."
defaults delete $app_bundle_ident "AppleLanguages"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment