Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace chrome branding strings in management_strings.grdp #6475

Merged
merged 1 commit into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')))
darkdh marked this conversation as resolved.
Show resolved Hide resolved
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