Localization issue Xcode

不问归期 提交于 2020-01-04 06:28:20

问题


What am I doing wrong???

NSString * ew= NSLocalizedString (@"CITY",nil); //Add items [listOfItems addObject:ew ]; and I have my localized.string in which I have "CITY" = "Prague";

.....doesn't work neither in iPhone simulator or device. if I dislay it, it display CITY instead of Prague.

Thanks

EDIT:

Language is set properly and in Localizable.strings I have two strings to localize. and they are so:

"TITLE" = "Availiable cities"; "CITY" = "Pragues";

and in the

other localizations I have

"TITLE" = "Translation"; "CITY" = "Translation";


回答1:


The string file should be named Localizable.strings. Also, is that the only string you have in the file? If you have a formatting error in the Localizable.strings file, you won't get the value for your key.




回答2:


As localized string is device's language dependent, make sure your language has been changed on device/simulator before testing this. If your language is set to English, you will never see "Prague" as the string will always be mapped to the English version of the localized string.

good luck.



来源:https://stackoverflow.com/questions/9322701/localization-issue-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!