简体   繁体   中英

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. Here's my strings.xml file link

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. 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. 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? 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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