Hey,
i wanna build my own "L" function for translating things in my application.
I've created a folder inside my assets and reading the XML in my application - that works.
My problem: I don't know how i can "loop" through the xml file, to find my specific String...
XML looks like this:
<?xml version="1.0" encoding="UTF-8"?> <string id="test">Hello World</string>
My Function (so far) looks like this:
Alloy.Globals.L = function (text) { var langFile = Ti.App.Properties.getString('language'); console.log("Selected Language: " + langFile); var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'i18n/'+langFile+'/strings.xml'); console.log(file.nativePath); console.log("File existiert: " + file.exists() ); var xmltext = file.read(); xmltext = xmltext.text; var xmldata = Titanium.XML.parseString(xmltext); console.log( xmldata.getElementById("test").text ); };Thought that will work - any idea what is wrong? (of course is in the last 2 lines, but i don't know how to get the value, that i want)
Thanks - nico