Upgrade to Pro — share decks privately, control downloads, hide ads and more …

New Localization Workflows in Xcode 10 / 201806...

New Localization Workflows in Xcode 10 / 20180611 #wwdc_rusuban

【増枠】お留守番でもついていけるもん!WWDCゴリゴリキャッチアップ会 - connpass
https://connpass.com/event/89868/
での発表資料です。

New Localization Workflows in Xcode 10
https://developer.apple.com/videos/play/wwdc2018/404/

takasek

June 11, 2018
Tweet

More Decks by takasek

Other Decks in Programming

Transcript

  1. 4

  2. 5

  3. XLIFF benefits • Abstracts localization from code • Contains development-language

    and translated strings • Supports multiple file types in a single document 6
  4. XLIFF limitations • Visual context • Resource data • Custom

    metadata • Size and length restrictions 7
  5. 8

  6. Xcode Localization Catalog • New type of localization artifact with

    .xcloc extension • Support localization of assets beyond strings • Provide additional contextual information 11
  7. structure - contents.json Metadata about the localization catalog • Development

    region • Target locale • Tool info • Version 13
  8. structure - contents.json ! Կʹ࢖͑Δͷ͔ෆ໌ export -> ਺ࣈ্͛Δ ! import

    ! exprt ͯ͠΋ Version͸ "1.0" ݻఆͷ··ͩͬͨ Bundle versionͱ࿈ಈ͍ͯ͠ΔΘ͚Ͱ ΋ͳ͍ xcloc ͷ࢓༷͕มΘͬͨͱ͖ʹϚΠά Ϩʔγϣϯʹ࢖͏ͷ͔ͳ 14
  9. structure - Localized Contents XLIFF 1.2 document containing • the

    project localized strings • Non-strings localizable assets • Organized into the same file system hierarchy as Xcode project • Override resources 15
  10. structure - Localized Contents XLIFF 1.2 document containing • the

    project localized strings • Non-strings localizable assets • Organized into the same file system hierarchy as Xcode project • Override resources 16
  11. structure - Localized Contents ิ଍ • Organized into the same

    file system hierarchy as Xcode project ͡Ό͋ exportޙʹ hierarchyʹมߋ͕͋ͬͨ৔߹Ͳ͏ͳΔ͔…ʁ → import࣌ʹ missing warning͕ग़·͢ 17
  12. structure - Source Contents Assets used to produce the Localized

    Contents • Organized into the same file system hierarchy as Xcode project • Provided for context 18
  13. structure - Notes • Provide additional information to the localizers

    ૝ఆworkflowͱͯ͠͸ɺCIͰϑΝΠ ϧΛಥͬࠐΉͨΊͷೖΕ෺ UI testͰੜ੒ͨ͠screenshotsΛί ϐʔ͢Δͱ͔ 19
  14. structure - Notes ! • export࣌఺Ͱ͸ۭσΟϨΫτϦ • ࢼ͠ʹϑΝΠϧΛೖΕͯ import ->

    export ͨ͠Βɺ ·ۭͨσΟϨΫτϦʹͳͬͨ ! • CLI͔ΒͷexportͰ΋ಉ༷ ۭͰ্ॻ͖͞Ε·͢ ! 20
  15. CI integration $ xcodebuild -exportLocalizations -project <projectname> -localizationPath <dirpath> [[-exportLanguage

    <targetlanguage>] ...] $ xcodebuild -importLocalizations -project <projectname> -localizationPath </path/to/language.xcloc> 21
  16. CI integration ิ଍ UI testͰͷscreenshotͷऔΓํ let screenshot = XCUIScreen.main.screenshot() let

    attachment = XCTAttachment(screenshot: screenshot) attachment.lifetime = .keepAlways add(attachment) ! ~/Library/Developer/Xcode/DerivedData/Hogehoge/Test/ Hogehoge.xcresult/Attachments ʹ֨ೲ͞ΕΔ 23
  17. Intent Definition Localization • Xcode combines Shortcut types and enums

    when generating .strings file • .strings and/or .stringsdict are used to localize Shortcuts • Use deferredLocalizedIntentsString API for donated intents intent.suggestedInvocationPhrase = NSString.deferredLocalizedIntentsString(with: "Go to Mars!") 25
  18. 26