how can i make my iphone app to support multiple languages using obj c [closed]
i have a iphone app , now i need to make my app in such a way that it should support multiple languages,,,i.e button captions , & data which is in the table view rows should get converted to the selected languages, how can i do that,, can anyone help me out
thanx in advance
I guess you used some resources to learn Objective-C and iPhone programming. Try continue using them!
http://developer.apple.com/internationalization/
This may not be the best method, but it is the method I am using for my game.
Make a global variable language
which is an int
and you can use enum
to make it coding friendly:
enum languages{
English = 1, Spanish = 2, Chinese = 3
};
Then make a function for every place you have text, so when you want certain text, just call the function for that object you need text for. This is easy because you can just customise the function as you like. Eg.
-(NSString) introText {
switch(language) {
English:return @"blahblahblah";
Spanish:return @"blahblah";
Chinese:return @"blah";
}
}
I prefer this method because I tend not to use nib files, and like to generate them through code. The downside to this method is that you probably would like to put this code in a separate class file, and is harder to spot if you missed anything. (think of this as sorting by text fields, while making separate nibs as sorting by language);
精彩评论