diff --git a/.github/workflows/superset-python.yml b/.github/workflows/superset-python.yml index ac4b20d2c..d3f61b158 100644 --- a/.github/workflows/superset-python.yml +++ b/.github/workflows/superset-python.yml @@ -50,6 +50,27 @@ jobs: - name: Build documentation run: sphinx-build -b html docs _build/html -W + babel-extract: + runs-on: ubuntu-18.04 + strategy: + matrix: + python-version: [3.6] + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + uses: apache-superset/cached-dependencies@adc6f73 + with: + run: | + pip-install + pip install -r docs/requirements.txt + - name: Test babel extraction + run: flask fab babel-extract --target superset/translations --output superset/translations/messages.pot --config superset/translations/babel.cfg -k _,__,t,tn,tct + test-postgres: runs-on: ubuntu-18.04 strategy: diff --git a/superset/datasets/commands/exceptions.py b/superset/datasets/commands/exceptions.py index e5f3ae292..69bd7cd7d 100644 --- a/superset/datasets/commands/exceptions.py +++ b/superset/datasets/commands/exceptions.py @@ -127,10 +127,11 @@ class TableNotFoundValidationError(ValidationError): def __init__(self, table_name: str) -> None: super().__init__( _( - f"Table [{table_name}] could not be found, " + "Table [%(table_name)s] could not be found, " "please double check your " "database connection, schema, and " - f"table name" + "table name", + table_name=table_name, ), field_names=["table_name"], ) diff --git a/superset/views/core.py b/superset/views/core.py index e688d423a..995222349 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1701,9 +1701,9 @@ class Superset(BaseSupersetView): if not table: return json_error_response( __( - "Table %(t)s wasn't found in the database %(d)s", - t=table_name, - s=db_name, + "Table %(table)s wasn't found in the database %(db)s", + table=table_name, + db=db_name, ), status=404, ) @@ -2308,9 +2308,11 @@ class Superset(BaseSupersetView): except Exception as ex: logger.exception(ex) msg = _( - f"{validator.name} was unable to check your query.\n" + "%(validator)s was unable to check your query.\n" "Please recheck your query.\n" - f"Exception: {ex}" + "Exception: %(ex)s", + validator=validator.name, + ex=ex, ) # Return as a 400 if the database error message says we got a 4xx error if re.search(r"([\W]|^)4\d{2}([\W]|$)", str(ex)):