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.9k
楽しい夏休み!String Catalogs で新しい発見
ojun
August 24, 2023
Tweet
Share
More Decks by ojun
See All by ojun
Swift Evolution かるた
ojun9
2
91
Xcode 16のPreviewModifierと@Previewableを活用した効率的なプレビュー方法の考察
ojun9
4
530
Catch Up with Swift 5.10
ojun9
2
740
Overview: Swift OpenAPI Generator
ojun9
3
1.7k
if 式と switch 式による SwiftUI のプレビューエラー対策
ojun9
1
1.3k
ユニットテストを学んだ次に知りたかったApple標準APIに対するテストのやり方
ojun9
1
390
ハッカソンにおけるiOSアプリ開発での学びと楽しさ
ojun9
1
320
Other Decks in Programming
See All in Programming
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
初めてDefinitelyTypedにPRを出した話
syumai
0
440
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Outline View in SwiftUI
1024jp
1
350
CSC509 Lecture 13
javiergs
PRO
0
110
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
1.1k
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
0
570
Realtime API 入門
riofujimon
0
150
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
6
1.7k
Click-free releases & the making of a CLI app
oheyadam
2
120
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Being A Developer After 40
akosma
87
590k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Six Lessons from altMBA
skipperchong
27
3.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
We Have a Design System, Now What?
morganepeng
50
7.2k
Git: the NoSQL Database
bkeepers
PRO
427
64k
How to Ace a Technical Interview
jacobian
276
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 ͕ࢦఆ͞Ε͍ͯΔ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ