Localizing iOS Apps

1,127 views

Published on

Presentation for Tokyo iOS Developers meetup about localization. Topics include: Localizing text with NSLocalizedString() and genstrings, localizing images, localizing storyboards and nibs with ibtool.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,127
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
13
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Localizing iOS Apps

  1. 1. Localizing iOS Apps Anthony Weiss weissazool.com anthony@weissazool.comFriday, November 9, 12
  2. 2. Why localize?Friday, November 9, 12
  3. 3. You make more money.Friday, November 9, 12
  4. 4. Fixed cost of translation vs. Unlimited potential upsideFriday, November 9, 12
  5. 5. Time investment: Minimal.Friday, November 9, 12
  6. 6. How to prepare your app for localization: NSLocalizedString(key, comment)Friday, November 9, 12
  7. 7. labelExample.text = ! NSLocalizedString(@"NSLocalizedString() example", ! ! ! ! ! ! ! ! ! @"Translate example only"); if (papayas == 0) { papayaPlurality = NSLocalizedString(@"NoPapayas", ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! @"No papayas."); additionalComment = NSLocalizedString(@"How sad.", ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! @"Regretfulness"); } return [NSString stringWithFormat: ! ! ! ! NSLocalizedString(@"You have %d %@. %@", ! ! ! ! ! ! ! ! ! ! ! ! @"Papaya possession"), ! ! ! ! papayas, papayaPlurality, additionalComment];Friday, November 9, 12
  8. 8. Comments can give your translators context.Friday, November 9, 12
  9. 9. Everything’s in NSLocalizedString(). Now what? The genstrings command-line tool.Friday, November 9, 12
  10. 10. What’s genstrings? genstrings searches your code for macros related to localization, including NSLocalizedString().Friday, November 9, 12
  11. 11. genstrings en.lproj genstrings -o target-directory source-files genstrings -o target-directory other-source-files -aFriday, November 9, 12
  12. 12. /* Translate example only */ "NSLocalizedString() example" = ! ! ! ! ! ! ! ! ! ! "NSLocalizedString() example"; /* No papayas. */ "NoPapayas" = "papayas"; /* Regretfulness */ "How sad." = "How sad."; /* Papaya possession */ "You have %d %@. %@" = "You have %1$d %2$@. %3$@";Friday, November 9, 12
  13. 13. /* Translate example only */ "NSLocalizedString() example" = "Ejemplo de ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! NSLocalizedString()"; /* No papayas. */ "NoPapayas" = "papayas"; /* Regretfulness */ "How sad." = "Que lástima. "; /* Papaya possession */ "You have %d %@. %@" = "%3$@Usted tiene %1$d %2$@.";Friday, November 9, 12
  14. 14. /* Papaya possession */ "You have %d %@. %@" = "You have %1$d %2$@. %3$@"; /* Papaya possession */ "You have %d %@. %@" = "%3$@Usted tiene %1$d %2$@.";Friday, November 9, 12
  15. 15. Friday, November 9, 12
  16. 16. How does NSLocalizedString() work? It’s dictionaries all the way down.Friday, November 9, 12
  17. 17. NSLocalizedStringFrom Table(key, table, comment) Looks up your string in table.stringsFriday, November 9, 12
  18. 18. Adding localizations to your project Let’s localizing!Friday, November 9, 12
  19. 19. Friday, November 9, 12
  20. 20. I’ve got images with English text in them.Friday, November 9, 12
  21. 21. en.lproj/aybabtu.pngFriday, November 9, 12
  22. 22. en.lproj/aybabtu.png ja.lproj/aybabtu.pngFriday, November 9, 12
  23. 23. en.lproj/aybabtu.png ja.lproj/aybabtu.png es.lproj/aybabtu.pngFriday, November 9, 12
  24. 24. Friday, November 9, 12
  25. 25. I like Interface Builder. I don’t want to set my UI text in code.Friday, November 9, 12
  26. 26. ibtool ibtool --generate-strings-file MainStoryboard.strings MainStoryboard.storyboard ibtool --generate-strings-file NibName.strings NibName.xibFriday, November 9, 12
  27. 27. /* Class = "IBUILabel"; text = "This text has been laid out in the nib."; ObjectID = "3ZM-yV-HpI"; */ "3ZM-yV-HpI.text" = "This text has been laid out ! ! ! ! ! ! ! ! ! ! ! in the nib."; /* Class = "IBUILabel"; text = "Just the way I like it!"; ObjectID = "Oxg-9T-bKW"; */ "Oxg-9T-bKW.text" = "Just the way I like it!";Friday, November 9, 12
  28. 28. ibtool --strings-file es.lproj/MainStoryboard.strings --write es.lproj/MainStoryboard.storyboard en.lproj/MainStoryboard.storyboard ibtool --strings-file target-language/NibName.strings --write target-language/NibName.xib base-language/NibName.xibFriday, November 9, 12
  29. 29. Friday, November 9, 12
  30. 30. Friday, November 9, 12
  31. 31. Friday, November 9, 12
  32. 32. Money, revisited.Friday, November 9, 12
  33. 33. • Cost of translation: ¥8,000 • Revenue per sale: ¥60 • Sell 8000/60 = 135 extra apps in that language to break even.Friday, November 9, 12
  34. 34. Localization gives you a competitive advantage. Which you need to leverage with sales and marketing.Friday, November 9, 12
  35. 35. Additional Resources • https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ LoadingResources/Strings/Strings.html • https://developer.apple.com/library/ios/#documentation/MacOSX/ Conceptual/BPInternational/Articles/LocalizingInterfaces.html • http://gengo.com/contact-support/quality-policy/ • http://kb.applingua.com/2011/10/3rd-party-localization-string-extraction- tools/Friday, November 9, 12
  36. 36. WZLocalize github.com/weissazool/WZLocalizeFriday, November 9, 12

×