Created
March 18, 2010 01:05
-
-
Save justinvoss/335931 to your computer and use it in GitHub Desktop.
A script for launching OS X apps using any given human language.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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