Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
ios-internationalization
horimislime
August 11, 2015
Programming
2
8.3k
ios-internationalization
horimislime
August 11, 2015
Tweet
Share
More Decks by horimislime
See All by horimislime
How we build our app with minimum 3rd party dependencies
horimislime
0
41
サポート効率を上げるためのロギング環境構築
horimislime
7
3.3k
migrating-from-promise-to-reactive
horimislime
0
290
社内Swiftもくもく会成果発表
horimislime
0
96
Swift Optional Extension Tips
horimislime
1
980
UI testing in XCode7
horimislime
3
660
UIテストをカジュアルに自動化 / UI Automation using Remote
horimislime
2
2k
Swift Libraryざっくり現状確認 / Swift library overview
horimislime
1
110
1時間で作るSwiftアプリ / Swift Application in an hour
horimislime
2
100
Other Decks in Programming
See All in Programming
ESM移行は無理だけどおれもSindreのライブラリが使いたい!
sosukesuzuki
2
560
Google I/O 2022 Android関連概要 / Google I/O 2022 Android summary
phicdy
1
420
How GitHub Supports Vim License Detection, The Five Years Journey
othree
1
400
AmebaのDesign SystemとCompose
messi_0601
0
130
Regular expressions basics/正規表現の基本
kishikawakatsumi
6
270
There's an API for that!
mariatta
PRO
0
110
Isar勉強会
hoddy3190
0
620
Recap CDN, Edge, WebAssembly | ワインと鍋.js#1
sadnessojisan
2
1.2k
「困りごと」から始める個人開発
ikumatadokoro
4
270
kintoneでランダム取得を作ってみた(imoniCamp 2022-07-27)
shokun1108
0
150
Enzyme から React Native Testing Library に移行した経緯 / 2022-07-20
tamago3keran
1
160
FutureCon 2022 FlutterアプリのPerformance測定
harukafujita
0
140
Featured
See All Featured
How New CSS Is Changing Everything About Graphic Design on the Web
jensimmons
213
11k
Thoughts on Productivity
jonyablonski
44
2.4k
Testing 201, or: Great Expectations
jmmastey
21
5.5k
Done Done
chrislema
174
14k
Bash Introduction
62gerente
598
210k
Navigating Team Friction
lara
175
11k
Agile that works and the tools we love
rasmusluckow
319
19k
Design by the Numbers
sachag
271
17k
Art, The Web, and Tiny UX
lynnandtonic
280
18k
Debugging Ruby Performance
tmm1
65
10k
The Brand Is Dead. Long Live the Brand.
mthomps
46
2.7k
Code Reviewing Like a Champion
maltzj
506
37k
Transcript
ӳޠ൛ϦϦʔεલʹ ͓͖͍ͬͯͨ͜ͱ! Potatotips 20 @horimislime
@horimislime גࣜձࣾτϨλ
None
None
None
ӳޠԽ • ݴޠϦιʔε͚ͯΔ͠େৎͩΖɾɾ • ͳΜͯࣄͳ͍ • Localizableͷ͍ํΛϛεΔͱେม • ͍͔ͭདྷΔӳޠ൛ʹࠓ͔Βඋ͑Α͏
NSLocalizedString
None
None
class Customer { var firstName: String! var lastName: String! }
String.localizedStringWithFormat( "%@ %@༷", customer.lastName, customer.firstName )
None
class Customer { var firstName: String! var lastName: String! }
String.localizedStringWithFormat( "%@ %@༷", customer.lastName, customer.firstName )
NSPersonNameComponents class Customer { var name: NSPersonNameComponents! ... } let
formatter = NSPersonNameComponentsFormatter() formatter.style = .Medium formatter.stringFromPersonNameComponents(customer.name) // -> "Soichiro Horimi"
None
NSPersonNameComponents & Formatter let customer = Customer() customer.name.familyName = "Horimi"
customer.name.givenName = "Soichiro" customer.name.nameSuffix = "Mr." let formatter = NSPersonNameComponentsFormatter() formatter.style = .Long formatter.stringFromPersonNameComponents(customer.name) // -> "Soichiro Horimi Mr."
NSPersonNameComponents & Formatter • @available(iOS 9.0, *) • ಠࣗͷComponentsͱFormatterΛ༻ҙ •
কདྷతʹࠩ͠ସ͍͑ͨɾɾ
None
String.localizedStringWithFormat( NSLocalizedString("%d໊༷", comment: "͝༧ਓ"), reservation.guests.count) /* ͝༧ਓ */ "%d໊༷"
= "%d Guests";
String.localizedStringWithFormat( NSLocalizedString("%d໊༷", comment: "͝༧ਓ"), reservation.guests.count) /* ͝༧ਓ */ "%d໊༷"
= "%d Guests";
stringsdict String.localizedStringWithFormat( NSLocalizedString("%d໊༷", comment: "͝༧ਓ"), reservation.guests.count) <key>%d໊༷</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@Guests@</string>
<key>days</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>d</string> <key>one</key> <string>%d Guest</string> <key>other</key> <string>%d Guests</string> </dict> </dict> ୯ ෳ
None
NSDateIntervalFormatter • iOS >= 8.0 label.text = String.localizedStringWithFormat( "%@ -
%@", begin, end)
NSDateIntervalFormatter • iOS >= 8.0 label.text = String.localizedStringWithFormat( "%@ -
%@", begin, end) let formatter = NSDateIntervalFormatter() label.text = formatter.stringFromDate(begin, toDate: end)
NSDateIntervalFormatter stringsdict NSPersonNameComponents
FormatterΛ͍͜ͳͦ͏ • Localizable.strings͋͘·Ͱݴޠཧ • LocaleʹԠͨ͡୯ҐදهͷΓସ͑☓ • ͦͷPlaceholderɺຊʹඞཁʁ ࢀߟ: NSFormatter Class
Reference
ը૾Ϧιʔε • Background Imageʹෆ͖ • ΞΠίϯ͖UIButtonͰ͍ͨ͘ͳΔ͕… • LocaleʹΑͬͯίʔυ্Ͱذ͕ඞཁ - Asset
CatalogͷLocalize͑͞Ͱ͖Εɾɾ
ւ֎൛ϦϦʔεɺͦͷઌ • શػೳͷ༁͕ऴྃɺΊͰͨ͠ • ͳΜͯ͜ͱͳ͍ • Ή͠ΖϦϦʔεຖͷ༁࡞ۀ͕ॏՙʹ… • ։ൃεϐʔυΛམͱͣ͞ʹ༁ΛਐΊ͍ͨ
༁ࢧԉαʔϏε • Crowdin • XLIFFΛॻ͖ग़ͯ͠Ξοϓϩʔυ͢ΔͷΈ • ֎෦༁ऀͱͷڠۀ͕ḿΔ
༁ࢧԉαʔϏε • ༁ϦιʔεΛUPͯ͠ɺਐḿ͕ཧͰ͖Δ • ༁࿙ΕΛՄࢹԽͰ͖Δ • API࿈ܞ
ཧ ະ༁text ݁Ռ
ݱ࣮ • దͳϦιʔεཧͱࣗಈԽ • ͦΕͰɺݴޠ͕ଟ͍ͱେม • ଞݴޠԽΑΓແݴޠԽ - ݴ༿ແ͠ʹΘΔUI
·ͱΊ • FormatterΛ͏·͘׆༻͢Δ - Localizableʹ٧ΊࠐΈա͗ͳ͍ • ը૾Ϧιʔεߟ͑ͷ • ϦϦʔεޙ͏·ࣗ͘ಈԽ͍͚ͯ͠Δͱྑ͍ •
ͱ͍͑ແݴޠͳUI͕Πνόϯͷཧ
͋Γ͕ͱ͏͍͟͝·ͨ͠ (ΤϯδχΞืूத!)