Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Localization.pdf

Aydar
December 14, 2017

 Localization.pdf

Presentation for the Munich iOS Developers Meetup

Aydar

December 14, 2017
Tweet

More Decks by Aydar

Other Decks in Programming

Transcript

  1. 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
  2. The story if count >= 5 && count <= 19

    { // many } else if lastDigit == 1 { // one } else if lastDigit > 1 && lastDigit < 5 { // few } else { // many } )
  3. Handling plurals { login_button_title: Login, … days_one: %d day, days_many:

    %d days, … } if count == 1 { // Use days_one } else { // Use days_many }
  4. Handling plurals { login_button_title: Login, … days: { one: %d

    day, many: %d days } … } String.localizedString(key: “days", count: count)
  5. Handling plurals Plural cases: zero, one, two, few, many, other

    http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html
  6. Handling plurals let format = NSLocalizedString("days", comment: "") let string

    = String.localizedStringWithFormat(format, 12) How to use?
  7. Handling plurals let format = NSLocalizedString("days", comment: "") let string

    = String.localizedStringWithFormat(format, 12) New localization doesn’t bring code changes
  8. Adaptive strings Key “M width available on the screen” (WWDC

    2015, Session 227, 15:06) Localization options
  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