Slide 1

Slide 1 text

ެ։ SwiftWednesdayʲiOSDC Japan 2023 ௚લʳ 2023/08/24 @DeNA ָ͍͠ՆٳΈʂ 
 String Catalogs Ͱ৽͍͠ൃݟ ojun - DeNA Co., Ltd.

Slide 2

Slide 2 text

ࣗݾ঺հʢPKVOʣ w ໊લPKVO w J04ΤϯδχΞ w ೥৽ଔೖࣾ w ࠃޠ͸4XJGU @ojun_9

Slide 3

Slide 3 text

String Catalogsͱ͸

Slide 4

Slide 4 text

String Catalogsͱ͸ Xcode 15͔Βར༻Ͱ͖ΔϩʔΧϥΠζΛߦ͏ͨΊʹ༻͍ΒΕΔϑΝΠϧ ϑΝΠϧͷ֦ுࢠ͸ .xcstrings Xcode 15 ͔Β͸Legacyѻ͍ʹ Xcode 15 ͔Βར༻Մೳ ͜Ε·Ͱ͸ .strings / .stringdict ϑΝΠϧ͕ར༻͞Ε͍ͯͨ

Slide 5

Slide 5 text

String Catalogsͱ͸ Discover String Catalogs / https://developer.apple.com/videos/play/wwdc2023/10155/

Slide 6

Slide 6 text

String Catalogsͱ͸ Discover String Catalogs / https://developer.apple.com/videos/play/wwdc2023/10155/

Slide 7

Slide 7 text

String Catalogsͱ͸ ϏϧυΛߦ͏ͱ௥Ճͨ͠ 
 Localizable.xcstringsϑΝΠϧͷ 
 த਎͕ࣗಈతʹੜ੒͞ΕΔ

Slide 8

Slide 8 text

String Catalogsͱ͸ .xcstringsϑΝΠϧͷத਎͸JSON

Slide 9

Slide 9 text

String Catalogs ʹ͓͚Δٙ໰ .xcstringsϑΝΠϧΛར༻͢ΔͱϏϧυ੒Ռ෺ʢ.ipaʣʹมԽ͕ੜ͡Δͷ͔ʁ ҧ͍͸͋Δͷ͔ʁ Ϗϧυ Ϗϧυ

Slide 10

Slide 10 text

.ipa ϑΝΠϧͷมԽΛ؍࡯͢Δ ̎ͭͷprojectΛ࡞੒ͯ͠ҧ͍ΛݟΔ

Slide 11

Slide 11 text

Legacy: .stringsϑΝΠϧͷ৔߹ .stringsϑΝΠϧΛ࡞੒͠ɺӳޠͱ೔ຊޠͷϩʔΧϥΠζΛߦ͏ ϩʔΧϥΠζΛߦ͏จݴ͸ҎԼͷ̎ͭ

Slide 12

Slide 12 text

New: .xcstringsͷ৔߹ .xcstringsϑΝΠϧΛ࡞੒͠ɺӳޠͱ೔ຊޠͷϩʔΧϥΠζΛߦ͏ ϩʔΧϥΠζΛߦ͏จݴ͸ઌ΄ͲͷจݴͱಉҰʹ͢Δ

Slide 13

Slide 13 text

.ipaϑΝΠϧͷத਎ .stringsϑΝΠϧͷ৔߹ ύοέʔδͷத਎͸ҎԼͷ௨Γ en.lprojͱja.lprojͷϑΥϧμ͕ೖ͍ͬͯΔ͜ͱ͕Θ͔Δ 􀇻 􀇻

Slide 14

Slide 14 text

.ipaϑΝΠϧͷத਎ .stringsϑΝΠϧͷ৔߹ ֤ .lproj ϑΥϧμͷதʹ͸ Localizable.string ϑΝΠϧ͕֨ೲ͞Ε͍ͯΔ ϑΝΠϧͷத਎͸όΠφϦܗࣜʹม׵͞Ε͍ͯΔ bplist00“_Hello 
 SwiftWednesday 
 [Hello World $

Slide 15

Slide 15 text

.ipaϑΝΠϧͷத਎ .xcstringsϑΝΠϧͷ৔߹ Legacyͷ৔߹ͱ͸ҟͳΓɺen.lprojϑΝΠϧ͕ଘࡏ͠ͳ͍͜ͱ͕Θ͔Δ ja.lproj ϑΝΠϧͷΈ͕ଘࡏ͢Δ 􀇻

Slide 16

Slide 16 text

.ipaϑΝΠϧͷத਎ .xcstringsϑΝΠϧͷ৔߹ ϑΥϧμͷத਎ΛݟΔͱ Localizable.strings ϑΝΠϧ͕ଘࡏ͍ͯ͠Δ 􀇻

Slide 17

Slide 17 text

.ipaϑΝΠϧͷத਎ .xcstringsϑΝΠϧͷ৔߹ ϑΥϧμͷத਎ΛݟΔͱ Localizable.strings ϑΝΠϧ͕ଘࡏ͍ͯ͠Δ 􀇻 .xcstrings ϑΝΠϧΛར༻ͯ͠΋ .ipa ʹ͸ .strings ϑΝΠϧ͕ଘࡏ͍ͯ͠Δ .xcstrings ϑΝΠϧͰ͸ͳ͍!

Slide 18

Slide 18 text

͜Ε·Ͱ͸ .ipaϑΝΠϧΛ࡞੒͢Δͱɺͦͷதʹ .stringsϑΝΠϧ͕࡞ΒΕΔ .ipa ʹଘࡏ͢Δ .string ϑΝΠϧͱݩͷ .string ϑΝΠϧͷத਎͸ҟͳΔ ϩʔΧϥΠζ͢Δݴޠ෼͚ͩੜ੒͞ΕΔ ։ൃத Ϗϧυ .ipa όΠφϦͱͯ͠දݱ

Slide 19

Slide 19 text

͜Ε͔Β͸ .ipaϑΝΠϧΛ࡞੒͢Δͱɺͦͷதʹ .stringsϑΝΠϧ͕࡞ΒΕΔ .string ϑΝΠϧͷத਎͸όΠφϦ ੜ੒͞ΕΔϑΝΠϧ਺͸࣮૷ʹΑͬͯ͸ݮগ͢Δ Ϗϧυ ։ൃத .ipa όΠφϦͱͯ͠දݱ

Slide 20

Slide 20 text

͜Ε͔Β͸ .ipaΛ࡞ΔաఔͰ .xcstringsϑΝΠϧΛ .stringsϑΝΠϧʹม׵͍ͯ͠Δ ม׵ ։ൃத Ϗϧυ ipa

Slide 21

Slide 21 text

͜Ε͔Β͸ .ipaΛ࡞ΔաఔͰ .xcstringsϑΝΠϧΛ .stringsϑΝΠϧʹม׵͍ͯ͠Δ ม׵ ։ൃத Ϗϧυ ipa xcstringstool

Slide 22

Slide 22 text

xcstringstoolΛ୳Δ

Slide 23

Slide 23 text

xcstringstool ֓ཁ w 5PPM͕ଘࡏ͢Δ৔ॴ w 9DPEFBQQ$POUFOUT%FWFMPQFSVTSCJO w FYFDϑΝΠϧ w YDTUSJOHTϑΝΠϧͷૢ࡞Λߦ͏ w 9DPEF͔Β௥Ճ͞Εͨ

Slide 24

Slide 24 text

xcstringstool ֓ཁ

Slide 25

Slide 25 text

xcstringstool ֓ཁ w αϒίϚϯυΛೖΕ࣮ͯߦ͢Δ w αϒίϚϯυ͸̏ͭ w QSJOU w DPNQJMF w TZOD

Slide 26

Slide 26 text

αϒίϚϯυ print ʹ͍ͭͯ ֓ཁ: xcstringsϑΝΠϧʹදࣔ͞ΕΔ͢΂ͯͷ 
 จࣈྻΩʔΛදࣔ͢Δ xcstringstool print ࢖͍ํ Ҿ਺ දࣔ͢Δ.xcstringsϑΝΠϧ΁ͷύε Φϓγϣϯ -h —help ϔϧϓ৘ใΛදࣔ

Slide 27

Slide 27 text

printͷ࢖༻ྫ $ ./xcstringstool print ~/Desktop/Localizable.xcstrings Hello SwiftWednesday Hello World ίϚϯυΛར༻͢Δͱ .xcstrings ϑΝΠϧʹଘࡏ͍ͯ͠Δ Key ͕ग़ྗ͞Ε͍ͯΔ 
 ͜ͱ͕Θ͔Δ

Slide 28

Slide 28 text

αϒίϚϯυ compile ʹ͍ͭͯ ֓ཁ: .xcstringsϑΝΠϧͷϏϧυ੒ՌʢίϯύΠϧ݁ՌʣΛੜ੒͢Δ ࢖͍ํ xcstringstool compile 
 \ 
 --output-directory \ 
 --format ɹ \ 
 --language … \ 
 --serialization-format \ 
 --dry-run option Ҿ਺ ίϯύΠϧ͢Δ.xcstringsϑΝΠϧ΁ͷύε

Slide 29

Slide 29 text

αϒίϚϯυ compile ʹ͍ͭͯ -o --output-directory ग़ྗϑΝΠϧΛ഑ஔ͢ΔσΟϨΫτϦ -f --format ίϯύΠϧͷग़ྗܗࣜ 
 ɹɹɹɹɹɹɹɹɹɹɹ ɹɹ σϑΥϧτ: stringsAndStringsdict -l --language ίϯύΠϧ͢ΔಛఆݴޠΛࢦఆ 
 ͜ͷΦϓγϣϯ͸ෳ਺ճར༻Մೳ --serialization-format ҟͳΔදݱ͕ՄೳͳݸʑͷϑΝΠϧͷग़ྗܗࣜ 
 ɹɹɹɹɹɹɹɹɹɹ σϑΥϧτ: text --dry-run ίϯύΠϧʹΑΓੜ੒͞ΕΔग़ྗύεͷվߦ۠੾ΓͷϦετΛग़ྗ͢Δ͕ 
 ࣮ࡍʹ͸Կ΋ίϯύΠϧ͠ͳ͍

Slide 30

Slide 30 text

compile ͷ࢖༻ྫ $./xcstringstool compile ~/Desktop/Localizable.xcstrings 
 -- output-directory ~/Desktop ίϚϯυΛ࢖༻͢Δͱ.stringsϑΝΠϧ 
 ͕ੜ੒͞ΕΔ த਎͸ͳ͔ͥ dictionary ܗࣜʹͳ͍ͬͯΔ

Slide 31

Slide 31 text

compile ͷ࢖༻ྫ $./xcstringstool compile ~/Desktop/Localizable.xcstrings 
 -- output-directory ~/Desktop -- serialization-format binary FormatʹbinaryΛࢦఆ͢Δ͜ͱͰbinaryܗࣜͰͷੜ੒͕Ͱ͖Δ ipaϑΝΠϧ಺ͷܗࣜͱҰக͢ΔͷͰ 
 Xcode͸ύοέʔδ࡞੒࣌ʹ͜ͷίϚϯυΛ 
 ୟ͍ͯͦ͏

Slide 32

Slide 32 text

αϒίϚϯυ sync ʹ͍ͭͯ ֓ཁ: .stringsdataϑΝΠϧʹଘࡏ͢Δจࣈྻʹج͖ͮ 
 .xcstringsϑΝΠϧΛߋ৽͢Δ ࢖͍ํ xcstringstool sync ... 
 --stringsdata ... 
 --skip-marking-strings-stale option Ҿ਺ Ϛʔδઌͷ.xcstringsϑΝΠϧ

Slide 33

Slide 33 text

αϒίϚϯυ sync ʹ͍ͭͯ --stringsdata ιʔε͔Β࢖༻͞ΕΔจࣈྻΛࢦఆ͢Δ 
 .stringsdataϑΝΠϧ --skip-marking-strings-stale .stringsdataʹଘࡏ͠ͳ͍৔߹ʹ 
 จࣈྻΛݹ͍΋ͷͱͯ͠ϚʔΫͨ͠Γ 
 .xcstrings͔ΒͦΕΒΛ࡟আͨ͠Γ͢ΔͷΛ๷͙ .stringsdataϑΝΠϧΛ࡞੒Ͱ͖ͣίϚϯυΛࢼͤͳ͔ͬͨ ϚΠάϨʔγϣϯΛߦ͏ࡍʹར༻͞ΕΔՄೳੑ͕͋Δ

Slide 34

Slide 34 text

LT·ͱΊ

Slide 35

Slide 35 text

·ͱΊ 1. Xcode 15 ͔Β͸ଟݴޠରԠΛߦ͏ࡍʹ .xcstrings Λར༻͢Δ͜ͱ͕Ͱ͖Δ 2. .xcstrings ϑΝΠϧΛར༻ͯ͠΋ .ipa ϑΝΠϧʹ͸ 
 ͜Ε·Ͱ௨Γ .strings ϑΝΠϧ͕ੜ੒͞ΕΔ 3. .xcstrings ϑΝΠϧ͔Β .strings ϑΝΠϧ΁ͷม׵͸ Xcode 15 ͔Β௥Ճ͞Εͨ 
 xcstringstool ͕ར༻͞Ε͍ͯΔՄೳੑ͕ߴ͍ 1. xcstringstool ͷ compile ίϚϯυΛར༻͠όΠφϦͷੜ੒ΛߦͬͯΔ 2. option ͱͯ͠ --serialization-format binary ͕ࢦఆ͞Ε͍ͯΔ

Slide 36

Slide 36 text

͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ