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 #20913 from yurenju/branding
Browse files Browse the repository at this point in the history
Bug 996479 - {{browserBrandShortName}} is displayed instead of Firefox O... r=@cctuan
  • Loading branch information
yurenju committed Jun 25, 2014
2 parents 73b9c78 + 74b1161 commit f99a96a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
24 changes: 20 additions & 4 deletions build/multilocale.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const RE_INI_FILE = /locales[\/\\].+\.ini$/;
const RE_PROPERTIES_FILE = /\.([\w-]+)\.properties$/;
const MODNAME = 'multilocale';

function L10nManager(gaiaDir, localesFilePath, localeBasedir) {
function L10nManager(gaiaDir, localesFilePath, localeBasedir, official) {
function checkArg(arg) {
return Boolean(arg);
}
Expand All @@ -33,8 +33,8 @@ function L10nManager(gaiaDir, localesFilePath, localeBasedir) {
}
});

[this.locales, this.localeBasedir, this.gaiaDir] =
[Object.keys(utils.getJSON(localesFile)), baseDir.path, gaiaDir];
[this.locales, this.localeBasedir, this.gaiaDir, this.official] =
[Object.keys(utils.getJSON(localesFile)), baseDir.path, gaiaDir, official];


/**
Expand Down Expand Up @@ -122,6 +122,21 @@ function L10nManager(gaiaDir, localesFilePath, localeBasedir) {
ini[locale].forEach(function(path) {
var targetFile = utils.getFile(iniFile.parent.path, path);
var propFile = getPropertiesFile(webapp, targetFile.path);
if (utils.isSubjectToBranding(propFile.parent.path)) {
var brandings = {
target: { original: targetFile },
src: { original: propFile }
};
for (var key in brandings) {
brandings[key].modified = brandings[key].original.parent.clone();
brandings[key].modified.append((self.official === '1') ?
'official' : 'unofficial');
brandings[key].modified.append(brandings[key].original.leafName);
}
targetFile = brandings.target.modified;
propFile = brandings.src.modified;
}

if (!propFile.exists()) {
utils.log(MODNAME, 'Properties file not found: ' + propFile.path);
return;
Expand Down Expand Up @@ -400,7 +415,8 @@ function execute(options) {
var l10nManager = new L10nManager(
options.GAIA_DIR,
options.LOCALES_FILE,
localeBasedir);
localeBasedir,
options.OFFICIAL);

gaia.webapps.forEach(function(webapp) {
if (utils.isExternalApp(webapp)) {
Expand Down
2 changes: 1 addition & 1 deletion build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function isNode() {
}

function isSubjectToBranding(path) {
return /shared[\/\\][a-zA-Z]+[\/\\]branding$/.test(path) ||
return /shared[\/\\]?[a-zA-Z]*[\/\\]?branding$/.test(path) ||
/branding[\/\\]initlogo.png/.test(path);
}

Expand Down
2 changes: 1 addition & 1 deletion build/webapp-optimize.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function optimize_getFileContent(webapp, htmlFile, relativePath) {
}
file.append(name);
if (utils.isSubjectToBranding(file.path)) {
file.append((config.OFFICIAL == 1) ? 'official' : 'unofficial');
file.append((config.OFFICIAL === '1') ? 'official' : 'unofficial');
}
});

Expand Down
2 changes: 1 addition & 1 deletion build/webapp-shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ WebappShared.prototype.pushResource = function(path) {
path.split('/').forEach(function(segment) {
file.append(segment);
if (utils.isSubjectToBranding(file.path)) {
file.append((this.config.OFFICIAL == 1) ? 'official' : 'unofficial');
file.append((this.config.OFFICIAL === '1') ? 'official' : 'unofficial');
}
}.bind(this));

Expand Down

0 comments on commit f99a96a

Please sign in to comment.