Wednesday, 6 April 2011

App Language Launching

My quest was to launch multiple instances of Mac OSX 10.6 TextEdit using Terminal where each instance has it's User Interface (UI) in a different language. The TextEdit UI language being independent from the Finder UI language. TextEdit is currently available in 18 UI languages ie 18 localizations:-

  1. Chinese Simplified [zh-Hans]
  2. Chinese Traditional [zh-Hant]
  3. Danish [da]
  4. Dutch [nl]
  5. English [en]
  6. Finnish [fi]
  7. French [fr]
  8. German [de]
  9. Italian [it]
  10. Japanese [ja]
  11. Korean [ko]
  12. Norwegian [nb]
  13. Polish [pl]
  14. Portugese [pt]
  15. Portugese Portugal [pt-PT]
  16. Russian [ru]
  17. Spanish [es]
  18. Swedish [sv]

The text in the brackets [ ] is the language tag for the language. The language tag rather than the full language name is used in the following terminal session commands. First the command to launch TextEdit in Japanese. I give two command line methods:-

  • /Applications/ -AppleLanguages '(ja)'
  • open -a TextEdit --args -AppleLanguages '(ja)'

Now to launch four simultaneous instances of TextEdit. The instances are Korean, Japanese, Chinese Simplified and English.

  • /Applications/ -AppleLanguages '(ko)'&
  • /Applications/ -AppleLanguages '(ja)'&
  • /Applications/ -AppleLanguages '(zh-Hans)'&
  • /Applications/ -AppleLanguages '(en)'&

Alternatively use the open command with the -n option. The -n option will result in a new instance of an App even if one is already running.

  • open -n -a TextEdit --args -AppleLanguages '(ko)'
  • open -n -a TextEdit --args -AppleLanguages '(ja)'
  • open -n -a TextEdit --args -AppleLanguages '(zh-Hans)'
  • open -n -a TextEdit --args -AppleLanguages '(en)'

I assume that these methods can be used with all Apple Apps but I have not yet investigated.

Thank you to Douglas Davidson for the lead on the -AppleLanguages command line argument.