diff --git a/l10n/__init__.py b/l10n/__init__.py index 1f775f4..9de3378 100644 --- a/l10n/__init__.py +++ b/l10n/__init__.py @@ -4,5 +4,5 @@ from ._locales import Locales -__version__ = '0.1.1' +__version__ = '0.1.2' __all__ = ['Locales', 'Locale'] diff --git a/l10n/_commands/_translate.py b/l10n/_commands/_translate.py index c69d9c7..a6d3d71 100644 --- a/l10n/_commands/_translate.py +++ b/l10n/_commands/_translate.py @@ -2,7 +2,6 @@ from pathlib import Path import polib -from googletrans import Translator from .._project import Project, find_project_root from ._base import Command @@ -23,6 +22,12 @@ def init_parser(parser: ArgumentParser) -> None: ) def run(self) -> int: + try: + from googletrans import Translator + except ImportError: + msg = 'Please, run `python3 -m pip install googletrans==4.0.0rc1`' + raise ImportError(msg) + project_root = find_project_root(self.args.path) project = Project(project_root) translator = Translator() diff --git a/pyproject.toml b/pyproject.toml index e4cbf4c..581bebb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,12 +39,12 @@ cli = [ "mypy", "tomli", "polib", - "googletrans==4.0.0rc1", ] test = [ - "pytest", + "googletrans==4.0.0rc1", "pytest-cov", "pytest-xdist", + "pytest", ] lint = [ "flake8-length",