Skip to content

Instantly share code, notes, and snippets.

@sleroux
Created November 8, 2012 19:05
Show Gist options
  • Save sleroux/4040812 to your computer and use it in GitHub Desktop.
Save sleroux/4040812 to your computer and use it in GitHub Desktop.
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));
@jamesjhedley
Copy link

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

@jamesjhedley
Copy link

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