I am translating an app into Indonesian. The storyboard uses a navigation controller and push segues for all of its view. When I go to a view from the main menu the back button is translated correctly, but when i go to a view from there (two views away from the main menu) the back button says "Back". Thanks in advance for your help.

- 314,917
- 42
- 532
- 579

- 6,931
- 7
- 35
- 51
-
Is it the default navigation controller Back button? If so, I believe Apple localizes it for you like the UIBarButtonSystemItems are. – erdekhayser Dec 03 '13 at 22:03
-
The Navigation controller is a the default that I got from dragging it, no changes were made. – 67cherries Dec 03 '13 at 22:08
-
Try changing the native language of the iOS Simulator to Indonesian to test it out. The back button should be in Indonesian – erdekhayser Dec 03 '13 at 22:11
-
I have. It continues to not work. :/ – 67cherries Dec 03 '13 at 22:13
-
1That is strange. What you could always do is replace the back button with a custom made back button, which you localize the title. I'm shocked it does not localize – erdekhayser Dec 03 '13 at 22:17
-
This site suggests a way: http://blog.ezer0.net/2012/04/add-customized-back-button-to.html – erdekhayser Dec 03 '13 at 22:19
-
@for i in range awesome I found the problem. When I localized the main storyboard, some of the navigation items had back buttons that were manually set to "Back". I changed all of them, and the app is working as expected. – 67cherries Dec 04 '13 at 15:17
-
67cherries - if you answered your own question, you should write up the answer and mark it as the correct one. – ThomasW Jan 20 '14 at 08:09
-
See this answer here: http://stackoverflow.com/a/9168068/4397 – andygeers Nov 11 '16 at 15:25
6 Answers
Please check in your "App"-Info.plist the setting "Localization native development region" and change your default language to "id" for Indonesian. As noted at other sites this affects the language on iOS default buttons like "Edit" or "Done".
Anyway, to change the title of the back button you have to consider that you have to address the PARENT-Controller, not the detail view controller.
Before you push the child view onto the navigation controller, maybe in the prepareForSegue-Method, do something like this:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@”Back” style:UIBarButtonItemStyleBordered target:nil action:nil];
[[self navigationItem] setBackBarButtonItem:backButton];
[backButton release];
}

- 11,711
- 7
- 58
- 98
If you're manually pushing to another view controller then, an example:
@IBAction func actionOpenSettings(_ sender: UIButton) {
if let settingsVC = self.storyboard?.instantiateViewController(withIdentifier: "SettingsViewControllerID") as? SettingsViewController {
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "Back".localized(), style: .plain, target: nil, action: nil)
self.navigationController?.pushViewController(settingsVC, animated: true)
}
}

- 26,840
- 19
- 119
- 186
For Swift, use the following:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "mySegueIdentifier" {
let backButton = UIBarButtonItem(title: "MYLOCALISEDSTRING", style: UIBarButtonItemStyle.plain, target: nil, action: nil)
self.navigationItem.backBarButtonItem = backButton
}
}
This will change the default back button as follows:

- 3,327
- 2
- 24
- 57
I have found that if the parent view controller's navigationItem.backBarButtonItem.title string has been set in the Storyboard file, any changes added later (in the pushed ViewController's viewWillAppear for example) will be ignored. Check to see if the parent controller in the storyboard has set text for the back button. Localizing self.navigationItem.backBarButtonItem.title in the parent controller fixed it for me.

- 2,140
- 15
- 18
Im not sure exactly what the problem is, but using the AGi18n library may help. It forces .xibs to localize according to the localizable.strings file. So if your .xib contains "back", and your localizable.strings has a rule for "Back", it will be localized.
Theres a tutorial for using the library on the bottom half of this SmoothLocalize's localization tutorial.

- 2,465
- 4
- 20
- 23