UiTextView localized with xib strings file

This still appears under Xcode 6 & IOS 8, and the previous answers don't satisfy me.

Here's my simple and quick workaround :

  1. Select the XIB and then in the file inspector
  2. Below "Localization", find the language that does not work
  3. Change "Localizable Strings" to "Interface Builder Cocoa Touch XIB"

XCODE XIB inspector file screenshot

  1. Run the app, the translation should be ok now !

You can then go back to "Localizable Strings" if you prefer... In this case please note that you must run at least once the app with the "Interface Builder Cocoa Touch XIB." option selected.


I've found the following workaround until Apple fixes this (serious) bug that still exists in iOS 7 :

You actually need to 'mix' the 'base localisation method' (= preferred method for Xcode 5 & iOS 7) with the 'older' method of using the 'Localizable.strings' file

1) create the file 'Localizable.strings' (File -> New -> iOS -> resource -> .strings file)

2) use Xcode to create localised versions of this file for each language you use (select the file 'Localizable.strings', in File Inspector under 'Localization' click on the selection button next to each language you use).

3) in your viewController create an IBOutlet @property for the UITextField :

@property (weak, nonatomic) IBOutlet UITextView *localizedTextView;

4) under 'viewDidLoad' add the following code :

self.localizedTextView.text = NSLocalizedString(@"textFieldKey", @"comment for the translator");

5) in each 'Localizable.strings' file add :

"textFieldKey" = "the translated text you want to be put in the textField";

That should do it !

Keep in mind that Apple will probably fix this bug somewhere in the near future, in that case the translation will be taken from the 'base localised storyboard' (the one with the object references in, like "a8N-K9-eJb.text" = "some translated text". In that case you can delete the 'Localization.strings' file, and use base localisation again for a UITextField