Making one application in different languages
How can you make one application for multiple languages?
I've heard that Apple rejects applications that only contain different languages. So how can you change your images, text and icons for a specific country or language?
I submitted three applications to App Store. However, their differences was only within the language (or language/text within images). That's the reason why two of them got rejected. 开发者_开发技巧Now I'd like to make one application for all the countries/languages that I'd like to support.
Localization to different languages is fully supported and plainly accepted by Apple.
Look here: Internationalization and Localization, and specifically at this sample: International Mountains.
You cannot have two apps published if their only difference is the language. This is against a provision in the App Store rules about making applications that are functionally the same.
The solution is what I pointed you to: you can easily include multiple language support in one same app binary. So, go for it...
Cocoa has built-in support for localisation - there's an entire section of the developer site dedicated to this very topic.
However, a good first start would be to have a read of the Internationalization Programming Topics document, as this will walk you through the process of adding additional string resources, etc. to your app.
Apple supports 33 languages. Here is the list of languages:
en,
fr,
it,
de,
ja,
nl,
es,
pt,
pt-PT,
da,
fi,
nb,
sv,
ko,
zh-Hans,
zh-Hant,
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
en-GB,
ca,
hu,
vi
You can find your local language using this code:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];
Now you can put the if
condition according to your wish, like this:
if ([currentLanguage isEqualToString:@"it"])
imgView.image = [UIImage imageNamed:@"italy.jpg"];
if ([currentLanguage isEqualToString:@"en"])
imgView.image = [UIImage imageNamed:@"america.jpg"];
if ([currentLanguage isEqualToString:@"fr"])
imgView.image = [UIImage imageNamed:@"france.jpg"];
//Where imgView is an UIImageView declared globaly in viewcontroller.h part.
精彩评论