简体   繁体   English

无法从appcelerator中的strings.xml获取字符串

[英]can't get string from strings.xml in appcelerator

I'm working on Titanium 2.1 and developing a iOS app and I can't get any of my strings in my strings.xml file. 我正在使用Titanium 2.1并正在开发iOS应用程序,但是在strings.xml文件中找不到任何字符串。 Here's my strings.xml file link 这是我的strings.xml文件链接

In my code I have the following: 在我的代码中,我有以下内容:

var action = 'created_a_group'; //string at line 24 in strings.xml

var actionLabel= Titanium.UI.createLabel({

    text:Ti.Locale.getString(action), 
    color:"#666666",
    font:{fontSize:12}, 
    left:8

});

but when my label is shown, the correct string isn't shown, instead created_a_group appears. 但是显示我的标签时,没有显示正确的字符串,而是显示created_a_group What am I doing wrong? 我究竟做错了什么?

Do you have the file in the correct folder? 您的文件是否在正确的文件夹中?

It should be in the i18n folder outside of the Resources folder. 它应该位于Resources文件夹之外的i18n文件夹中。 It should also be in the appropriate language folder. 它也应该在适当的语言文件夹中。 Though I haven't tried this, are you use that your device is in the correct language setting to pick the appropriate sting.xml file? 尽管我还没有尝试过,但是您是否使用了正确的语言设置来选择适当的sting.xml文件? For example, if you have the string.xml file in the /i18n/en folder, but have it set to a different language on the device, perhaps it can't locate it for that language. 例如,如果您在/ i18n / en文件夹中有string.xml文件,但是在设备上将其设置为另一种语言,则可能找不到该语言的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM