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/

takasek

June 11, 2018
Tweet

More Decks by takasek

Other Decks in Programming

Transcript

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

    View Slide

  2. takasek
    @takasek
    Works
    OSS: ActionClosurable౳
    App: PasteTheType
    Articles
    ʮίϯύΠϧΤϥʔ΍ϥϯλΠϜΤϥʔΛ௚͍ͯ͘͠
    ͚ͩͰiOSΞϓϦͷ࡞Γํ͕Θ͔ΔϓϩδΣΫτʯ
    ʮ͓લΒ͕ModelͱݺͿΞϨΛͳΜͱݺͿ΂͖͔ʯ
    !
    ʮiOSΞϓϦઃܭύλʔϯೖ໳ʯʢڞஶʣ
    2

    View Slide

  3. XLIFF
    ͜Ε·Ͱͷ΍Γ͔ͨ
    3

    View Slide

  4. 4

    View Slide

  5. 5

    View Slide

  6. XLIFF
    benefits
    • Abstracts localization from code
    • Contains development-language and translated
    strings
    • Supports multiple file types in a single document
    6

    View Slide

  7. XLIFF
    limitations
    • Visual context
    • Resource data
    • Custom metadata
    • Size and length restrictions
    7

    View Slide

  8. 8

    View Slide

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

    View Slide

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

    View Slide

  11. Xcode Localization Catalog
    • New type of localization artifact with .xcloc
    extension
    • Support localization of assets beyond strings
    • Provide additional contextual information
    11

    View Slide

  12. Xcode Localization Catalog
    Project rootΛબ୒ͯ͠ Editor > Export For Localization... ͰΤΫεϙʔτ
    12

    View Slide

  13. structure
    - contents.json
    Metadata about the localization
    catalog
    • Development region
    • Target locale
    • Tool info
    • Version
    13

    View Slide

  14. structure
    - contents.json
    !
    Կʹ࢖͑Δͷ͔ෆ໌
    export -> ਺ࣈ্͛Δ ! import !
    exprt ͯ͠΋
    Version͸ "1.0" ݻఆͷ··ͩͬͨ
    Bundle versionͱ࿈ಈ͍ͯ͠ΔΘ͚Ͱ
    ΋ͳ͍
    xcloc ͷ࢓༷͕มΘͬͨͱ͖ʹϚΠά
    Ϩʔγϣϯʹ࢖͏ͷ͔ͳ
    14

    View Slide

  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

    View Slide

  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

    View Slide

  17. structure
    - Localized Contents
    ิ଍
    • Organized into the same file system hierarchy as Xcode project
    ͡Ό͋ exportޙʹ
    hierarchyʹมߋ͕͋ͬͨ৔߹Ͳ͏ͳΔ͔…ʁ
    → import࣌ʹ missing warning͕ग़·͢
    17

    View Slide

  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

    View Slide

  19. structure - Notes
    • Provide additional information
    to the localizers
    ૝ఆworkflowͱͯ͠͸ɺCIͰϑΝΠ
    ϧΛಥͬࠐΉͨΊͷೖΕ෺
    UI testͰੜ੒ͨ͠screenshotsΛί
    ϐʔ͢Δͱ͔
    19

    View Slide

  20. structure - Notes
    !
    • export࣌఺Ͱ͸ۭσΟϨΫτϦ
    • ࢼ͠ʹϑΝΠϧΛೖΕͯ
    import -> export ͨ͠Βɺ
    ·ۭͨσΟϨΫτϦʹͳͬͨ
    !
    • CLI͔ΒͷexportͰ΋ಉ༷
    ۭͰ্ॻ͖͞Ε·͢
    !
    20

    View Slide

  21. CI integration
    $ xcodebuild
    -exportLocalizations
    -project
    -localizationPath
    [[-exportLanguage ] ...]
    $ xcodebuild
    -importLocalizations
    -project
    -localizationPath
    21

    View Slide

  22. CI integration
    ิ଍
    • Xcode͔ΒGUIܦ༝ͰͷexportͰ͸ Development
    Language ʹࢦఆ͞Εͨݴޠͷ .xcloc ͸ग़ྗͰ͖ͳ͍
    • xcodebuild ίϚϯυܦ༝ͳΒग़ྗՄೳ
    22

    View Slide

  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

    View Slide

  24. Siri Shortcuts localization
    24

    View Slide

  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

    View Slide

  26. 26

    View Slide

  27. Intent Definition File - .stringsdict
    27

    View Slide

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

    View Slide