Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21172 from yurenju/multilocale-manifest
Browse files Browse the repository at this point in the history
Bug 1007485 - manifest.webapp shoud not be localized in en-US if LOCALE_... r=@cctuan
  • Loading branch information
yurenju committed Jul 16, 2014
2 parents 122bb76 + dbe3591 commit d29773d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build/multilocale.js
Expand Up @@ -252,10 +252,13 @@ function L10nManager(gaiaDir, localesFilePath, localeBasedir, official) {
function localizeManifest(webapp) {
var localesProps = [];
var localesForManifest = self.locales.filter(function(locale) {
if (locale === 'en-US') {
return false;
}
var parent = webapp.sourceDirectoryFile.parent.leafName;
var propFile = utils.getFile(self.localeBasedir, locale, parent,
webapp.sourceDirectoryName, 'manifest.properties');
if (!propFile.exists() ) {
if (!propFile.exists()) {
// we don't show warning message if it isn't in "apps" directory.
if (locale !== 'en-US' && parent === 'apps') {
utils.log(MODNAME, 'App "' + webapp.sourceDirectoryName +
Expand Down
15 changes: 15 additions & 0 deletions build/test/integration/multilocale.test.js
Expand Up @@ -26,6 +26,18 @@ suite('multilocale Integration tests', function() {
'/archive/tip.tar.gz';
var dl = download(url, dir, {extract: true, strip: 1});
dl.once('close', function() {
if (locale === 'en-US') {
var manifestPath = path.join(dir, 'apps', 'settings',
'manifest.properties');
var systemTranslation = fs.readFileSync(manifestPath,
{encoding: 'utf-8'});
// bug 1007485: we shouldn't translate en-US even if
// LOCALES_BASEDIR/en-US exists, so change "Gaia Settings" to
// "Gaea Settings" in en-US and assume it shouldn't be translated to
// "Gaea Settings".
fs.writeFileSync(manifestPath,
systemTranslation.replace('Gaia Settings', 'Gaea Settings'));
}
callback();
});
};
Expand Down Expand Up @@ -67,6 +79,9 @@ suite('multilocale Integration tests', function() {
}

assert.deepEqual(JSON.parse(zip.readAsText(langPathInZip)), localesFileObj);
var manifest =
JSON.parse(zip.readAsText(zip.getEntry('manifest.webapp')));
assert.equal(manifest.locales['en-US'].description, 'Gaia Settings');
done();
});
}
Expand Down

0 comments on commit d29773d

Please sign in to comment.