1

In macOS, I can use the code below to set specific language for Word.app, can I use some similar code to set a specific Time zone for an app?

defaults write com.microsoft.Word AppleLanguages '("de")'
1

Background

With standard UNIX CLI tools you can set the environment variable TZ=<XXX> with a timezone and any application that runs within the shell where this was done will pick it up and use its value as their timezone.

Using TZ

For example, you can use this command to get the complete list of valid values to set TZ= to like so:

$ sudo systemsetup -listtimezones

And here I've listed just the first 10:

$ sudo systemsetup -listtimezones | head
Time Zones:
 Africa/Abidjan
 Africa/Accra
 Africa/Addis_Ababa
 Africa/Algiers
 Africa/Asmara
 Africa/Bamako
 Africa/Bangui
 Africa/Banjul
 Africa/Bissau

For this example, I'm going to use Tokyo's timezone, so we can find it like this:

$ sudo systemsetup -listtimezones | grep -i tokyo
 Asia/Tokyo

CLI Example

We can see the effect of setting our shell to this like this:

# My default timezone, EDT
$ date
Sat Apr 13 22:44:55 EDT 2019

# Using Tokyo's
$ TZ=Asia/Tokyo date
Sun Apr 14 11:44:59 JST 2019

GUI Example

In my limited testing this same approach works with GUI applications as well. In this example I installed this application that I found called the-clock.

$ brew cask install the-clock

Now we can invoke it like this from the shell:

$ '/Applications/The Clock.app/Contents/MacOS/The Clock'

It looks like this when you run it in the menubar at the top:

                                           ss1

Now if we invoke it with the environment variable set:

$ TZ=Asia/Tokyo '/Applications/The Clock.app/Contents/MacOS/The Clock'

And look in the menubar:

                                           ss2

We can see that the timezone was changed when we invoked the GUI application.

What about defaults?

In investigating any methods that you could use with the defaults command I didn't find anything compelling that led me to believe that you could do this through the defaults as in your example.

These resources led me to believe that you cannot:

References

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .