From 2b66a65ff3e3aa2153ed2f02c84d1f7e235e7721 Mon Sep 17 00:00:00 2001 From: mkarolin Date: Tue, 14 Jun 2022 12:25:46 -0400 Subject: [PATCH] [l10n] Remove etherium-remote-client related code. We don't use their l10n any more. --- build/commands/lib/l10nUtil.js | 13 ------------- build/commands/lib/pullL10n.js | 7 +------ build/commands/lib/pushL10n.js | 7 +------ build/commands/scripts/commands.js | 4 ++-- script/lib/l10n/transifex/common.py | 13 ++----------- script/push-l10n.py | 3 +-- 6 files changed, 7 insertions(+), 40 deletions(-) diff --git a/build/commands/lib/l10nUtil.js b/build/commands/lib/l10nUtil.js index 7f0aef612d2..28d71556c01 100644 --- a/build/commands/lib/l10nUtil.js +++ b/build/commands/lib/l10nUtil.js @@ -205,19 +205,6 @@ const l10nUtil = { return l10nUtil.getAllBravePaths().filter((x) => ['grd', 'json'].includes(x.split('.').pop())) }, -// Helper function to retrieve ethereum-remote-client paths relative -// to the Brave paths - getEthereumRemoteClientPaths: (extensionPath) => { - let basePath = extensionPath - if (!basePath) { - basePath = '../../../ethereum-remote-client' - } - - return [ - `${basePath}/app/_locales/en/messages.json` - ] - }, - // Helper function to retrieve Greaselion script paths relative to the // Brave paths. // diff --git a/build/commands/lib/pullL10n.js b/build/commands/lib/pullL10n.js index 47fc1b86431..440c3a1bb1d 100644 --- a/build/commands/lib/pullL10n.js +++ b/build/commands/lib/pullL10n.js @@ -8,12 +8,7 @@ const pullL10n = (options) => { cmdOptions.cwd = config.braveCoreDir if (options.extension) { const extensionPath = options.extension_path - if (options.extension === 'ethereum-remote-client') { - l10nUtil.getEthereumRemoteClientPaths(extensionPath).forEach((sourceStringPath) => { - util.run('python', ['script/pull-l10n.py', '--source_string_path', sourceStringPath], cmdOptions) - }) - return - } else if (options.extension === 'greaselion') { + if (options.extension === 'greaselion') { l10nUtil.getGreaselionScriptPaths(extensionPath).forEach((sourceStringPath) => { util.run('python', ['script/pull-l10n.py', '--source_string_path', sourceStringPath], cmdOptions) }) diff --git a/build/commands/lib/pushL10n.js b/build/commands/lib/pushL10n.js index a6068f5a9a0..11f65546da2 100644 --- a/build/commands/lib/pushL10n.js +++ b/build/commands/lib/pushL10n.js @@ -12,12 +12,7 @@ const pushL10n = (options) => { options.with_missing_translations ? '--with_missing_translations' : '' if (options.extension) { const extensionPath = options.extension_path - if (options.extension === 'ethereum-remote-client') { - l10nUtil.getEthereumRemoteClientPaths(extensionPath).forEach((sourceStringPath) => { - util.run('/Python39/python', ['script/push-l10n.py', '--source_string_path', sourceStringPath], cmdOptions) - }) - return - } else if (options.extension === 'greaselion') { + if (options.extension === 'greaselion') { l10nUtil.getGreaselionScriptPaths(extensionPath).forEach((sourceStringPath) => { util.run('python', ['script/push-l10n.py', '--source_string_path', sourceStringPath], cmdOptions) }) diff --git a/build/commands/scripts/commands.js b/build/commands/scripts/commands.js index 2b6daab0311..ae8d21542e3 100644 --- a/build/commands/scripts/commands.js +++ b/build/commands/scripts/commands.js @@ -185,14 +185,14 @@ program program .command('pull_l10n') - .option('--extension ', 'Scope this command to localize a Brave extension such as ethereum-remote-client') + .option('--extension ', 'Scope this command to localize a Brave extension such as greaselion') .option('--grd_path ', `Relative path to match end of full GRD path, e.g: 'generated_resources.grd'.`) .option('--debug', `Dumps downloaded content for one language into TransifexCurrent.txt file in the temp directory.`) .action(pullL10n) program .command('push_l10n') - .option('--extension ', 'Scope this command to localize a Brave extension such as ethereum-remote-client') + .option('--extension ', 'Scope this command to localize a Brave extension such as greaselion') .option('--extension_path ', 'Local path for extension') .option('--grd_path ', `Relative path to match end of full GRD path, e.g: 'generated_resources.grd'.`) .option('--with_translations', 'Push local translations. WARNING: this will overwrite translations in Tansifex.') diff --git a/script/lib/l10n/transifex/common.py b/script/lib/l10n/transifex/common.py index 205be996bdf..d4f58164151 100644 --- a/script/lib/l10n/transifex/common.py +++ b/script/lib/l10n/transifex/common.py @@ -47,6 +47,7 @@ def should_use_transifex_for_file(source_string_path, filename): return slug in transifex_handled_slugs or slug.startswith('greaselion_') +# pylint: disable=inconsistent-return-statements def transifex_name_from_filename(source_file_path, filename): ext = os.path.splitext(source_file_path)[1] if 'brave_components_strings' in source_file_path: @@ -59,11 +60,9 @@ def transifex_name_from_filename(source_file_path, filename): return 'brave_extension' if 'brave_rewards' in source_file_path: return 'rewards_extension' - if 'ethereum-remote-client/app' in source_file_path: - return 'ethereum_remote_client_extension' assert False, ('JSON files should be mapped explicitly, this ' f'one is not: {source_file_path}') - +# pylint: enable=inconsistent-return-statements def transifex_name_from_greaselion_script_name(script_name): match = re.search(('brave-site-specific-scripts/scripts/(.*)/_locales/' + @@ -114,18 +113,10 @@ def get_acceptable_json_lang_codes(langs_dir_path): # Source language for Brave locales lang_codes.discard('en_US') - # Source language for ethereum-remote-client - lang_codes.discard('en') - # Files that are not locales lang_codes.discard('.DS_Store') lang_codes.discard('index.json') - # ethereum-remote-client has these unsupported locales - lang_codes.discard('tml') - lang_codes.discard('hn') - lang_codes.discard('ph') - lang_codes.discard('ht') return sorted(lang_codes) diff --git a/script/push-l10n.py b/script/push-l10n.py index 631d23f6dcd..297a72d29a7 100644 --- a/script/push-l10n.py +++ b/script/push-l10n.py @@ -80,8 +80,7 @@ def main(): upload_source_strings_desc(source_string_path, filename) # Upload local translations if requested - if ('ethereum-remote-client' in source_string_path or - 'brave-site-specific-scripts' in source_string_path or + if ('brave-site-specific-scripts' in source_string_path or args.with_translations or args.with_missing_translations): if ext == '.grd': upload_grd_translations_to_transifex(source_string_path, filename,