Skip to content

Commit 4de34bb

Browse files
bbondymkarolin
authored andcommitted
Merge pull request #10560 from brave/l10n-less
Remove string replacements as they are done in Python now
1 parent 1ecb7fe commit 4de34bb

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

lib/l10nUtil.js

-56
Original file line numberDiff line numberDiff line change
@@ -200,64 +200,8 @@ module.exports.rebaseBraveStringFilesOnChromiumL10nFiles = async function (path)
200200
const removedMap = getRemovedGRDParts(grdsWithAutoAddedGrdps)
201201
const ops = Object.entries(chromiumToAutoGeneratedBraveMapping).map(async ([sourcePath, destPath]) => {
202202
let contents = await new Promise(resolve => fs.readFile(sourcePath, 'utf8', (err, data) => resolve(data)))
203-
for (const replacement of defaultReplacements) {
204-
contents = contents.replace(replacement[0], replacement[1])
205-
}
206-
for (const replacement of fixupReplacements) {
207-
contents = contents.replace(replacement[0], replacement[1])
208-
}
209203
await new Promise(resolve => fs.writeFile(destPath, contents, 'utf8', resolve))
210204
})
211205
await Promise.all(ops)
212206
return removedMap
213207
}
214-
215-
// Straight-forward string replacement list.
216-
// Consider mapping chromium resource ID to a new brave resource ID
217-
// for whole-message replacements, instead of adding to this list.
218-
// TODO(petemill): Get affected message IDs and clear out the translations in transifex for re-translation.
219-
// This could be achieved with a regex like:
220-
// (?<before><message name="(?<id>[^"]*)"[^>]*>[^<]*)The Chromium Authors(?<after>[^<]*<\/message>)
221-
// Until that is implemented, when adding to or modifying this list, you must manually find the
222-
// affected source strings in transifex, and delete every language's translation via the script
223-
// 'npm run delete_string_translations -- ...'.
224-
// Otherwise, languages apart from US English will not get updated.
225-
const defaultReplacements = [
226-
[/Automatically send usage statistics and crash reports to Google/g, 'Automatically send crash reports to Google'],
227-
[/Automatically sends usage statistics and crash reports to Google/g, 'Automatically sends crash reports to Google'],
228-
[/Chrome Web Store/g, 'Web Store'],
229-
[/The Chromium Authors\n/g, 'Brave Software Inc\n'],
230-
[/The Chromium Authors. All rights reserved./g, 'The Brave Authors. All rights reserved.'],
231-
[/Google Chrome/g, 'Brave'],
232-
[/Chromium/g, 'Brave'],
233-
[/Chrome/g, 'Brave'],
234-
[/Google LLC. All rights reserved./g, 'The Brave Authors. All rights reserved.'],
235-
[/(Google)(?! Play)/g, 'Brave'],
236-
[/You're incognito/g, 'This is a private window'],
237-
[/an incognito/g, 'a private'],
238-
[/an Incognito/g, 'a Private'],
239-
[/incognito/g, 'private'],
240-
[/Incognito/g, 'Private'],
241-
[/inco\&amp\;gnito/g, '&amp;private'],
242-
[/Inco\&amp\;gnito/g, '&amp;Private'],
243-
[/People/g, 'Profiles'],
244-
// 'people' but only in the context of profiles, not humans.
245-
[/(?<!authenticate )people(?! with slow connections?)/g, 'profiles'],
246-
[/(Person)(?!\w)/g, 'Profile'],
247-
[/(person)(?!\w)/g, 'profile'],
248-
[/Bookmarks Bar\n/g, 'Bookmarks\n'],
249-
[/Bookmarks bar\n/g, 'Bookmarks\n'],
250-
[/bookmarks bar\n/g, 'bookmarks\n'],
251-
[/Copyright <ph name="(YEAR|year)">/g, 'Copyright © <ph name="$1">'],
252-
]
253-
254-
// Fix up some strings after aggressive first round replacement.
255-
const fixupReplacements = [
256-
[/Brave Cloud Print/g, 'Google Cloud Print'],
257-
[/Brave Docs/g, 'Google Docs'],
258-
[/Brave Drive/g, 'Google Drive'],
259-
[/Brave OS/g, 'Chrome OS'],
260-
[/Brave Safe Browsing/g, 'Google Safe Browsing'],
261-
[/Safe Browsing \(protects you and your device from dangerous sites\)/g, 'Google Safe Browsing \(protects you and your device from dangerous sites\)'],
262-
[/Sends URLs of some pages you visit to Brave/g, 'Sends URLs of some pages you visit to Google']
263-
]

0 commit comments

Comments
 (0)