tags:

views:

69

answers:

3

Hi everyone, I am junior in iPhone game development. I am using Cocos2D for this game I am currently building. I have completed the game however my client wants to have 1 more version of this game, all the functionality is the same except the language. He wants the game will be switched to the French version if the iPhone language is set to French. I just need to replace the buttons, the text inside the game with French. But I am not quite sure about the language setting in iPhone, how can I switch the whole thing into a different version accordingly to the language setting, anyone knows where i can start? Please give me a hand, I really appreciate any helps.

Thanks a lot

+1  A: 

You have to localize your app with Localizable.strings file where you put all your string properties for each language. For more see: http://developer.apple.com/iPhone/library/documentation/MacOSX/Conceptual/BPInternational/Articles/LocalizingInterfaces.html

AlexVogel
Thanks a lot for your reply, but can i globalize Images too? because the buttons in the game also carry text, so the whole thing is images. So i have new images with different language text in there, then what would you suggest?
Rocker
In one app i had the same problem. First solution is to localize the images to. It the same way as the strings. Second solution is to set the name of the image as an localized string property: [UIImage imageNamed:NSLocalizedString(@"image.property", nil)];
AlexVogel
Don't do what AlexVogel proposed. You don't have to translate the name of the image. Instead, provide different copies of the image in the English.lproj and the French.lproj folders.
Johan Kool
I did the way u told me to. It switches the images and text, but just a few, sometimes it switches entirely but when I tap on the button it appears the other language image buttons. This is so strange. Do u know why? could you share your experience please?
Rocker
+1  A: 

Check out this link Localization

Jacob Relkin
Thanks a lot for your help, but I would like to see examples. Do you have small examples to let me see? thanks alot
Rocker
A: 

Here is my code. Could you should me how to localize to these codes

[MenuItemFont setFontSize:16];
    [MenuItemFont setFontName:@"Helvetica"];

    MenuItem *backToMenu = [MenuItemImage itemFromNormalImage:@"back_to_mainmenu.png" selectedImage:@"back_to_mainmenu_PUSH.png" target: self selector:@selector(backToMenuScene:)];

    MenuItem *playAgain = [MenuItemImage itemFromNormalImage:@"Eplay_again.png" selectedImage:@"Eplay_again_PUSH.png" target:self selector:@selector(playAgainGame:)];

    MenuItem *uploadOnFaceBook = [MenuItemImage itemFromNormalImage:@"Eupload_on_facebook.png" selectedImage:@"Eupload_on_facebook_PUSH.png" target:self  selector:@selector(uploadOnFaceBookFunction:)];

    Menu *menu = [Menu menuWithItems:backToMenu, playAgain, uploadOnFaceBook,nil];
    menu.position = CGPointZero;

    backToMenu.position = ccp (400,40);
    playAgain.position = ccp (240,40);
    uploadOnFaceBook.position = ccp (80,40);

    [self addChild:menu z:1];
Rocker