Patrick
Patrick

Reputation: 23

Localizable.strings just working sometimes

I've got an iPhone app that needs to be translated in different languages. At this moment there are 2 languages supported: German & English. The problem is that the localization only works every other time and most of the time i just get the attributes from NSLocalizedString.

If I change the Encoding of the Localizable.string files to UTF-8 and back to UTF-16 it does work but only one time and after that it changes right back to not working.

Currently working under Xcode 4.0.1

Anyone else experienced this bug or is there a fix?

Thanks in Advance :)

Upvotes: 2

Views: 2078

Answers (3)

aGit
aGit

Reputation: 138

Had the same problem.

And i was also using ShareKit. I just removed those Localized strings (ShareKit) and no more troubles :)

I feel this problem is not about ShareKit, but it is about having other localizedStrings in your project. Check if you do, remove them (copy + paste into your localized strings). This should solve your issue.

Upvotes: 8

Stephen Eilert
Stephen Eilert

Reputation: 1537

Figured out for my app.

I was using ShareKit. Sharekit comes with a Localizable.strings of its own. At runtime, there might be a conflict about which one should be used.

If your app has more than one strings file being copied, remove the others.

http://iphoneincubator.com/blog/open-source/sharekit

Upvotes: 2

McCygnus
McCygnus

Reputation: 4215

Make sure each line in the translated file ends with a ;. They're easy to miss and if you do miss one, none of the strings after it will be used. You'll get the NSLocalizedString attribute like you described instead.

This doesn't really make sense with it working once after toggling the encoding though. That seems a bit odd. But this is the first thing to check when localized strings are not working.

Upvotes: 1

Related Questions