Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Manually I just go into the system preferences, change the language ordering, and restart my app so it starts up in the default system language. Then I can run automated tests with the app running in that language.

In the command line, there is a built-in OSX utility languagesetup but this requires sudo and it has to prompt for the new language (i.e. there is no obvious command line option).

I don't know AppleScript well enough to use that but I would be open to using it.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You can open an application using a different language by adding an -AppleLanguages option:

/Applications/Calendar.app/Contents/MacOS/Calendar -AppleLanguages '(de)'

Another option is to add an AppleLanguages array to the property list of the application:

defaults write -app Calendar AppleLanguages -array de; open -a Calendar

languagesetup just changes the first item in the AppleLanguages array in /Library/Preferences/.GlobalPreferences.plist.

share|improve this answer
    
Launching the application with that flag does exactly what I want. –  travis1097 Sep 10 '13 at 17:16

There's no need to change the system default language (for most apps, at least). System Preferences » Language & Text doesn't change the system default language anyway, it's just configuration of your user profile.


The following script writes the list of preferred languages (first German, then English):

defaults write -g AppleLanguages -array de en

Run this, then open your application. Add or remove language IDs as needed.

To list your current language configuration:

$ defaults read -g AppleLanguages
(
    en,
    de
)
share|improve this answer
    
Daniel is right but you might want to "defaults read" the array first and copy all the language codes first so you don't have go back and check each one (if you're looking to test all of them). His sample code will only show english and german in the pref pane top level after written. I am using his settings suggestion in a script to periodically reset the default language to English for students in an English immersion program. (of course add - killall Finder) Thanks, Daniel. –  user255993 Sep 20 '13 at 12:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.