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
Aydar
December 14, 2017
Programming
0
41
Localization.pdf
Presentation for the Munich iOS Developers Meetup
Aydar
December 14, 2017
Tweet
Share
More Decks by Aydar
See All by Aydar
The Realities of A/B Testing
aydarin
0
70
Development on Kotlin/Native and Swift
aydarin
1
94
AppCode under the hood
aydarin
1
250
Bridging the gap between Kotlin and Swift
aydarin
0
110
A look into AB testing
aydarin
0
72
Exploring MVVM-C
aydarin
0
150
Coordinate your app
aydarin
1
81
MVVM vs MVP
aydarin
1
260
image_optimization.pdf
aydarin
0
65
Other Decks in Programming
See All in Programming
A comprehensive view of refactoring
marabesi
0
480
赤裸々に公開。 TSKaigiのオフシーズン
takezoux2
0
130
Elixir で IoT 開発、 Nerves なら簡単にできる!?
pojiro
1
140
2度もゼロから書き直して、やっとブラウザでぬるぬる動くAIに辿り着いた話
tomoino
0
160
GoのWebAssembly活用パターン紹介
syumai
3
10k
機械学習って何? 5分で解説頑張ってみる
kuroneko2828
0
210
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
210
try-catchを使わないエラーハンドリング!? PHPでResult型の考え方を取り入れてみよう
kajitack
3
510
Cloudflare Realtime と Workers でつくるサーバーレス WebRTC
nekoya3
0
410
Development of an App for Intuitive AI Learning - Blockly Summit 2025
teba_eleven
0
110
Webからモバイルへ Vue.js × Capacitor 活用事例
naokihaba
0
670
從零到一:搭建你的第一個 Observability 平台
blueswen
1
920
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.5k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Agile that works and the tools we love
rasmusluckow
329
21k
Designing Experiences People Love
moore
142
24k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.3k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
480
The Pragmatic Product Professional
lauravandoore
35
6.7k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
KATA
mclloyd
29
14k
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