more clean up

This commit is contained in:
emlys 2021-11-12 13:02:39 -08:00
parent 1d7689cda4
commit d1ffc55708
4 changed files with 5 additions and 6 deletions

View File

@ -23,7 +23,7 @@ When we are ready to get a new batch of translations, here is the process.
1. Run the following from the root invest directory, replacing `<LANG>` with the language code: 1. Run the following from the root invest directory, replacing `<LANG>` with the language code:
``` ```
pybabel extract \ # extract messages from source code and write to template pybabel extract \
--no-wrap \ --no-wrap \
--project InVEST \ --project InVEST \
--version 3.10 \ --version 3.10 \
@ -58,7 +58,7 @@ git commit -m "update <LANG> message catalog with new translations"
``` ```
mkdir -p src/natcap/invest/internationalization/locales/<LANG>/LC_MESSAGES/ # create the expected directory structure mkdir -p src/natcap/invest/internationalization/locales/<LANG>/LC_MESSAGES/ # create the expected directory structure
pybabel init --input-file src/natcap/invest/internationalization/messages.pot --output-file src/natcap/invest/internationalization/locales/<LANG>/LC_MESSAGES/messages.po # initialize the message catalog from the template pybabel init --input-file src/natcap/invest/internationalization/messages.pot --output-file src/natcap/invest/internationalization/locales/<LANG>/LC_MESSAGES/messages.po --locale <LANG> # initialize the message catalog from the template
``` ```
Then follow the "Process to update translations" instructions above, starting from step 2. Then follow the "Process to update translations" instructions above, starting from step 2.

View File

@ -75,11 +75,10 @@ def get_invest_getspec():
Returns: Returns:
A JSON string. A JSON string.
""" """
# this will be the model key name, not language specific
target_model = request.get_json()
target_module = MODEL_METADATA[target_model].pyname
install_language(request.args.get('language', 'en')) install_language(request.args.get('language', 'en'))
importlib.reload(natcap.invest) importlib.reload(natcap.invest)
target_model = request.get_json()
target_module = MODEL_METADATA[target_model].pyname
model_module = importlib.import_module(name=target_module) model_module = importlib.import_module(name=target_module)
return spec_utils.serialize_args_spec(model_module.ARGS_SPEC) return spec_utils.serialize_args_spec(model_module.ARGS_SPEC)

View File

@ -20,6 +20,7 @@ import numpy
from . import utils from . import utils
from . import spec_utils from . import spec_utils
#: A flag to pass to the validation context manager indicating that all keys #: A flag to pass to the validation context manager indicating that all keys
#: should be checked. #: should be checked.
CHECK_ALL_KEYS = None CHECK_ALL_KEYS = None

View File

@ -225,7 +225,6 @@ class CLIHeadlessTests(unittest.TestCase):
new_parameter_set_path, new_parameter_set_path,
]) ])
validation_output = stdout_stream.getvalue() validation_output = stdout_stream.getvalue()
print(repr(validation_output))
# it's expected that these paths aren't found because it's looking in # it's expected that these paths aren't found because it's looking in
# the temporary test directory. do_batch is False so it doesn't check # the temporary test directory. do_batch is False so it doesn't check
# the population_csv_dir path, which also wouldn't exist. # the population_csv_dir path, which also wouldn't exist.