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
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
260
From Idea to IDE: Developing Plugins for Android Studio
thisaay
1
230
Android開発以外のAndroid開発経験の活かしどころ
konifar
2
1.1k
Swiftコードバトル必勝法
toshi0383
0
170
Rechartsで楽にゴリゴリにカスタマイズする!
10tera
1
170
全部見せます! クラシルリワードのSwiftTesting移行プロジェクト
uetyo
0
220
上手に付き合うコンポーネントテスト
quramy
1
410
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
390
The Shape of a Service Object
inem
0
540
Data Contracts In Practice With Debezium and Apache Flink
gunnarmorling
0
120
Perl 5 OOP機構30年史 - Perl 5's OOP Mechanism over the past 30 years
moznion
0
430
Architecture Decision Record (ADR)
nearme_tech
PRO
1
700
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
270
40k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
158
15k
Rails Girls Zürich Keynote
gr2m
93
13k
Ruby is Unlike a Banana
tanoku
96
11k
Atom: Resistance is Futile
akmur
261
25k
Building Your Own Lightsaber
phodgson
101
6k
Building Applications with DynamoDB
mza
90
6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
Design by the Numbers
sachag
277
19k
Imperfection Machines: The Place of Print at Facebook
scottboms
263
13k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
0
140
No one is an island. Learnings from fostering a developers community.
thoeni
18
2.9k
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 ͕ࢦఆ͞Ε͍ͯΔ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ