Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

XLIFF ͜Ε·Ͱͷ΍Γ͔ͨ 3

Slide 4

Slide 4 text

4

Slide 5

Slide 5 text

5

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

8

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

structure - Source Contents Assets used to produce the Localized Contents • Organized into the same file system hierarchy as Xcode project • Provided for context 18

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

Siri Shortcuts localization 24

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

26

Slide 27

Slide 27 text

Intent Definition File - .stringsdict 27

Slide 28

Slide 28 text

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