I recall hearing that with the introduction of iOS 4.0, you no longer need to use the NSLocalizedString macro in order to localize strings within an application into different languages. However, I have been unable to find any information or documentation about the new method that can be used for localization. Am I dreaming, or have I missed something obvious? If there is a new method for localization, I would much appreciate it if someone could point me in the direction of some resources on the topic. Thanks in advance!
Looking through the documentation, I can't find any mention of a new method of localization.
Related
I have this game, that contains a lot of text as speech. I would like to give the users the option of changing the language of the game to their preferred tongue.. Can anyone point me to a resource or give me a starting point to achieve this? String look-up table perhaps?
Thanks,
Jack
See Localizing String Resources in Internationalization Programming Topics. iOS has a built-in system for this using NSLocalizedString() and related functions.
See also String Resources in the Resource Programming Guide.
NSLocalizedString is of use here. Here is a simple tutorial on localization.
I need help from you, I need to display all the text, labels , strings and what ever text is showing to user in the iphone application with respective selected language in settings of iphone.
for example user selects German or French in settings of iPhone language, then my application should provide or view the details in that language.
I need sample code for localization, Is there any simple way to follow the standard steps to translate the code to different languages in iphone sdk.
please healp me, I hope that I can get efficient solution on this from you.
Thank you,
Madan Mohan.
See here: http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/
I think the previous link gives a pretty good idea of how to do I18N on the iPhone, but if you feel you need more info, you can try this article http://blog.federicomestrone.com/2010/05/18/internationalise-your-iphone-apps-with-xcode/ which is just slightly more code-orientated.
The point though is always the same - you have to separate code from text resources and load all your text (strings) with the NSLocalizedString macro, or a variant thereof.
I am wising up and getting my internationalization act together. Right off the bat I am a bit swamped by all the docs Apple provides so I was wondering of someone could sketch a workflow for my situation.
Before I begin, I browsed some Apple example code and noticed this NIB file - MainWindow.xib - in the Resources folder:
alt text http://daturner.com/stackoverflow/nib.jpg
This clearly has something to do with internationalization/localization. Could someone please explain how this is created and where in the workflow it happens?
My app is fundamentally an imaging app with a few labels that I currently programmatically internationalize using NSLocalizedString(...). If I set all my labels programmatically and wrap all my strings with NSLocalizedString(...) can I completely ignore the NIB issues?
Thanks in advance,
Doug
To answer your last part of the question: Yes!
In my experience, it can be a pain to localize Nib's so if at all possible try to limit the localization effort to .strings files.
The problem? I look up stuff in the xcode documentation and find very useful lists of objects, methods, etc... But then I still have to go somewhere else to find useful example code of how to use that object. For example, I looked up NSNumber yesterday and found all of the neat stuff it can do, but I still had no clue how to use it. That's just an example. I'm sure I could read the objective c pdf front to back and learn something there (which I plan on doing) but what about later? When I'm looking up some UIKit object? Do I have to go find a tutorial each time (or lately, I just ask StackOverflow and you guys take care of me).
Is there a part of the apple website / xcode documentation that shows the example code I'm looking for?
Is there a wiki site out there or something that has what I'm looking for? (I just tried a simple google search "iphone sdk wiki". this site could be good. iphone sdk wiki . I'll check it out. Anyone else have one they like? )
This is also sort of a mild complaint to Apple. Why not a section on each code definition page that shows usage?
I've found the sample code section on Apple's iPhone Developer Connection be extremely useful not only for samples of complete applications but also a best practices source. Going through the code of The Elements, for example, will expose you to how to use particular classes as well as how to structure your code. It is a wonderful example of how to create a non-trivial iPhone app.
Look in developer.apple.com/iphone they have pretty good documentation (you can use the search bar there) on all the classes and have a lot of good sample code..
I really would emphasize the "Related sample code" section on many, if not most, of the documented classes.
But, IMHO, there isn't any easy way of acquiring the knowledge to develop in Cocoa/Cocoa Touch. The API's are so numerous that it simply takes a lot of time and experience. You just have to work on it, look at a lot of books and study the sample source code where available.
I've tried to take a purposeful approach by carving out some time every week to learning a new API/class irrespective of whether my current project needs it or not.
Alternatively, search Joe Hewitt. He's the developer for iPhone facebook. He has a project you can download that demonstrates all the features of facebook. It's an awesome open source project!
When you look something up in Xcode Developer Documentation, you sometimes get a Related Sample Code: text that tells you what Sample the method or property is used in. Too bad you can't click on it to see the code, but if you do click it takes you to the page to download the sample. – mahboudz 0 secs ago
Apple Developer site has all kinds of code examples. Try searching google for a UICatalog project, it will show you all the basic UI stuff you can do, like adding buttons and progressbars through using only code.
Is there a good reference somewhere with all the C functions that can be used by default in iPhone development (I guess they lie in the Foundation framework)? I mean functions like:
arc4random(), cos(), sinf(), hypot(), sqrt(), sqrtf() etc...
They are so many considering their variations too (sin(), sinf()) and googling every single time is ineffective.
Thanks :)
XCode/Help/Documentation
Then look in the Core Library. You may need to subscribe to one or more documentation sets first. Check that you search is not limited to Objective-C also.
If you're looking for all of the math functions, they can be found in the header file
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/math.h
For more generic functions, in addition to the documentation, I often find it helpful to right-(or Control-)click on a function in my code and choose "Jump to Definition". This takes you to the related header, which might also have similar functions and constants.
The Apple iPhone OS Man Pages doc is the handiest guide for this kind of thing.
http://developer.apple.com/iphone/library/documentation/System/Conceptual/ManPages_iPhoneOS/
Unfortunately being HeaderDoc driven, there's no PDF version. I thought at one point Apple indexed these symbols in the Xcode docset API indexes, but they don't seem to be there now.
Good luck!