开发者

how can i make my iphone app to support multiple languages using obj c [closed]

开发者 https://www.devze.com 2023-03-16 23:23 出处:网络
开发者_开发知识库 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
开发者_开发知识库 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

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);

0

精彩评论

暂无评论...
验证码 换一张
取 消