{"id":698,"date":"2018-07-02T12:19:44","date_gmt":"2018-07-02T19:19:44","guid":{"rendered":"http:\/\/www.ibabbleon.com\/copywriter-translator\/?p=698"},"modified":"2018-07-02T12:19:44","modified_gmt":"2018-07-02T19:19:44","slug":"xcode-10-localization-in-ios-12-whats-new-from-apple-from-wwdc-2018","status":"publish","type":"post","link":"https:\/\/www.ibabbleon.com\/copywriter-translator\/2018\/07\/xcode-10-localization-in-ios-12-whats-new-from-apple-from-wwdc-2018\/","title":{"rendered":"Xcode 10 Localization in iOS 12 \u2013 What&#8217;s new from Apple from WWDC 2018"},"content":{"rendered":"<p><em>Xcode 10 bring a couple of new localization and internationalization features to help iOS and Mac developers reach global audiences.<\/em><\/p>\n<p>Here&#8217;s a wrap-up straight from WWDC 2018&#8217;s sessions:<\/p>\n<h2>Localize Siri intents<\/h2>\n<p>The biggest developer news from WWDC was undoubtedly improvements to SiriKit allowing developers to create <strong>Siri Shortcuts<\/strong>. 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 <strong>Siri intents<\/strong>, as these shortcuts are known in Xcode, are fully localizable. Just select your <code>Intents.intentdefinition<\/code> file in Xcode, and press the <strong>Localize&#8230;<\/strong> button in the right-side panel.<br \/>\n<figure id=\"attachment_707\" aria-describedby=\"caption-attachment-707\" style=\"width: 1024px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/xcode.png\"><img loading=\"lazy\" src=\"http:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/xcode-1024x325.png\" alt=\"\" width=\"1024\" height=\"325\" class=\"size-large wp-image-707\" srcset=\"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/xcode-1024x325.png 1024w, https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/xcode-300x95.png 300w, https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/xcode-768x244.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-707\" class=\"wp-caption-text\">Localize Siri Intents files in Xcode 10<\/figcaption><\/figure><\/p>\n<p>Xcode will create an <code>Intents.strings<\/code> 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.<\/p>\n<h2>Localize content with Xcode catalogs<\/h2>\n<p>Apple is trying to help developers localize their entire app more efficiently by expanding Xcode&#8217;s localization export capabilities. This new localization export is called an Xcode Catalog, and carries the extension .xcloc. Basically, it&#8217;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:<\/p>\n<figure id=\"attachment_702\" aria-describedby=\"caption-attachment-702\" style=\"width: 525px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-9.35.42-AM.png\"><img loading=\"lazy\" src=\"http:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-9.35.42-AM-1024x479.png\" alt=\"\" width=\"525\" height=\"246\" class=\"size-large wp-image-702\" srcset=\"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-9.35.42-AM-1024x479.png 1024w, https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-9.35.42-AM-300x140.png 300w, https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-9.35.42-AM-768x359.png 768w, https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-19-at-9.35.42-AM.png 1932w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/a><figcaption id=\"caption-attachment-702\" class=\"wp-caption-text\">Source: Apple.com \u2014 A look inside an xcloc package<\/figcaption><\/figure>\n<p>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&#8217;s a bit of work to set up, but it pays off in the long-run. You&#8217;ll be able to send your translators the latest screenshots each time.<\/p>\n<h2continuous Localization with Xcode 10<\/h2>\n<p>The new .xcloc format is supported by the existing Terminal commands for Xcode localization export:<\/p>\n<pre>$ xcodebuild -exportLocalizations -project <projectname> -localizationPath <dirpath> [[-exportLanguage <targetlanguage>] ...] <\/targetlanguage><\/dirpath><\/projectname><\/pre>\n<p>If you&#8217;re using Terminal for localization builds currently, you&#8217;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.<\/p>\n<h2>Xcode Internationalization Best Practices<\/h2>\n<p>Although not much is new in the talk from Apple at WWDC 2018 &#8220;Creating Apps for a Global Audience&#8221;, it is a great introduction (or review). As always, the key takeaways for &#8220;easy&#8221; internationalization are:<\/p>\n<ul>\n<li>Use Containers \u2014 UIStackView and others are already internationalized<\/li>\n<li>Use Auto Layout \u2014 it does the rest of the layout work for you<\/li>\n<li>Use Formatters \u2014 it formats numbers, dates, currencies, and even names for you<\/li>\n<li>Use color for emphasis \u2014 Uppercase and italics don&#8217;t work in many scripts outside of Latin, but bold text and different colors usually do the same trick<\/li>\n<li>Check your work \u2014 Xcode includes <a href=\"\/\/www.ibabbleon.com\/pseudolocalization.html\">pseudolanguages<\/a> to test all your assumptions<\/li>\n<li>Use International Fonts \u2014 the built-in app Font Book can tell you which languages your font will work in!<\/li>\n<\/ul>\n<p>On this last point, Apple reiterates some excellent code to choose appropriate fonts for different alphabets:<\/p>\n<pre>\r\nguard let font = UIFont(name: \"SignPainter-HouseScript\", size: UIFont.labelFontSize) else {\r\n}\r\n\r\n\/\/ Create Cascade List\r\nlet cascadeList = [UIFontDescriptor(fontAttributes: [.name: \"HanziPenTC-W5\"])]\r\nlet cascadedFontDescriptor = font.fontDescriptor.addingAttributes([.cascadeList: cascadeList])\r\nlet cascadedFont = UIFont(descriptor: cascadedFontDescriptor, size: font.pointSize)\r\n\r\n\/\/ Handle Text Size (Dynamic Type)\r\nlabel.font = UIFontMetrics.default.scaledFont(for: cascadedFont)\r\nlabel.adjustsFontForContentSizeCategory = true\r\n<\/pre>\n<h2>Xcode 10 Localization Wrap-up<\/h2>\n<p>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 <a href=\"\/\/www.ibabbleon.com\/contact.html\">Benjamin at Babble-on<\/a>. I&#8217;ll help you from start to finish!<\/h2continuous>\n","protected":false},"excerpt":{"rendered":"<p>Xcode 10 bring a couple of new localization and internationalization features to help iOS and Mac developers reach global audiences. Here&#8217;s a wrap-up straight from WWDC 2018&#8217;s sessions:","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"templates\/wide-content.php","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":""},"categories":[85,86,5,31,84],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/posts\/698"}],"collection":[{"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/comments?post=698"}],"version-history":[{"count":11,"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/posts\/698\/revisions"}],"predecessor-version":[{"id":713,"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/posts\/698\/revisions\/713"}],"wp:attachment":[{"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/media?parent=698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/categories?post=698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ibabbleon.com\/copywriter-translator\/wp-json\/wp\/v2\/tags?post=698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}