localizing ios apps
Post on 11-Sep-2014
1.191 views
DESCRIPTION
Presentation for Tokyo iOS Developers meetup about localization. Topics include: Localizing text with NSLocalizedString() and genstrings, localizing images, localizing storyboards and nibs with ibtool.TRANSCRIPT
Why localize?
Friday, November 9, 12
You make more money.
Friday, November 9, 12
Fixed cost of translationvs.
Unlimited potential upside
Friday, November 9, 12
Time investment:Minimal.
Friday, November 9, 12
How to prepare your app for localization:
NSLocalizedString(key, comment)
Friday, November 9, 12
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
Comments can give your translators
context.
Friday, November 9, 12
Everything’s in NSLocalizedString().
Now what?The genstrings command-line tool.
Friday, November 9, 12
What’s genstrings?genstrings searches your code for macros related to
localization, including NSLocalizedString().
Friday, November 9, 12
genstrings en.lprojgenstrings -o target-directory source-filesgenstrings -o target-directory other-source-files -a
Friday, November 9, 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
/* 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
/* 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
Friday, November 9, 12
How does NSLocalizedString() work?
It’s dictionaries all the way down.
Friday, November 9, 12
NSLocalizedStringFromTable(key, table, comment)
Looks up your string in table.strings
Friday, November 9, 12
Adding localizations to your project
Let’s localizing!
Friday, November 9, 12
Friday, November 9, 12
I’ve got images with English text in them.
Friday, November 9, 12
en.lproj/aybabtu.png
Friday, November 9, 12
en.lproj/aybabtu.png
ja.lproj/aybabtu.png
Friday, November 9, 12
en.lproj/aybabtu.png
ja.lproj/aybabtu.png
es.lproj/aybabtu.png
Friday, November 9, 12
Friday, November 9, 12
I like Interface Builder. I don’t want to set my UI
text in code.
Friday, November 9, 12
ibtoolibtool --generate-strings-file MainStoryboard.strings
MainStoryboard.storyboard
ibtool --generate-strings-file NibName.strings NibName.xib
Friday, November 9, 12
/* 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
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.xib
Friday, November 9, 12
Friday, November 9, 12
Friday, November 9, 12
Friday, November 9, 12
Money, revisited.
Friday, November 9, 12
• 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
Which you need to leverage with sales and marketing.
Localization gives you a competitive advantage.
Friday, November 9, 12
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
WZLocalize
github.com/weissazool/WZLocalize
Friday, November 9, 12