Setting User & OS Language Post Install from Casper

Standard

We need to have different configurations etc based on  the major european languages.

We were orignally looking at setting the OS Language via the custom os install options, but have been advised by JAMF that this does not work.

So we needed a work around to achieve the same.

I’ve got this working by narrowing it down to 4 plists… I’m then editing these for each language needed & making Composer dmg’s of each plist to distribute.

The upside of using this method is that we can use a single config per OS version with smart configs based on it that change the language as required.

Basically, make the changes & copy the below files:

Set OS Keyboard Language:

Change OS Keyboard from input source at login window.

Make a composer DMG of: /Library/Preferences/com.apple.HIToolbox.plist (there are multiple dictionary keys that need to be changed).

Set OS Primary Language:

The below interactive command will give you a  list of languages;

sudo /usr/sbin/languagesetup

The below will set the OS Language to French:

sudo /usr/sbin/languagesetup –langspec French

After change make a composer dmg of: /Library/Preferences/.GlobalPreferences.plist

Terminal commands for the above:

Set language order preference:

/usr/bin/defaults write /Library/Preferences/.GlobalPreferences AppleLanguages "(en, ja, fr, de, es, it, nl, sv, nb, da, fi, pt, zh-Hans, zh-Hant, ko)"

Set locale:

/usr/bin/defaults write /Library/Preferences/.GlobalPreferences AppleLocale "en_GB"

Set Country:

/usr/bin/defaults write /Library/Preferences/.GlobalPreferences Country “en_GB”

Set User Keyboard Language:

Change languages for user text input in system preferences.

Make a composer dmg of: ~/Library/Preferences/ByHost/com.apple.HIToolbox.<UID>.plist

Set to fill user templates & tick update ByHost in remote/policy.

Set User Language:

Run the below command as a logged in user to set the Language Preference order (make changes as required):

/usr/bin/defaults write -g AppleLanguages "(en, ja, fr, de, es, it, nl, sv, nb, da, fi, pt, zh-Hans, zh-Hant, ko)"

Make a composer dmg of: ~/Library/Preferences/.GlobalPreferences.plist

Set to fill user templates.

9 thoughts on “Setting User & OS Language Post Install from Casper

  1. Simon

    Hiya,

    I am wondering if you can help me, I can’t seem to get Language & Region to change to United Kingdom. Everything else works perfect but can’t seem to change this with the preferences files mentioned above. Can you confirm if this is still a method for 10.9?

    Thanks

    • Simon

      Tried with a vanilla machine running 10.9, went through the setup assistant, choose UK keyboard and set the localisation to Uk etc. I then followed the above, captured all the necessary files as DMG’s and created a policy for each one and triggered them manually, one after another. Something that seems like it should be trivial just doesn’t want to work for me!

      If I happen to open terminal and key in the commands;
      > sudo defaults write /Library/Preferences/.GlobalPreferences Country “en_GB”
      > defaults write -g AppleLanguage “(en, fr)”
      > sudo defaults write /Library/Preferences/.GlobalPreferences AppleLocale “en_GB”
      > defaults write -g AppleLocale “en_GB”

      It seems quite specific to the order as well (I don’t know if this is just me). If i was to add these as executable commands via a policy it would run as root rather than user.

  2. Hi Simon,

    Just a thought, I haven’t tested this myself yet. I know Mavericks caches everything (pisses me off on a daily basis).

    Perhaps you should set them to at startup instead.

    Best,
    Nils

  3. Simon

    Thanks Nils, I decided to just use DeployStudio and call in the Localization feature to save the hassle, ideally it would have been nice to spend more time on this but we don’t have a big enough environment to need other Language & regions right now.

  4. Just wanted to add I’ve been struggling with this in 10.9 but found a solution. After issuing these commands I found user’s region settings would be completely broken (null) in System Preferences, and everything would behave like it was in the US, date formatting, 12 hour clock etc. Trying to change the setting by hand for each user failed and wouldn’t stick.

    Closer examination of their ~/Library/Preferences/.GlobalPreferences.plist revealed the AppleLocale key to have a value of “en_EN_GB” which was knocking everything off kilter. Couldn’t change it to “en_GB” manually as it kept reverting back.

    The culprit is the command:

    defaults write /Library/Preferences/.GlobalPreferences Country “en_GB”

    Changing the Country key value to “GB” instead of “en_GB” fixed it.

  5. Shannon

    Hi Guys,

    I am looking at scripting this during our install rather than using Plist. IS this possible? We want to set out Country to Australia and Language to EN_GB

  6. Tanya

    I made a a dmg with /Library/Preferences/com.apple.HIToolbox.plist, and pushed out a policy that FUT/FEU (in Casper), but the keyboard doesn’t change. Do I have to also push the plist in ~/…ByHost? If so, is there an easy way to script that?

  7. Nils Makander

    Hi,

    I recently tried to do this again a couple of days ago on a new build. I’ve deployed language settings with this method before but what I noticed was that I don’t get a “: ~/Library/Preferences/ByHost/com.apple.HIToolbox..plist” in 10.11.6, I recall I used too. Quite odd.

  8. Nils Makander

    Edit: Update on this, I never changed the language preference for the user. Hence the ~ plist wasn’t created. Ignore my previous post.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.