NSLocalization on xCode 4.5 and iOS 6

Is it possible to use Localizable.strings with NSLocalizedString (@ "KEY", @ "") in xCode 4.5 for iOS6, as in older iOS5?

Here is my sample code:

In Localizable.strings
"KEY" = "Hello World!";

In .m script
NSString * tempString = NSLocalizedString (@ "KEY", NULL);
NSLog (@ "My line:% @", tempString);

Magazine for iOS5.1: "My line: Hello World!"
IOS6 Magazine: "My String is: KEY"

... I really will lose my mind! Where is my mistake? Thanks a lot!

+4
source share
6 answers

They do not need to create a new project and copy, just delete localized files, create it again, and everything will be fine.

+4
source

The localized strings in my current application still work in iO6. I usually use NSLocalizedString (@ "KEY", NULL); Are you sure you are working correctly in 5.1?

+1
source

See the response to the message: IOS localization string stops working when adding additional localization

This works for me. Clear assembly + remove from the simulator (or phone) to fix the error.

+1
source

The only solution I found is:

  • reboot with a new project from the xCode template
  • enable localization for at least 2 languages
  • drag and drop all old files from the damaged project
  • copy the struggle of old storyboards to new
  • take frequent pictures only when necessary

I really don't know where the problem was, but now everything works again, as usual.

0
source

Change the language settings of the simulator.

0
source

At the end of the line in one of my string files, I did not have a semicolon. The compiler did not report this, even when I cleared the project when I created it. First, after restarting Xcode, an error was reported, and I could find and fix it.

0
source

Source: https://habr.com/ru/post/1436450/


All Articles