diff --git a/CHANGES.rst b/CHANGES.rst index 2f7009e..b937fff 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,5 +1,9 @@ Changelog --------- +3.7.0 +----- + +* Adds region flag to CLI 3.6.1 ----- diff --git a/README.rst b/README.rst index 7e92af6..1844fcc 100644 --- a/README.rst +++ b/README.rst @@ -91,6 +91,7 @@ Options --secret_access_key TEXT Set the secret access key used to get provider oAuth token. -o, --output_only Set to display the translation only. + -r, --region TEXT Set to pass a region in to API calls that require it. --help Show this message and exit. diff --git a/translate/main.py b/translate/main.py index d942fb3..dd0a8b6 100644 --- a/translate/main.py +++ b/translate/main.py @@ -140,6 +140,12 @@ def config_file(ctx, from_lang, to_lang, provider, secret_access_key): help="Set to use DeepL's pro API.", required=False, ) +@click.option( + 'region', '--region', '-r', + default=get_config_info('region'), + help="Region for apis", + required=False, +) @click.argument('text', nargs=-1, type=click.STRING, required=True) def main(from_lang, to_lang, provider, secret_access_key, output_only, pro, text): """ @@ -163,6 +169,7 @@ def main(from_lang, to_lang, provider, secret_access_key, output_only, pro, text if provider != DEFAULT_PROVIDER: kwargs['secret_access_key'] = secret_access_key kwargs['pro'] = pro + kwargs['region'] = region translator = Translator(**kwargs) translation = translator.translate(text) diff --git a/translate/version.py b/translate/version.py index b202327..46f67e7 100644 --- a/translate/version.py +++ b/translate/version.py @@ -1 +1 @@ -__version__ = "3.6.1" +__version__ = "3.7.0"