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
Localization.pdf
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Aydar
December 14, 2017
Programming
67
0
Share
Localization.pdf
Presentation for the Munich iOS Developers Meetup
Aydar
December 14, 2017
More Decks by Aydar
See All by Aydar
The Realities of A/B Testing
aydarin
0
99
Development on Kotlin/Native and Swift
aydarin
1
130
AppCode under the hood
aydarin
1
340
Bridging the gap between Kotlin and Swift
aydarin
0
140
A look into AB testing
aydarin
0
92
Exploring MVVM-C
aydarin
0
180
Coordinate your app
aydarin
1
100
MVVM vs MVP
aydarin
1
290
image_optimization.pdf
aydarin
0
70
Other Decks in Programming
See All in Programming
My daily life on Ruby
a_matsuda
3
430
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
280
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.9k
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
4
480
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
1
420
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
240
~ 秘伝のタレ化した『神スプシ』と戦う ~ 関数型パラダイムで壊れない仕組みへ
h0r15h0
1
120
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
850
tsserverとは何だったのか_これからどうなるのか
nowaki28
1
310
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
1
750
「OSSがあるなら自作するな」は AI時代も正しいか ── Build vs Adopt の新しい判断基準
kumorn5s
7
2.9k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Agile that works and the tools we love
rasmusluckow
331
21k
Thoughts on Productivity
jonyablonski
76
5.2k
Utilizing Notion as your number one productivity tool
mfonobong
4
300
The Pragmatic Product Professional
lauravandoore
37
7.3k
The Cult of Friendly URLs
andyhume
79
6.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Paper Plane
katiecoart
PRO
1
50k
エンジニアに許された特別な時間の終わり
watany
106
240k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Transcript
Improve your app localization with .stringsdict Aydar Mukhametzyanov, Freeletics
Agenda 1.The story 2.Handling plurals with .stringsdict 3.Adaptive strings
Who knows what .stringsdict is?
1.The story 2.Handling plurals with .stringsdict 3.Adaptive strings
!"#$ %&'( The story
The story !"#$ %&'( ) * +
The story Category Count ! * One 1 1 month
1 miesiąc Few 2-4, 22-24, 32-34,… 2 months 2 miesiące Many 5-19, 100,… 5 months 5 miesięcy Other 0.0-1.5, 10.0 1.5 months 1.5 miesiąca
The story if count == 1 { // one }
else { // many } !
The story if count >= 5 && count <= 19
{ // many } else if lastDigit == 1 { // one } else if lastDigit > 1 && lastDigit < 5 { // few } else { // many } )
1.The story 2.Handling plurals with .stringsdict 3.Adaptive strings
Handling plurals { login_button_title: Login, … }
Handling plurals { login_button_title: Login, … days_one: %d day, days_many:
%d days, … }
Handling plurals { login_button_title: Login, … days_one: %d day, days_many:
%d days, … } if count == 1 { // Use days_one } else { // Use days_many }
Handling plurals { login_button_title: Login, … days: { one: %d
day, many: %d days } … }
Handling plurals { login_button_title: Login, … days: { one: %d
day, many: %d days } … } String.localizedString(key: “days", count: count)
Handling plurals
Handling plurals
Handling plurals Localizable.sctringsdict Key Format Localization Plural cases
Handling plurals
Handling plurals Plural cases: zero, one, two, few, many, other
http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html
Handling plurals
How to use? Handling plurals
Handling plurals let format = NSLocalizedString("days", comment: "") let string
= String.localizedStringWithFormat(format, 12) How to use?
Handling plurals let format = NSLocalizedString("days", comment: "") let string
= String.localizedStringWithFormat(format, 12) New localization doesn’t bring code changes
Handling plurals • Localizable.stringsdict • Specific format for plural rules
• Available since iOS 7
1.The story 2.Handling plurals with .stringsdict 3.Adaptive strings
Adaptive strings
Adaptive strings Key “M width available on the screen” (WWDC
2015, Session 227, 15:06) Localization options
Adaptive strings “M width available on the screen” (WWDC 2015,
Session 227, 15:06)
How to use? Adaptive strings
Adaptive strings textLabel.text = NSLocalizedString("gdp", comment: "") How to use?
Adaptive strings textLabel.text = NSLocalizedString("gdp", comment: "") New localization doesn’t
bring code changes
Adaptive strings • Specific format for adaptive strings • Easy
to start using • Available since iOS 9
Resources • WWDC 2013 Session 219: Making Your App World-Ready
• WWDC 2015 Session 227: What’s new in Internationalization • WWDC 2017 Session 401: Localizing with Xcode 9 • Demo app: https://github.com/aydarin/localizationdemo Contacts aydar.mukh
[email protected]
aydarin
Demo