Skip to content

Commit

Permalink
Merge pull request #10560 from brave/l10n-less
Browse files Browse the repository at this point in the history
Remove string replacements as they are done in Python now
  • Loading branch information
bbondy authored and mkarolin committed Jul 7, 2020
1 parent ab7e662 commit 35ea4ac
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions lib/l10nUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,64 +200,8 @@ module.exports.rebaseBraveStringFilesOnChromiumL10nFiles = async function (path)
const removedMap = getRemovedGRDParts(grdsWithAutoAddedGrdps)
const ops = Object.entries(chromiumToAutoGeneratedBraveMapping).map(async ([sourcePath, destPath]) => {
let contents = await new Promise(resolve => fs.readFile(sourcePath, 'utf8', (err, data) => resolve(data)))
for (const replacement of defaultReplacements) {
contents = contents.replace(replacement[0], replacement[1])
}
for (const replacement of fixupReplacements) {
contents = contents.replace(replacement[0], replacement[1])
}
await new Promise(resolve => fs.writeFile(destPath, contents, 'utf8', resolve))
})
await Promise.all(ops)
return removedMap
}

// Straight-forward string replacement list.
// Consider mapping chromium resource ID to a new brave resource ID
// for whole-message replacements, instead of adding to this list.
// TODO(petemill): Get affected message IDs and clear out the translations in transifex for re-translation.
// This could be achieved with a regex like:
// (?<before><message name="(?<id>[^"]*)"[^>]*>[^<]*)The Chromium Authors(?<after>[^<]*<\/message>)
// Until that is implemented, when adding to or modifying this list, you must manually find the
// affected source strings in transifex, and delete every language's translation via the script
// 'npm run delete_string_translations -- ...'.
// Otherwise, languages apart from US English will not get updated.
const defaultReplacements = [
[/Automatically send usage statistics and crash reports to Google/g, 'Automatically send crash reports to Google'],
[/Automatically sends usage statistics and crash reports to Google/g, 'Automatically sends crash reports to Google'],
[/Chrome Web Store/g, 'Web Store'],
[/The Chromium Authors\n/g, 'Brave Software Inc\n'],
[/The Chromium Authors. All rights reserved./g, 'The Brave Authors. All rights reserved.'],
[/Google Chrome/g, 'Brave'],
[/Chromium/g, 'Brave'],
[/Chrome/g, 'Brave'],
[/Google LLC. All rights reserved./g, 'The Brave Authors. All rights reserved.'],
[/(Google)(?! Play)/g, 'Brave'],
[/You're incognito/g, 'This is a private window'],
[/an incognito/g, 'a private'],
[/an Incognito/g, 'a Private'],
[/incognito/g, 'private'],
[/Incognito/g, 'Private'],
[/inco\&amp\;gnito/g, '&amp;private'],
[/Inco\&amp\;gnito/g, '&amp;Private'],
[/People/g, 'Profiles'],
// 'people' but only in the context of profiles, not humans.
[/(?<!authenticate )people(?! with slow connections?)/g, 'profiles'],
[/(Person)(?!\w)/g, 'Profile'],
[/(person)(?!\w)/g, 'profile'],
[/Bookmarks Bar\n/g, 'Bookmarks\n'],
[/Bookmarks bar\n/g, 'Bookmarks\n'],
[/bookmarks bar\n/g, 'bookmarks\n'],
[/Copyright <ph name="(YEAR|year)">/g, 'Copyright © <ph name="$1">'],
]

// Fix up some strings after aggressive first round replacement.
const fixupReplacements = [
[/Brave Cloud Print/g, 'Google Cloud Print'],
[/Brave Docs/g, 'Google Docs'],
[/Brave Drive/g, 'Google Drive'],
[/Brave OS/g, 'Chrome OS'],
[/Brave Safe Browsing/g, 'Google Safe Browsing'],
[/Safe Browsing \(protects you and your device from dangerous sites\)/g, 'Google Safe Browsing \(protects you and your device from dangerous sites\)'],
[/Sends URLs of some pages you visit to Brave/g, 'Sends URLs of some pages you visit to Google']
]

0 comments on commit 35ea4ac

Please sign in to comment.