I just cannot get this to work. No matter what I do, the call to NSLocalizedString always returns the key I pass into it.

I've read every answer to every question on here and none of them have any effect. I've cleaned, rebuilt, reinstalled.

I have a file called Localizable.strings that I created in Xcode, using the new file wizard and selected "Strings file" as the template. I added two key/value pairs. I clicked the "Localize" button in the inspector and added English. Heck I even tried adding a new Copy build phase to the project like one answer suggested. I've opened the package and verified that there is an en.lproj folder with my correct Localizable.strings file in it.

But when I call NSLocalizedString and pass it one of my keys (which I've copy-pasted to make sure it's exactly identical), it just returns the key no matter what I do. I've even tried calling NSLocalizedStringFromTable and passing it "Localizable.strings" as the table name, but nothing.

I'm losing my mind. Why is this so hard?

enter image description here

有帮助吗?

解决方案

I see : in your strings file, it should be = .
For instance

/* No comment provided by engineer. */
"Username"="nom d'utilisateur";
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top