From 55e6f8000edcc3986eb87d4e07ba074cde9c2ebb Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Tue, 14 Jul 2020 12:07:56 -0700 Subject: [PATCH] Move i18n scripts under scripts/ (#4044) * Move i18n scripts under scripts/ --- appengine/.gcloudignore | 4 ++-- build.py | 8 ++++---- msg/messages.js | 4 ++-- scripts/gulpfiles/build_tasks.js | 4 ++-- {i18n => scripts/i18n}/common.py | 0 {i18n => scripts/i18n}/create_messages.py | 0 {i18n => scripts/i18n}/dedup_json.py | 0 {i18n => scripts/i18n}/js_to_json.py | 0 {i18n => scripts/i18n}/tests.py | 0 9 files changed, 10 insertions(+), 10 deletions(-) rename {i18n => scripts/i18n}/common.py (100%) rename {i18n => scripts/i18n}/create_messages.py (100%) rename {i18n => scripts/i18n}/dedup_json.py (100%) rename {i18n => scripts/i18n}/js_to_json.py (100%) rename {i18n => scripts/i18n}/tests.py (100%) diff --git a/appengine/.gcloudignore b/appengine/.gcloudignore index 8a3772bae..2dd9ec0da 100644 --- a/appengine/.gcloudignore +++ b/appengine/.gcloudignore @@ -8,14 +8,14 @@ /static/demos/plane/soy/*.jar /static/demos/plane/xlf/ /static/externs/ -/static/i18n/ /static/msg/json/ /static/node_modules/ /static/package/ -/static/theme_scripts/ +/static/scripts/ /static/typings/ /static/build.py +/static/eslintrc.json /static/gulpfile.js /static/jsconfig.json /static/LICENSE diff --git a/build.py b/build.py index 8b78ec548..48d1502c0 100755 --- a/build.py +++ b/build.py @@ -408,14 +408,14 @@ class Gen_langfiles(threading.Thread): try: subprocess.check_call([ "python", - os.path.join("i18n", "js_to_json.py"), + os.path.join("scripts", "i18n", "js_to_json.py"), "--input_file", "msg/messages.js", "--output_dir", "msg/json/", "--quiet"]) except (subprocess.CalledProcessError, OSError) as e: # Documentation for subprocess.check_call says that CalledProcessError # will be raised on failure, but I found that OSError is also possible. - print("Error running i18n/js_to_json.py: ", e) + print("Error running scripts/i18n/js_to_json.py: ", e) sys.exit(1) # Checking whether it is necessary to rebuild the js files would be a lot of @@ -425,7 +425,7 @@ class Gen_langfiles(threading.Thread): # Use create_messages.py to create .js files from .json files. cmd = [ "python", - os.path.join("i18n", "create_messages.py"), + os.path.join("scripts", "i18n", "create_messages.py"), "--source_lang_file", os.path.join("msg", "json", "en.json"), "--source_synonym_file", os.path.join("msg", "json", "synonyms.json"), "--source_constants_file", os.path.join("msg", "json", "constants.json"), @@ -438,7 +438,7 @@ class Gen_langfiles(threading.Thread): cmd.extend(json_files) subprocess.check_call(cmd) except (subprocess.CalledProcessError, OSError) as e: - print("Error running i18n/create_messages.py: ", e) + print("Error running scripts/i18n/create_messages.py: ", e) sys.exit(1) # Output list of .js files created. diff --git a/msg/messages.js b/msg/messages.js index 59b018e5c..884c97245 100644 --- a/msg/messages.js +++ b/msg/messages.js @@ -10,11 +10,11 @@ * * After modifying this file, either run "build.py" from the parent directory, * or run (from this directory): - * ../i18n/js_to_json.py + * ../scripts/i18n/js_to_json.py * to regenerate json/{en,qqq,synonyms}.json. * * To convert all of the json files to .js files, run: - * ../i18n/create_messages.py json/*.json + * ../scripts/i18n/create_messages.py json/*.json */ 'use strict'; diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 95d72fd58..832ec6248 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -407,7 +407,7 @@ goog.require('Blockly.requires') */ function buildLangfiles(done) { // Run js_to_json.py - const jsToJsonCmd = `python ./i18n/js_to_json.py \ + const jsToJsonCmd = `python ./scripts/i18n/js_to_json.py \ --input_file ${path.join('msg', 'messages.js')} \ --output_dir ${path.join('msg', 'json')} \ --quiet`; @@ -418,7 +418,7 @@ function buildLangfiles(done) { json_files = json_files.filter(file => file.endsWith('json') && !(new RegExp(/(keys|synonyms|qqq|constants)\.json$/).test(file))); json_files = json_files.map(file => path.join('msg', 'json', file)); - const createMessagesCmd = `python ./i18n/create_messages.py \ + const createMessagesCmd = `python ./scripts/i18n/create_messages.py \ --source_lang_file ${path.join('msg', 'json', 'en.json')} \ --source_synonym_file ${path.join('msg', 'json', 'synonyms.json')} \ --source_constants_file ${path.join('msg', 'json', 'constants.json')} \ diff --git a/i18n/common.py b/scripts/i18n/common.py similarity index 100% rename from i18n/common.py rename to scripts/i18n/common.py diff --git a/i18n/create_messages.py b/scripts/i18n/create_messages.py similarity index 100% rename from i18n/create_messages.py rename to scripts/i18n/create_messages.py diff --git a/i18n/dedup_json.py b/scripts/i18n/dedup_json.py similarity index 100% rename from i18n/dedup_json.py rename to scripts/i18n/dedup_json.py diff --git a/i18n/js_to_json.py b/scripts/i18n/js_to_json.py similarity index 100% rename from i18n/js_to_json.py rename to scripts/i18n/js_to_json.py diff --git a/i18n/tests.py b/scripts/i18n/tests.py similarity index 100% rename from i18n/tests.py rename to scripts/i18n/tests.py