Default Localization Language wrong on Apple Watch

1.1k views Asked by At

I have an issue with Apple Watch localization: The default language is not working !

(..unsing XCode 10.0, Swift4.2, iOS12, and WatchOS4.2)

In my code, I have set English as the default language. In addition, I defined German as a localization. For those two languages, everything works fine and depending on how the iPhone-Settings are set (i.e. English or German), the Apple Watch reflects those languages.

But things turn bad if I set the iPhone language to French, for example, (and Region is set to France as well) then everything on the Watch is shown in German (instead of the default language English !!).

This must be a bug and it is very annoying to users worldwide.

Any idea on how to overcome this issue ?

See here some images illustrating the localization inside WatchKit App:

enter image description here

And here for WatchKit Extension:

enter image description here

And the info.plist entry:

enter image description here

2

There are 2 answers

1
coolioxlr On BEST ANSWER

I filed a radar 2 years ago which never get any update until this year's WWDC when I tracked down the engineer and complained about this issue. After WWDC they close my radar as a duplicate issue.

Try add Localizable.strings (Base) file in Watch Extention since some developer says doing so fixed the problem.

0
iKK On

Here is an explanation how to set the default language & region correctly for a typical WatchKit App (Swift >v4.2):

As a remark upfront: this article does not show on how to localise your storyboard files or Strings throughout your project. This article limits itself to the Default-Language Attribution as for the Apple Watch and the localization of your Info.plist !

To start, it is understood that you have 3 targets:

  • MyApp-Target
  • MyApp WatchKit Target
  • MyApp WatchKit Extension Target

Localization is made as follows :

A) Make sure the Info.plist files of all 3 targets contain the property-list entry "CFBundleDevelopmentRegion" (you can choose any default language and region, such as - for example: en_US)

enter image description here

B) Make sure all 3 Targets have a info.plist File that is localized as Base

enter image description here (...no need to add other languages for info.plist-File... - i.e. other languages will be added in extra infoPlist.strings file as described in steps further down this article...)

Also, please don't add any Target Memberships (since the Copy-Bundle is not allowed to have any info.plist files added to the binary (otherwise App Store validation is causing an error).

By the way, if you want to test your Default-language behaviour for your Apple Watch - make sure that you completely Erase and Reset both Simulators prior to changing the iPhone-language on the Simulator. It also seems necessary to delete and re-establish Target-Schemes. Doing so makes it possible to test the language-behaviour of your Apple Watch even for languages that are not the Base-language nor localisation-languages...

C) Make sure all 3 Target's info.plist File sits in the corresponding Base.lproj Folder

enter image description here (of course, for 3 targets, there are 3 Base.lproj Folders found at the root of every target-folder inside your project)

D) Eventually, if Xcode shows errors at this point: For all 3 Targets, Go to Target->Build Settings->info.plist File ...and correct the path to take account of the fact that your info.plist file sits inside the Base.lproj subfolder

enter image description here

E) If all is set correctly, then the Xcode Group folder and Base-setting for all 3 Targets looks as follows :

enter image description here

// -----------------------------------------------------------------------------

At this point, you should already have the desired behaviour such as that the Apple Watch wil show the default (Base) language whenever your iPhone and Watch run under a language that is not localised.

Now, if you want to add additional languages features for your Info.plist, that's when Localization starts and that's when you need to introduce the InfoPlist.strings files for each target you wish to have language-customisation.

This article here shows below on how to localize your infoPlist.strings File (not to confuse with what we just did above for the Base-language definition that is only responsible for the default-language setting of your iPhone and Apple Watch). Again, the article does not show storyboard- or Strings-localization. Please refer to other articles if you want to find out about this..

Localization of your info.plist File:

Inside your Targets (or at least the targets you want to localise something inside your info.plist file) - do the following:

I) Go to File -> New -> File... and add a Strings File to your target of choice

enter image description here

II) Name the file InfoPlist.strings and save it somewhere in your target-folder structure (and anywhere in any Group of Xcode reference-tree)

III) Inside InfoPlist.string (of your target of choice), write the key you want to localise (in quotation marks) followed by an equal sign and your localised text in the language of choice (also in quotation marks, followed by a semicolon).

Here is an example of a German localization :

/* App name localization */
"CFBundleDisplayName" = "MyApp_Name_in_German";

/* Privacy - Health Share Usage Description */
"NSHealthShareUsageDescription" = "Erlaubnis für Herzfrequenz Messung nötig.";

/* Privacy - Health Update Usage Description */
"NSHealthUpdateUsageDescription" = "Erlaubnis für Herzfrequenz Messung nötig.";

IV) Make sure that each InfoPlist.strings file has the correct target and language selected (for each target correspondingly - whereas it is understood that the WatchKit target most likely does not need a InfoPlist.strings localization - but the other two targets do for sure [i.e. MyApp-target and MyApp WatchKit Extension]).

enter image description here

V) If all set correctly, one of your target folder-groups will now look like this :

enter image description here (where InfoPlist.strings is localised for the corresponding language and Info.plist is localised for the Base)

// -----------------------------------------------------------------------------

Let's not ask why Apple made it so tremendously complicated for the Apple Watch to be correctly attributed a Default language & region and also made it all but obvious on how to localise different languages as for the InfoPlist.strings.