12
votes

Is it possible to change the Apple Watch simulator locale? I want to test the localization of my watch app. I can change language on an iPhone simulator, but the watch simulator is always in English. I can't find any language settings:

Apple Watch Simulator Settings Apple Watch Simulator Settings General (top) Apple Watch Simulator Settings General (bot)

6
Just a note on the bounty - a solution that will run just the app in a localised mode is fine. Currently even this doesn't seem possible.Jordan Smith
You can use github.com/PGSSoft/AutoMate - it's a library for language and location automate testingxenteros
@xenteros except it's for iOS, not watchOS...Jordan Smith
With Xcode 10.1 this seems to be possible from within the Watch app on a simulated iPhone / iPad. The problem is it will usually tell you that there's no connection to the Watch. I managed to set the language for a Watch a single time, but wasn't able to reproduce it since.Koraktor
@Koraktor, good news, we are one step further.kelin

6 Answers

5
votes

Most certainly not possible neither via Watch Simulator UI nor iOS Simulator Watch app, but you can copy over values from iOS Simulator folder located in:

<simulator_dev_folder>/data/Library/Preferences/.GlobalPreferences.plist

to the same file in your Watch Simulator.

Plist keys to look for:

  • AppleLocale
  • AppleLanguages
  • AppleKeyboards
3
votes

You cannot change the Apple Watch simulator locale, but you can change the locale of your Watch App. I use this to test localization. To change your app locale, go edit the Watch App Scheme: Run->Options->Application Language - choose the language and re-run your Apple watch app.

2
votes

Run|Options|Application Language

Unfortunately it works only on Xcode 7.2, not on Xcode 7.1. There is no other known possibility.

EDIT

There is a brand new library for language and locale automate testing. It's called AutoMate. The documentation can be found here.

2
votes

I post my comment for a more readable format.

Hope that can be a "viable" work around

  • Create the different localization files: English, French, Spanish, Chinese…
  • localize all elements here
  • then, open the English files
  • copy the content of the language you want to test after the present english text (that will supersede it).
  • To come back to english, delete this added foreign text.

I tested, it works.

I just get an error log, without apparent consequence

Watch Extension[3520:334638] [default] -[SPRemoteInterface _interfaceControllerClientIDForControllerID:]:2140: ComF: clientIdentifier for interfaceControllerID:DC00003 not found

But that is good enough to test localization on simulator.

Removing the extra text clears the error.

1
votes

I improved this answer. https://stackoverflow.com/a/54883097/2519218

  1. Change directory to your simulator devices. eg. /Users/$USER_NAME/Library/Developer/CoreSimulator/Devices
  2. Detect your watch simulator. I used ls -trl command after build. eg. 046D5EDA-1808-4BE2-A16E-04DF0324B032
  3. plutil -convert xml1 ./046D5EDA-1808-4BE2-A16E-04DF0324B032/data/Library/Preferences/.GlobalPreferences.plist -o change_global.plist
  4. Edit change_global.plist AppLanguages's section you want to use by vim. I wanted to use ja, so it's like <key>AppleLanguages</key> <array> <string>ja</string> </array>.
  5. Put change_global.plist to ./046D5EDA-1808-4BE2-A16E-04DF0324B032/data/Library/Preferences/.GlobalPreferences.plist. like cp change_global.plist ./046D5EDA-1808-4BE2-A16E-04DF0324B032/data/Library/Preferences/.GlobalPreferences.plist .
  6. Restart simulator.
0
votes

Unfortunately, it doesn't seem like you can change the language in the watch simulator at this time. On the device, it's located in the iPhone Watch app under General -> Language & Region. However, on the iPhone simulator, there isn't even an option for the General section. This is all that shows up under the Watch app:

iPhone Watch App