Using the system localizations on iPhone

Posted by nevan on Stack Overflow See other posts from Stack Overflow or by nevan
Published on 2010-05-25T17:18:45Z Indexed on 2010/05/25 17:21 UTC
Read the original article Hit count: 222

I want to make a back button for a navigation controller with the title "Back" instead of the title of the previous controller. I'm using this code:

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] 
               initWithTitle:NSLocalizedString(@"Back", @"Back")
               style:UIBarButtonItemStyleBordered 
              target:nil 
              action:nil];
self.navigationItem.backBarButtonItem = backButton;

I'd like to be able to skip localizing the "Back" string in my app (since I can only localize it in a limited number of languages). If I give my navigation controller no title, the back button will be automatically localized into whatever the language the user has chosen, so the system has translations of "Back" in many languages.

Is there a way to access the localizations that are already present in the system and use them myself? These are things like "Back", "Cancel", "Done" and so on, which show up when creating one of the standard system buttons.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c