Localizing UIViews Build Programmatically
I have an iPhone application that needs to be localized to multiple languages. This application has all its U.I built programmatically. With no .xib files what would be the right approach to architect the application to accomdate multiple languages.
It would be great if anyone can suggest开发者_如何学Go best practices or the right way to do it.
Thanks in advance.
I suggest you to change all the literals that you use in your UI (titles,labels...) to NSLocalizedString. What I do is keep all the literals I use as constants that I declare as NSLocalizedStrings this way:
#define kErrorAlertTitle NSLocalizedString(@"Error", @"Error alert title")
All my constants are kept in one or maybe a few files. Then from this file or files, I generate different versions using genstrings depending on the language.
精彩评论