How to get the system language or the language that was selected when Mac OS X was installed
The left part of osascript -e 'user locale of (get system info)' is the language selected in Setup Assistant (I think).

The language at the top of the list in the Language &amp; Text preferences should be the second line of defaults read -g AppleLanguages.