Skip to content

Commit

Permalink
Replace chrome branding strings in management_strings.grdp
Browse files Browse the repository at this point in the history
This replaces chrome string in brave://management webui page.
  • Loading branch information
simonhong committed Nov 5, 2019
1 parent 12952ca commit 5c3d807
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/chromiumRebaseL10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ const resetChromeStringFiles = () => {
// Revert to original before string replacement for android_chrome_strings.grd
// because original grd is overwritten with replaced one in ./src/brave.
const srcDir = config.projects['chrome'].dir
const androidChromeStringsPath = path.resolve(path.join(srcDir, 'chrome', 'android', 'java', 'strings', 'android_chrome_strings.grd'))
util.run('git', ['checkout', androidChromeStringsPath], { cwd: srcDir })
const targetFilesForReset = []
targetFilesForReset.push(path.resolve(path.join(srcDir, 'chrome', 'android', 'java', 'strings', 'android_chrome_strings.grd')))
targetFilesForReset.push(path.resolve(path.join(srcDir, 'components', 'management_strings.grdp')))
targetFilesForReset.forEach((targetFile) => {
util.run('git', ['checkout', targetFile], { cwd: srcDir })
})
}

const chromiumRebaseL10n = async (options) => {
Expand Down
7 changes: 6 additions & 1 deletion lib/l10nUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const braveComponentsStringsPath = path.resolve(path.join(srcDir, 'brave', 'app'
const chromiumBookmarksBarStringsPartPath = path.resolve(path.join(srcDir, 'components', 'bookmark_bar_strings.grdp'))
const braveBookmarksBarStringsPartPath = path.resolve(path.join(srcDir, 'brave', 'app', 'bookmark_bar_strings.grdp'))

// src/components/components_strings.grd and any of its parts files.
const chromiumManagementStringsPartPath = path.resolve(path.join(srcDir, 'components', 'management_strings.grdp'))
const braveManagementStringsPartPath = path.resolve(path.join(srcDir, 'brave', 'chromium_src', 'components', 'management_strings.grdp'))

// generated_resources.grd and any of its parts files that we track localization for in transifex
// There is also chromeos_strings.grdp but we don't need to track it here
// These map to brave/app/resources/generated_resoruces*.xtb
Expand Down Expand Up @@ -99,7 +103,8 @@ const chromiumToAutoGeneratedBraveMapping = {
[chromiumAppManagementStringsPartPath]: braveAppManagementStringsPartPath,
[chromiumGlobalMediaControlsStringsPartPath]: braveGlobalMediaControlsStringsPartPath,
[chromiumSupervisedUserErrorPageStringsPartPath]: braveSupervisedUserErrorPageStringsPartPath,
[androidChromeStringsPath]: braveAndroidChromeStringsPath
[androidChromeStringsPath]: braveAndroidChromeStringsPath,
[chromiumManagementStringsPartPath]: braveManagementStringsPartPath
}

// Same as with chromiumToAutoGeneratedBraveMapping but maps in the opposite direction
Expand Down
2 changes: 2 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@ const util = {
const braveAppVectorIconsDir = path.join(config.projects['brave-core'].dir, 'vector_icons', 'chrome', 'app')
const chromeAndroidDir = path.join(config.srcDir, 'chrome', 'android')
const braveAndroidDir = path.join(config.projects['brave-core'].dir, 'android')
const braveChromiumSrcDir = path.join(config.projects['brave-core'].dir, 'chromium_src')

let fileMap = new Set();
// The following 3 entries we map to the same name, not the chromium equivalent name for copying back
autoGeneratedBraveToChromiumMapping[path.join(braveAppDir, 'brave_strings.grd')] = path.join(chromeAppDir, 'brave_strings.grd')
autoGeneratedBraveToChromiumMapping[path.join(braveAppDir, 'settings_brave_strings.grdp')] = path.join(chromeAppDir, 'settings_brave_strings.grdp')
autoGeneratedBraveToChromiumMapping[path.join(braveAppDir, 'components_brave_strings.grd')] = path.join(config.srcDir, 'components', 'components_brave_strings.grd')
autoGeneratedBraveToChromiumMapping[path.join(braveAndroidDir, 'java', 'strings', 'android_chrome_strings.grd')] = path.join(chromeAndroidDir, 'java', 'strings', 'android_chrome_strings.grd')
autoGeneratedBraveToChromiumMapping[path.join(braveChromiumSrcDir, 'components', 'management_strings.grdp')] = path.join(config.srcDir, 'components', 'management_strings.grdp')
Object.entries(autoGeneratedBraveToChromiumMapping).forEach(mapping => fileMap.add(mapping))

// Copy xtb files for:
Expand Down

0 comments on commit 5c3d807

Please sign in to comment.