I have developed a game in English lanuguage. How to translate it to Other languages. Is it to possible to include translator in cocos2d
Language Translator
(5 posts) (2 voices)-
Posted 1 year ago #
-
You can go to this page in the wiki to get some translations of common words used in games : http://www.cocos2d-iphone.org/wiki/doku.php/resources:translations
As for code, there are two things to consider: strings and resources. For strings, wherever you display some code-generated text, you should wrap the string in a
NSLocalizedStringcall. And then generate a "Localizable.strings" file with thegenstringscommand-line tool. For resources (usually nib files and images that contain text), you need to 'Get info' on them in Xcode and click the 'Make File Localizable' button.Posted 1 year ago # -
can u give an example for this
Posted 1 year ago # -
Well, instead of doing
[myLabel setString:@"Welcome"];
you do[myLabel setString:NSLocalizedString(@"Welcome", @"A comment about the welcome message")];When you've done it for all the strings in your project, you can use the
genstringscommand to generate aLocalizable.stringsfile (see the second link below). This file will contain the translations. For the example above, there will be the two following lines:
/* A comment about the welcome message */ "Welcome" = "Welcome";This file will be placed in a
en.lprojdirectory for English. You should generate one in afr.lprojdirectory for French,es.lprojfor Spanish, etc. In the French version of theLocalizable.stringsfile (the one that's in thefr.lprojfolder), you would have these two lines:
/* A comment about the welcome message */ "Welcome" = "Bienvenue";Don't hesitate to look at the documentation to learn more about this (very useful).
About localizing your app:
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BuildTimeConfiguration/BuildTimeConfiguration.html#//apple_ref/doc/uid/TP40007072-CH7-SW3About .strings files and how to generate them:
http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.htmlPosted 1 year ago # -
I have written for english and save as "Localizable.strings".. when i try to add "Localizable.strings" for fr.lproj, am getting the error saying that we cant add the "Localizable.strings" which is already added in the resources. While trying to add a new file for french language. A subfolder is opening in name "fr". Can anyone guide me how to give all the language for my application.
Posted 1 year ago #
Reply
You must log in to post.