开发者

My localized strings are not detected

I'm trying to localize my strings in Xcode 4, but the only thing I get are the keys, not the values.

I've localized the strings using NSLocalizedString(key, comment). I've generated the file Localizable.strings using genstrings from the command line. I've dragged and dropped Localizable.strings from Finder to Xcode (into the Resources folder). I've localized Localizable.strings and added the appropriate countries. I've made sure the encoding is UTF-16. I've translated the different Localizable.strings for each country. I've rechecked that the encoding is still UTF-16. I've checked that each statement in Localizable.strings ends with a semi colon.

Still not working.

Any idea of what I've missed?

edit

Here a part of my Localizable.strings

/* Text displayed on the comment button if there are more than one comment. */
"CommentButtonTextPlural" = "comments";

/* Text displayed on the comment button if there is exacly one comment. */
"CommentButtonTextSingular" = "comment";

/* Text displayed on the post button. */
"CommentViewPostButtonLabel" = "Post";

/* Default text 开发者_运维百科displayed in the area where the user types in a comment. */
"CommentViewWriteAComment" = "Write a comment...";

/* Error message explaining that a document isn't viewable on the user's device. */
"DocumentRendererStatusDetailedErrorText" = "This document is not viewable on this device.";

/* Message explaining that the document is downloading. */
"DocumentRendererStatusDownloadingText" = "Downloading...";


You may be putting the Localizable.strings file in the wrong location so it's using the default translations.

When you add a new language, Xcode creates a new folder in your App Directory which ends in .lproj (so for English it would be en.lproj) and that is where your Localizable.strings file for English should be.

If you want a French one, add the French Language and Xcode will generate a fr.lproj directory and that is where the French Localizable.strings file will be located.

From your description, putting it in the Resources Folder is incorrect.


Your Localization should look like the following:

My localized strings are not detected

and on your desktop:

My localized strings are not detected


I managed to get it working.

What I did was remove the Localizable.strings (from the harddrive, I haven't touched the files located in the xx.lproj folders) file which genstrings created for me and removed the app-file on my device.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜