cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nikhilkh <...@git.apache.org>
Subject [GitHub] cordova-wp8 pull request: CB-8516 Support DefaultLanguage selectio...
Date Fri, 20 Feb 2015 19:59:12 GMT
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-wp8/pull/76#discussion_r25098154
  
    --- Diff: template/cordova/lib/build.js ---
    @@ -68,6 +70,40 @@ module.exports.run = function (argv) {
         }
     
         return parseAndValidateArgs(argv)
    +    .then(function(buildopts) {
    +        var csProjFilePath = shell.ls(path.join(ROOT, '*.csproj'))[0];
    +        var WMAppManifestFilePath = path.join(ROOT, 'Properties', 'WMAppManifest.xml');
    +        var AssemblyInfoFilePath = path.join(ROOT, 'Properties', 'AssemblyInfo.cs');
    +        var configFilePath = path.join(ROOT, '..', '..', 'config.xml');
    +
    +        var configContents = removeBOM(fs.readFileSync(configFilePath, 'utf-8'));
    +        var configXML =  new et.ElementTree(et.XML(configContents));
    +        var defaultLocale = configXML.getroot().attrib['defaultlocale'] || 'en-US';
    +
    +        // Change locale on csproj file
    +        var csProjContents = removeBOM(fs.readFileSync(csProjFilePath, 'utf-8'));
    +        var csProjXML =  new et.ElementTree(et.XML(csProjContents));
    +        var csProjDefaultLocale = csProjXML.find('./PropertyGroup/SupportedCultures');
    +        csProjDefaultLocale.text = defaultLocale;
    +        fs.writeFileSync(csProjFilePath, csProjXML.write({indent: 2}), 'utf-8');
    +
    +        // Change locale on WMAppManifest file
    +        var WMAppManifestContents = removeBOM(fs.readFileSync(WMAppManifestFilePath,
'utf-8'));
    +        var WMAppManifestXML =  new et.ElementTree(et.XML(WMAppManifestContents));
    +        var WMAppManifestLanguages = WMAppManifestXML.find('./Languages/Language');
    +        WMAppManifestLanguages.set('code', defaultLocale);
    +        var WMAppManifestDefaultLanguage = WMAppManifestXML.find('./DefaultLanguage');
    +        WMAppManifestDefaultLanguage.set('code', defaultLocale);
    +        fs.writeFileSync(WMAppManifestFilePath, WMAppManifestXML.write({indent: 2}),
'utf-8');
    +
    +        // Change locale on AssemblyInfo file
    +        var AssemblyInfoContents = removeBOM(fs.readFileSync(AssemblyInfoFilePath, 'utf-8'));
    +        AssemblyInfoContents = AssemblyInfoContents.replace(/[\w\[: ]+NeutralResourcesLanguageAttribute\("[\w\-]+"\)]/,
    --- End diff --
    
    Changing the NeutralResourceLanguageAttribute does not look like the correct thing to
do here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message