Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
楽しい夏休み!String Catalogs で新しい発見
Search
ojun
August 24, 2023
Programming
0
1.8k
楽しい夏休み!String Catalogs で新しい発見
ojun
August 24, 2023
Tweet
Share
More Decks by ojun
See All by ojun
Xcode 16のPreviewModifierと@Previewableを活用した効率的なプレビュー方法の考察
ojun9
2
290
Catch Up with Swift 5.10
ojun9
2
700
Overview: Swift OpenAPI Generator
ojun9
3
1.4k
if 式と switch 式による SwiftUI のプレビューエラー対策
ojun9
1
1.2k
ユニットテストを学んだ次に知りたかったApple標準APIに対するテストのやり方
ojun9
1
380
ハッカソンにおけるiOSアプリ開発での学びと楽しさ
ojun9
1
310
Other Decks in Programming
See All in Programming
Modernisation Progressive d’Applications PHP
hhamon
0
110
REXML改善のその後
naitoh
0
190
From Idea to IDE: Developing Plugins for Android Studio
thisaay
1
230
Architecture Decision Record (ADR)
nearme_tech
PRO
1
700
What is Parser
yui_knk
9
4.2k
React + TextAliveでカッコいいLyric Applicatioinを作ろう!!
tosuri13
0
400
XStateでReactに秩序を与えたい
gizm000
0
740
Increased Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
420
o1モデルのプロンプトエンジニアリングって?
ktc_wada
0
300
How to Break into Reading Open Source
kaspth
2
220
はじめてみよう量子プログラミング
itokoichi01
0
220
Swiftコードバトル必勝法
toshi0383
0
170
Featured
See All Featured
Faster Mobile Websites
deanohume
304
30k
In The Pink: A Labor of Love
frogandcode
139
22k
Gamification - CAS2011
davidbonilla
79
5k
What the flash - Photography Introduction
edds
67
11k
Git: the NoSQL Database
bkeepers
PRO
425
64k
The Illustrated Children's Guide to Kubernetes
chrisshort
47
48k
Making Projects Easy
brettharned
113
5.8k
The Invisible Side of Design
smashingmag
296
50k
Building a Scalable Design System with Sketch
lauravandoore
458
32k
Into the Great Unknown - MozCon
thekraken
29
1.4k
How to Think Like a Performance Engineer
csswizardry
16
960
The Language of Interfaces
destraynor
153
23k
Transcript
ެ։ SwiftWednesdayʲiOSDC Japan 2023 લʳ 2023/08/24 @DeNA ָ͍͠ՆٳΈʂ String
Catalogs Ͱ৽͍͠ൃݟ ojun - DeNA Co., Ltd.
ࣗݾհʢPKVOʣ w ໊લPKVO w J04ΤϯδχΞ w ৽ଔೖࣾ w ࠃޠ4XJGU @ojun_9
String Catalogsͱ
String Catalogsͱ Xcode 15͔Βར༻Ͱ͖ΔϩʔΧϥΠζΛߦ͏ͨΊʹ༻͍ΒΕΔϑΝΠϧ ϑΝΠϧͷ֦ுࢠ .xcstrings Xcode 15 ͔ΒLegacyѻ͍ʹ Xcode
15 ͔Βར༻Մೳ ͜Ε·Ͱ .strings / .stringdict ϑΝΠϧ͕ར༻͞Ε͍ͯͨ
String Catalogsͱ Discover String Catalogs / https://developer.apple.com/videos/play/wwdc2023/10155/
String Catalogsͱ Discover String Catalogs / https://developer.apple.com/videos/play/wwdc2023/10155/
String Catalogsͱ ϏϧυΛߦ͏ͱՃͨ͠ Localizable.xcstringsϑΝΠϧͷ த͕ࣗಈతʹੜ͞ΕΔ
String Catalogsͱ .xcstringsϑΝΠϧͷதJSON
String Catalogs ʹ͓͚Δٙ .xcstringsϑΝΠϧΛར༻͢ΔͱϏϧυՌʢ.ipaʣʹมԽ͕ੜ͡Δͷ͔ʁ ҧ͍͋Δͷ͔ʁ Ϗϧυ Ϗϧυ
.ipa ϑΝΠϧͷมԽΛ؍͢Δ ̎ͭͷprojectΛ࡞ͯ͠ҧ͍ΛݟΔ
Legacy: .stringsϑΝΠϧͷ߹ .stringsϑΝΠϧΛ࡞͠ɺӳޠͱຊޠͷϩʔΧϥΠζΛߦ͏ ϩʔΧϥΠζΛߦ͏จݴҎԼͷ̎ͭ
New: .xcstringsͷ߹ .xcstringsϑΝΠϧΛ࡞͠ɺӳޠͱຊޠͷϩʔΧϥΠζΛߦ͏ ϩʔΧϥΠζΛߦ͏จݴઌ΄ͲͷจݴͱಉҰʹ͢Δ
.ipaϑΝΠϧͷத .stringsϑΝΠϧͷ߹ ύοέʔδͷதҎԼͷ௨Γ en.lprojͱja.lprojͷϑΥϧμ͕ೖ͍ͬͯΔ͜ͱ͕Θ͔Δ
.ipaϑΝΠϧͷத .stringsϑΝΠϧͷ߹ ֤ .lproj ϑΥϧμͷதʹ Localizable.string ϑΝΠϧ͕֨ೲ͞Ε͍ͯΔ ϑΝΠϧͷதόΠφϦܗࣜʹม͞Ε͍ͯΔ bplist00“_Hello
SwiftWednesday [Hello World $
.ipaϑΝΠϧͷத .xcstringsϑΝΠϧͷ߹ Legacyͷ߹ͱҟͳΓɺen.lprojϑΝΠϧ͕ଘࡏ͠ͳ͍͜ͱ͕Θ͔Δ ja.lproj ϑΝΠϧͷΈ͕ଘࡏ͢Δ
.ipaϑΝΠϧͷத .xcstringsϑΝΠϧͷ߹ ϑΥϧμͷதΛݟΔͱ Localizable.strings ϑΝΠϧ͕ଘࡏ͍ͯ͠Δ
.ipaϑΝΠϧͷத .xcstringsϑΝΠϧͷ߹ ϑΥϧμͷதΛݟΔͱ Localizable.strings ϑΝΠϧ͕ଘࡏ͍ͯ͠Δ .xcstrings ϑΝΠϧΛར༻ͯ͠ .ipa ʹ
.strings ϑΝΠϧ͕ଘࡏ͍ͯ͠Δ .xcstrings ϑΝΠϧͰͳ͍!
͜Ε·Ͱ .ipaϑΝΠϧΛ࡞͢Δͱɺͦͷதʹ .stringsϑΝΠϧ͕࡞ΒΕΔ .ipa ʹଘࡏ͢Δ .string ϑΝΠϧͱݩͷ .string ϑΝΠϧͷதҟͳΔ ϩʔΧϥΠζ͢Δݴޠ͚ͩੜ͞ΕΔ
։ൃத Ϗϧυ .ipa όΠφϦͱͯ͠දݱ
͜Ε͔Β .ipaϑΝΠϧΛ࡞͢Δͱɺͦͷதʹ .stringsϑΝΠϧ͕࡞ΒΕΔ .string ϑΝΠϧͷதόΠφϦ ੜ͞ΕΔϑΝΠϧ࣮ʹΑͬͯݮগ͢Δ Ϗϧυ ։ൃத .ipa όΠφϦͱͯ͠දݱ
͜Ε͔Β .ipaΛ࡞ΔաఔͰ .xcstringsϑΝΠϧΛ .stringsϑΝΠϧʹม͍ͯ͠Δ ม ։ൃத Ϗϧυ ipa
͜Ε͔Β .ipaΛ࡞ΔաఔͰ .xcstringsϑΝΠϧΛ .stringsϑΝΠϧʹม͍ͯ͠Δ ม ։ൃத Ϗϧυ ipa xcstringstool
xcstringstoolΛ୳Δ
xcstringstool ֓ཁ w 5PPM͕ଘࡏ͢Δॴ w 9DPEFBQQ$POUFOUT%FWFMPQFSVTSCJO w FYFDϑΝΠϧ w YDTUSJOHTϑΝΠϧͷૢ࡞Λߦ͏
w 9DPEF͔ΒՃ͞Εͨ
xcstringstool ֓ཁ
xcstringstool ֓ཁ w αϒίϚϯυΛೖΕ࣮ͯߦ͢Δ w αϒίϚϯυ̏ͭ w QSJOU w DPNQJMF
w TZOD
αϒίϚϯυ print ʹ͍ͭͯ ֓ཁ: xcstringsϑΝΠϧʹදࣔ͞ΕΔͯ͢ͷ จࣈྻΩʔΛදࣔ͢Δ xcstringstool print <input-
fi le> ͍ํ Ҿ <input- fi le> දࣔ͢Δ.xcstringsϑΝΠϧͷύε Φϓγϣϯ -h —help ϔϧϓใΛදࣔ
printͷ༻ྫ $ ./xcstringstool print ~/Desktop/Localizable.xcstrings Hello SwiftWednesday Hello World ίϚϯυΛར༻͢Δͱ
.xcstrings ϑΝΠϧʹଘࡏ͍ͯ͠Δ Key ͕ग़ྗ͞Ε͍ͯΔ ͜ͱ͕Θ͔Δ
αϒίϚϯυ compile ʹ͍ͭͯ ֓ཁ: .xcstringsϑΝΠϧͷϏϧυՌʢίϯύΠϧ݁ՌʣΛੜ͢Δ ͍ํ xcstringstool compile <input-
fi le> \ --output-directory <output-directory> \ --format <format> ɹ \ --language <language> … \ --serialization-format <serialization-format> \ --dry-run option Ҿ <input- fi le> ίϯύΠϧ͢Δ.xcstringsϑΝΠϧͷύε
αϒίϚϯυ compile ʹ͍ͭͯ -o --output-directory ग़ྗϑΝΠϧΛஔ͢ΔσΟϨΫτϦ -f --format <format> ίϯύΠϧͷग़ྗܗࣜ
ɹɹɹɹɹɹɹɹɹɹɹ ɹɹ σϑΥϧτ: stringsAndStringsdict -l --language <language> ίϯύΠϧ͢ΔಛఆݴޠΛࢦఆ ͜ͷΦϓγϣϯෳճར༻Մೳ --serialization-format <serialization-format> ҟͳΔදݱ͕ՄೳͳݸʑͷϑΝΠϧͷग़ྗܗࣜ ɹɹɹɹɹɹɹɹɹɹ σϑΥϧτ: text --dry-run ίϯύΠϧʹΑΓੜ͞ΕΔग़ྗύεͷվߦ۠ΓͷϦετΛग़ྗ͢Δ͕ ࣮ࡍʹԿίϯύΠϧ͠ͳ͍
compile ͷ༻ྫ $./xcstringstool compile ~/Desktop/Localizable.xcstrings -- output-directory ~/Desktop ίϚϯυΛ༻͢Δͱ.stringsϑΝΠϧ
͕ੜ͞ΕΔ தͳ͔ͥ dictionary ܗࣜʹͳ͍ͬͯΔ
compile ͷ༻ྫ $./xcstringstool compile ~/Desktop/Localizable.xcstrings -- output-directory ~/Desktop --
serialization-format binary FormatʹbinaryΛࢦఆ͢Δ͜ͱͰbinaryܗࣜͰͷੜ͕Ͱ͖Δ ipaϑΝΠϧͷܗࣜͱҰக͢ΔͷͰ Xcodeύοέʔδ࡞࣌ʹ͜ͷίϚϯυΛ ୟ͍ͯͦ͏
αϒίϚϯυ sync ʹ͍ͭͯ ֓ཁ: .stringsdataϑΝΠϧʹଘࡏ͢Δจࣈྻʹج͖ͮ .xcstringsϑΝΠϧΛߋ৽͢Δ ͍ํ xcstringstool sync
<xcstrings> ... --stringsdata <stringsdata> ... --skip-marking-strings-stale option Ҿ <xcstrings> Ϛʔδઌͷ.xcstringsϑΝΠϧ
αϒίϚϯυ sync ʹ͍ͭͯ --stringsdata <stringsdata> ιʔε͔Β༻͞ΕΔจࣈྻΛࢦఆ͢Δ .stringsdataϑΝΠϧ --skip-marking-strings-stale .stringsdataʹଘࡏ͠ͳ͍߹ʹ
จࣈྻΛݹ͍ͷͱͯ͠ϚʔΫͨ͠Γ .xcstrings͔ΒͦΕΒΛআͨ͠Γ͢ΔͷΛ͙ .stringsdataϑΝΠϧΛ࡞Ͱ͖ͣίϚϯυΛࢼͤͳ͔ͬͨ ϚΠάϨʔγϣϯΛߦ͏ࡍʹར༻͞ΕΔՄೳੑ͕͋Δ
LT·ͱΊ
·ͱΊ 1. Xcode 15 ͔ΒଟݴޠରԠΛߦ͏ࡍʹ .xcstrings Λར༻͢Δ͜ͱ͕Ͱ͖Δ 2. .xcstrings ϑΝΠϧΛར༻ͯ͠
.ipa ϑΝΠϧʹ ͜Ε·Ͱ௨Γ .strings ϑΝΠϧ͕ੜ͞ΕΔ 3. .xcstrings ϑΝΠϧ͔Β .strings ϑΝΠϧͷม Xcode 15 ͔ΒՃ͞Εͨ xcstringstool ͕ར༻͞Ε͍ͯΔՄೳੑ͕ߴ͍ 1. xcstringstool ͷ compile ίϚϯυΛར༻͠όΠφϦͷੜΛߦͬͯΔ 2. option ͱͯ͠ --serialization-format binary ͕ࢦఆ͞Ε͍ͯΔ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ