You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2015/02/21 13:40:50 UTC
cordova-windows git commit: CB-8515 Support DefaultLanguage selection
for Windows
Repository: cordova-windows
Updated Branches:
refs/heads/master 738a4a15f -> e25bc2a3c
CB-8515 Support DefaultLanguage selection for Windows
github close #59
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/e25bc2a3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/e25bc2a3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/e25bc2a3
Branch: refs/heads/master
Commit: e25bc2a3c67f975ab4bfe16952d6bcb59f35bf31
Parents: 738a4a1
Author: Murat Sutunc <mu...@microsoft.com>
Authored: Thu Feb 19 18:53:38 2015 -0800
Committer: sgrebnov <v-...@microsoft.com>
Committed: Sat Feb 21 15:39:39 2015 +0300
----------------------------------------------------------------------
template/cordova/lib/ConfigParser.js | 5 +++++
template/cordova/lib/prepare.js | 21 +++++++++++++++++++++
2 files changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/e25bc2a3/template/cordova/lib/ConfigParser.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/ConfigParser.js b/template/cordova/lib/ConfigParser.js
index 8ed33ed..ef81e7c 100644
--- a/template/cordova/lib/ConfigParser.js
+++ b/template/cordova/lib/ConfigParser.js
@@ -162,6 +162,11 @@ ConfigParser.prototype = {
}
});
return ret;
+ },
+
+ // Returns the widget defaultLocale
+ defaultLocale: function() {
+ return this.doc.getroot().attrib['defaultlocale'];
}
};
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/e25bc2a3/template/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/prepare.js b/template/cordova/lib/prepare.js
index 4b4c8c7..e6c00b0 100644
--- a/template/cordova/lib/prepare.js
+++ b/template/cordova/lib/prepare.js
@@ -40,14 +40,35 @@ module.exports.applyPlatformConfig = function () {
return false;
});
+ // Apply appxmanifest changes
['package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.phone.appxmanifest'].forEach(
function(manifestFile) {
updateManifestFile(config, path.join(ROOT, manifestFile));
});
+ // Apply jsproj changes
+ ['CordovaApp.Phone.jsproj', 'CordovaApp.Windows.jsproj', 'CordovaApp.Windows80.jsproj'].forEach(
+ function(jsprojFile) {
+ updatejsprojFile(config, path.join(ROOT, jsprojFile));
+ });
+
copyImages(config);
};
+function updatejsprojFile(config, jsProjFilePath) {
+ var defaultLocale = config.defaultLocale() || 'en-US';
+
+ var contents = fs.readFileSync(jsProjFilePath, 'utf-8');
+ // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
+ if (contents.charCodeAt(0) === 0xFEFF) {
+ contents = contents.slice(1);
+ }
+ var jsProjXML = new et.ElementTree(et.XML(contents));
+ var jsProjDefaultLocale = jsProjXML.find('./PropertyGroup/DefaultLanguage');
+ jsProjDefaultLocale.text = defaultLocale;
+ fs.writeFileSync(jsProjFilePath, jsProjXML.write({indent: 2}), 'utf-8');
+}
+
function updateManifestFile (config, manifestPath) {
var contents = fs.readFileSync(manifestPath, 'utf-8');
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org