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

New Localization Workflows in Xcode 10 / 20180611 #wwdc_rusuban

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/

704056da9a4c4e075ad14479beaebab7?s=128

takasek

June 11, 2018
Tweet

Transcript

  1. New Localization Workflows in Xcode 10 by. 2018/6/11 WWDCΰϦΰϦΩϟονΞοϓձ 1

  2. takasek @takasek Works OSS: ActionClosurable౳ App: PasteTheType Articles ʮίϯύΠϧΤϥʔ΍ϥϯλΠϜΤϥʔΛ௚͍ͯ͘͠ ͚ͩͰiOSΞϓϦͷ࡞Γํ͕Θ͔ΔϓϩδΣΫτʯ

    ʮ͓લΒ͕ModelͱݺͿΞϨΛͳΜͱݺͿ΂͖͔ʯ ! ʮiOSΞϓϦઃܭύλʔϯೖ໳ʯʢڞஶʣ 2
  3. XLIFF ͜Ε·Ͱͷ΍Γ͔ͨ 3

  4. 4

  5. 5

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

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

    metadata • Size and length restrictions 7
  8. 8

  9. จ຺ͱ͔ ը໘αΠζͱ͔ Θ͔Γʹ͍͘ 9

  10. Xcode Localization Catalog ͋ͨΒ͍͠΍Γ͔ͨ 10

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

    .xcloc extension • Support localization of assets beyond strings • Provide additional contextual information 11
  12. Xcode Localization Catalog Project rootΛબ୒ͯ͠ Editor > Export For Localization...

    ͰΤΫεϙʔτ 12
  13. structure - contents.json Metadata about the localization catalog • Development

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

    ! exprt ͯ͠΋ Version͸ "1.0" ݻఆͷ··ͩͬͨ Bundle versionͱ࿈ಈ͍ͯ͠ΔΘ͚Ͱ ΋ͳ͍ xcloc ͷ࢓༷͕มΘͬͨͱ͖ʹϚΠά Ϩʔγϣϯʹ࢖͏ͷ͔ͳ 14
  15. 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
  16. 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
  17. structure - Localized Contents ิ଍ • Organized into the same

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

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

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

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

    <targetlanguage>] ...] $ xcodebuild -importLocalizations -project <projectname> -localizationPath </path/to/language.xcloc> 21
  22. CI integration ิ଍ • Xcode͔ΒGUIܦ༝ͰͷexportͰ͸ Development Language ʹࢦఆ͞Εͨݴޠͷ .xcloc ͸ग़ྗͰ͖ͳ͍

    • xcodebuild ίϚϯυܦ༝ͳΒग़ྗՄೳ 22
  23. 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
  24. Siri Shortcuts localization 24

  25. 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
  26. 26

  27. Intent Definition File - .stringsdict 27

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

    28