Created
November 8, 2012 19:05
-
-
Save sleroux/4040812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data2xml = require("data2xml"), | |
key = 'splashScreen', | |
xmlObject = {}, | |
imgPath = "dummyImage.png"; | |
xmlObject[key] = {}, | |
xmlObject[key]['image'] = []; | |
// Push 2 different images for each localization | |
xmlObject[key]["image"].push({ | |
text: { | |
_attr: { | |
"xml:lang": 'en' | |
}, | |
_value: "locales/en/" + imgPath | |
} | |
}); | |
xmlObject[key]["image"].push({ | |
text: { | |
_attr: { | |
"xml:lang": 'fr' | |
}, | |
_value: "locales/fr/" + imgPath | |
} | |
}); | |
// Default locale splash | |
xmlObject[key]["image"].push({ | |
_value: imgPath | |
}); | |
console.log(data2xml('qnx', xmlObject)); |
var obj = {
name: {
text: {
_attr: {
"xml:lang": "de-DE"
},
_value: "The german description for HelloWorldDisplayManaged application"
},
_value: "The HelloWorldDisplayManaged application"
}
}
I used the above object to generate;
The HelloWorldDisplayManaged applicationThe german description for HelloWorldDisplayManaged application
var obj = { name: { text: { _attr: { "xml:lang": "de-DE" }, _value: "The german description for HelloWorldDisplayManaged application" }, _value: "The HelloWorldDisplayManaged application" } }
I used the above object to generate;
The HelloWorldDisplayManaged applicationThe german description for HelloWorldDisplayManaged application
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For James' information, the code below doesn't work, changing _value to be in front of text doesn't help either: