Xcode 10 bring a couple of new localization and internationalization features to help iOS and Mac developers reach global audiences.

Here’s a wrap-up straight from WWDC 2018’s sessions:

Localize Siri intents

The biggest developer news from WWDC was undoubtedly improvements to SiriKit allowing developers to create Siri Shortcuts. Now, your users can take advantage of personalized voice commands to execute repetitive tasks within your app using Siri. For apps with a global audience, it turns out that Siri intents, as these shortcuts are known in Xcode, are fully localizable. Just select your Intents.intentdefinition file in Xcode, and press the Localize… button in the right-side panel.Localize Siri Intents files in Xcode 10

Xcode will create an Intents.strings file with all your English texts related to your Siri shortcut. This file will be included automatically in the traditional Xcode export you send your translators.

Localize content with Xcode catalogs

Apple is trying to help developers localize their entire app more efficiently by expanding Xcode’s localization export capabilities. This new localization export is called an Xcode Catalog, and carries the extension .xcloc. Basically, it’s a folder full of stuff rather than just the single xliff from before. The idea is to send the translator everything they need, and for you to receive it back in the same way. The .xcloc includes:

Source: Apple.com — A look inside an xcloc package

Now, instead of exporting only text strings, like the Siri Intent strings we just talked about, Xcode will actually export any content you choose. This includes images that you may want to localize. Before you had to send such non-text content to the translators separately, but now you can have Xcode export and import these assets each time, following your precise directory hierarchy. Another feature of the .xcloc file is including storyboards for context, as well as a general Notes folder. The Notes folder is initially empty, but this is where you can include your own ReadMe file and Screenshots. Apple highly recommends automating your screenshot creation using Tests introduced last year in Xcode 9. It’s a bit of work to set up, but it pays off in the long-run. You’ll be able to send your translators the latest screenshots each time.

The new .xcloc format is supported by the existing Terminal commands for Xcode localization export:

If you’re using Terminal for localization builds currently, you’ll notice this is the same command as before. The only difference is that you are now exporting .xcloc folders instead of just the .xliff files.

Xcode Internationalization Best Practices

Although not much is new in the talk from Apple at WWDC 2018 “Creating Apps for a Global Audience”, it is a great introduction (or review). As always, the key takeaways for “easy” internationalization are:

Use Containers — UIStackView and others are already internationalized

Use Auto Layout — it does the rest of the layout work for you

Use Formatters — it formats numbers, dates, currencies, and even names for you

Use color for emphasis — Uppercase and italics don’t work in many scripts outside of Latin, but bold text and different colors usually do the same trick

Check your work — Xcode includes pseudolanguages to test all your assumptions

Use International Fonts — the built-in app Font Book can tell you which languages your font will work in!

On this last point, Apple reiterates some excellent code to choose appropriate fonts for different alphabets:

Xcode 10 Localization Wrap-up

The more things change, the more they stay the same. Xcode localization and internationalization still requires good, honest translators. Ready to localize your app? Contact Benjamin at Babble-on. I’ll help you from start to finish!