Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Temporarily change system language via AppleScript System
I run my Mac with Japanese set as the default langauge. However, sometimes I want to run programs in English, and it was always a pain to go to System Preferences -> International and change the language. I know I can also deselect Japanese from the Language section on the Get Info window for each program, but then I would have to turn it back on later. I discovered a way to change the language from the Terminal that makes things a lot easier.

When I'm in Japanese mode and I want to switch to English, I run the following command:
defaults write NSGlobalDomain AppleLanguages 
 "(en, ja, fr, de, es, it, nl, sv, nb, da, fi, pt, zh-Hans, zh-Hant, ko)"
Once that is run, any program that you launch will run in English. To switch back, just swap the two languages you want, like so:
defaults write NSGlobalDomain AppleLanguages 
 "(ja, en, fr, de, es, it, nl, sv, nb, da, fi, pt, zh-Hans, zh-Hant, ko)"
Using this basic idea, one can temporarily switch into whatever language they want and not have to hassle with System Preferences. I wrote a simple AppleScript droplet that I can drop applications onto, and they will run in English. I'm sure the code could be simplified, but it gets the job done in its current form.
    •    
  • Currently 3.00 / 5
  You rated: 3 / 5 (7 votes cast)
 
[20,678 views]  

Temporarily change system language via AppleScript | 12 comments | Create New Account
Click here to return to the 'Temporarily change system language via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Temporarily change system language via AppleScript
Authored by: fds on Jan 03, '07 07:54:29AM

Instead of writing into the global domain, you could set the preference only for the specific application, then it will apply to that application only…

eg.
defaults write com.apple.mail AppleLanguages '("jp", "en-US")'



[ Reply to This | # ]
Temporarily change system language via AppleScript
Authored by: mbenchoff on Jan 03, '07 09:02:34AM

I'm probably missing something, but why not enable "Show input menu in menubar" in the International preference pane (under the "Input Menu" tab)? Then you can switch languages to your heart's content by choosing the appropriate flag.



[ Reply to This | # ]
Temporarily change system language via AppleScript
Authored by: simsamsep on Jan 03, '07 01:39:55PM

In the input menu you can change the keyboard lay-out, not the language in which applications (including the Finder) will be launched.



[ Reply to This | # ]
Temporarily change system language via AppleScript
Authored by: kksilverstar on Jan 03, '07 02:14:32PM

This is brilliant and fast.

Very useful in particular for mail as the language encoding can be switched on the fly via the input menu and it will look like things are well. However the actual message encoding does not properly move to SJIS unless the program is running in Japanese and the message will likely come over to the recipient looking garbled and not in Japanese at all.

Good work. I'm using it now!



[ Reply to This | # ]
Temporarily change system language via AppleScript
Authored by: robogobo on Jan 03, '07 10:49:59PM

Very good. I've copied your droplet script and changed it to run in German. Excellent!



[ Reply to This | # ]
HELP! (and be careful)
Authored by: psandiford on Jan 04, '07 06:35:50AM

Something from my cut-and-paste of this hint nuked my user account. I suspect I gave the Terminal a bad language code and now, it seems, launch services are hosed. My desktop image and doc work but menubar and applications (including Finder) will not launch; also, I cannot log out.

Can anyone spare a tip on how can I administer terminal commands from another user account so I can try to fix this?



[ Reply to This | # ]
HELP! (and be careful)
Authored by: yasny_jp on Jan 04, '07 01:48:57PM

If you have a second user account that you can login to, you should be able to open up the terminal and type su username in order to switch to that user. For example, if I'm logged in with a_user and I want to switch to b_user, I could type su b_user and then b_user's password and then I would be logged into b_user's shell. From there I can run whatever program I want as b_user.

I can't actually test this right now (I don't have a Mac at work), but I believe it should work.



[ Reply to This | # ]
Temporarily change system language via AppleScript
Authored by: psandiford on Jan 04, '07 03:10:31PM

Thanks for the fix!



[ Reply to This | # ]
Vote Against
Authored by: psandiford on Jan 04, '07 04:49:48PM

I have created several accounts on my system and tried this hint 3 time. Each time the account becomes useless; i.e., it will not launch the menu bar or finder (or any other app). There does not seem to be a reset back to "en" after the error. Maybe it is something unique about my installation but this is the first symptom, if so.

I do not recommend this hint unless you are a geek god (no offense meant to the kind person that contributed the hint).



[ Reply to This | # ]
Vote Against
Authored by: mantrid on Jan 04, '07 06:12:02PM
The main problem with the hint is that each command, which should be shown on one line, has been split into two. Trying to enter each half separately should just fail and have no negative effect. But if you somehow change things and manage to create an empty AppleLanguages entry, it does mess up the login. Try it like this (all on one line):
defaults write -g AppleLanguages -array en
or
defaults write -g AppleLanguages -array ja
It isn't actually necessary to list all of the localization names either, unless you actually want them to be considered when the system is trying to decide which one use when launching an app.

[ Reply to This | # ]
I was hoping so badly this would relief my Notes grief...
Authored by: arglborps on Aug 12, '07 10:11:32PM

Lotus Notes, the bane of our lives, is not capable of using Japanese as long as the OS isn't switched to Japanese, even if you disable the English.lproj and leave only the Japanese one in. It will mangle all the Japanese characters. My workaround was to switch the Language in the System Prefs, kill the Dock, launch Notes.app via the dock (and it thinks now it's in a Japanese system) and once Notes is running I switch back to English and kill the Dock again.

I used your method to try to automate that process, but for some reason switching languages via the command line is missing something compared to the System Preferences, because Notes will just refuse to "think" it's on a Japanese OS, it will mangle all the Japanese. Back to manual, I guess.

I really hope I'll never meet any of the Lotus Notes developers in a dark alley...

Anyway thanks for this hint.



[ Reply to This | # ]
Temporarily change system language via AppleScript
Authored by: meatleg on Dec 15, '07 07:58:11PM

i have been looking for a way to do this for a while. your applescript seems to need one to drop something onto it to change the language?

how could i make an applescript that just changes the languge?
i would like to have one to switch from japanese to english?
and one to switch from english to japanese...

im on leopard now but that shouldnt matter right?

im afraid of screwing up my user account so i dont wanna try to edit this applescript myself....

thanks!



[ Reply to This | # ]