From 03281f7ccd48eb39e9baa0ddcdf0620314653473 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:01:22 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/nigthly-tests.yml | 56 +++--- .github/workflows/publish.yml | 114 +++++------ .github/workflows/ruff.yml | 28 +-- .github/workflows/test.yml | 190 +++++++++--------- docs/concept/content-paths.md | 4 +- docs/concept/segments.md | 6 +- docs/concept/translatable-fields-autogen.md | 16 +- docs/how-to/integrations/pontoon.md | 14 +- docs/tutorial/2-configure-wagtail-localize.md | 4 +- docs/tutorial/3-content.md | 8 +- docs/tutorial/4-templates.md | 4 +- .../components/DocumentChooser/index.tsx | 2 +- .../components/SnippetChooser/index.tsx | 10 +- .../common/components/Tabs/index.tsx | 2 +- .../static_src/component_form/main.tsx | 2 +- .../components/TranslationEditor/footer.tsx | 20 +- .../components/TranslationEditor/index.tsx | 8 +- .../TranslationEditor/legacy-footer.tsx | 12 +- .../components/TranslationEditor/reducer.ts | 6 +- .../components/TranslationEditor/segments.tsx | 38 ++-- .../components/TranslationEditor/toolbox.tsx | 2 +- wagtail_localize/static_src/editor/main.tsx | 6 +- wagtail_localize/test/fixtures/test_user.json | 34 ++-- webpack.config.js | 10 +- 24 files changed, 298 insertions(+), 298 deletions(-) diff --git a/.github/workflows/nigthly-tests.yml b/.github/workflows/nigthly-tests.yml index b159ce7d9..26d5a1cc3 100644 --- a/.github/workflows/nigthly-tests.yml +++ b/.github/workflows/nigthly-tests.yml @@ -1,36 +1,36 @@ name: Nightly Wagtail test on: - schedule: - # Nightly at 4am. - - cron: '0 4 * * *' + schedule: + # Nightly at 4am. + - cron: '0 4 * * *' - workflow_dispatch: + workflow_dispatch: jobs: - nightly-test: - # Cannot check the existence of secrets, so limiting to repository name to prevent all forks to run nightly. - # See: https://github.com/actions/runner/issues/520 - if: ${{ github.repository == 'wagtail/wagtail-localize' }} - runs-on: ubuntu-latest + nightly-test: + # Cannot check the existence of secrets, so limiting to repository name to prevent all forks to run nightly. + # See: https://github.com/actions/runner/issues/520 + if: ${{ github.repository == 'wagtail/wagtail-localize' }} + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - name: Install dependencies - run: | - python -m pip install --upgrade pip tox - - name: Test - id: test - continue-on-error: true - run: tox -e wagtailmain + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip tox + - name: Test + id: test + continue-on-error: true + run: tox -e wagtailmain - - name: Send Slack notification on failure - if: steps.test.outcome == 'failure' - run: | - python .github/scripts/report_nightly_build_failure.py - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + - name: Send Slack notification on failure + if: steps.test.outcome == 'failure' + run: | + python .github/scripts/report_nightly_build_failure.py + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f04e1cae8..bbdd9a392 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,62 +1,62 @@ name: Publish to PyPI on: - release: - types: [published] + release: + types: [published] jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read # to fetch code (actions/checkout) - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - - name: Install Node dependencies - run: npm ci - - - name: Build static files - run: ./node_modules/.bin/webpack --mode production - - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - cache: 'pip' - cache-dependency-path: '**/pyproject.toml' - - - name: ⬇️ Install build dependencies - run: | - python -m pip install -U flit - - - name: 🏗️ Build - run: python -m flit build - - - uses: actions/upload-artifact@v4 - with: - path: ./dist - - # https://docs.pypi.org/trusted-publishers/using-a-publisher/ - pypi-publish: - needs: build - environment: 'publish' - - name: ⬆️ Upload release to PyPI - runs-on: ubuntu-latest - permissions: - # Mandatory for trusted publishing - id-token: write - steps: - - uses: actions/download-artifact@v4 - - - name: 🚀 Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: artifact/ - print-hash: true + build: + runs-on: ubuntu-latest + permissions: + contents: read # to fetch code (actions/checkout) + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + + - name: Install Node dependencies + run: npm ci + + - name: Build static files + run: ./node_modules/.bin/webpack --mode production + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: 'pip' + cache-dependency-path: '**/pyproject.toml' + + - name: ⬇️ Install build dependencies + run: | + python -m pip install -U flit + + - name: 🏗️ Build + run: python -m flit build + + - uses: actions/upload-artifact@v4 + with: + path: ./dist + + # https://docs.pypi.org/trusted-publishers/using-a-publisher/ + pypi-publish: + needs: build + environment: 'publish' + + name: ⬆️ Upload release to PyPI + runs-on: ubuntu-latest + permissions: + # Mandatory for trusted publishing + id-token: write + steps: + - uses: actions/download-artifact@v4 + + - name: 🚀 Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: artifact/ + print-hash: true diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 0fec3836d..0b7ac37a9 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,22 +1,22 @@ name: Ruff on: - push: - branches: - - main - - 'stable/**' - pull_request: - branches: [main] + push: + branches: + - main + - 'stable/**' + pull_request: + branches: [main] jobs: - ruff: - runs-on: ubuntu-latest + ruff: + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + steps: + - uses: actions/checkout@v4 - - run: python -Im pip install --user ruff + - run: python -Im pip install --user ruff - - name: Run ruff - working-directory: . - run: ruff --output-format=github wagtail_localize + - name: Run ruff + working-directory: . + run: ruff --output-format=github wagtail_localize diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5bac20c4..405288176 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,115 +1,115 @@ name: Localize CI on: - push: - branches: - - main - - 'stable/**' + push: + branches: + - main + - 'stable/**' - pull_request: + pull_request: concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: - FORCE_COLOR: '1' # Make tools pretty. - TOX_TESTENV_PASSENV: FORCE_COLOR - PIP_DISABLE_PIP_VERSION_CHECK: '1' - PIP_NO_PYTHON_VERSION_WARNING: '1' - PYTHON_LATEST: '3.11' + FORCE_COLOR: '1' # Make tools pretty. + TOX_TESTENV_PASSENV: FORCE_COLOR + PIP_DISABLE_PIP_VERSION_CHECK: '1' + PIP_NO_PYTHON_VERSION_WARNING: '1' + PYTHON_LATEST: '3.11' permissions: - contents: read # to fetch code (actions/checkout) + contents: read # to fetch code (actions/checkout) jobs: - test-sqlite: - runs-on: ubuntu-latest - strategy: - matrix: - python: ['3.10', '3.11', '3.12'] - database: ['sqlite'] + test-sqlite: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.10', '3.11', '3.12'] + database: ['sqlite'] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install tox tox-gh-actions - - name: Test with tox - run: tox -- -v1 - env: - DATABASE: sqlite + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + - name: Test with tox + run: tox -- -v1 + env: + DATABASE: sqlite - test-postgres: - runs-on: ubuntu-latest - strategy: - matrix: - python: ['3.8', '3.9', '3.10', '3.11', '3.12'] - database: ['postgres'] + test-postgres: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] + database: ['postgres'] - services: - postgres: - image: bitnami/postgresql:15 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres - POSTGRESQL_PASSWORD: postgres - POSTGRESQL_FSYNC: 'off' - POSTGRESQL_DATA_DIR: /dev/shm/pgdata - ports: - - 5432:5432 - options: --health-cmd "pg_isready -d postgres -U postgres -p 5432" --health-interval 10s --health-timeout 5s --health-retries 5 + services: + postgres: + image: bitnami/postgresql:15 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + POSTGRESQL_PASSWORD: postgres + POSTGRESQL_FSYNC: 'off' + POSTGRESQL_DATA_DIR: /dev/shm/pgdata + ports: + - 5432:5432 + options: --health-cmd "pg_isready -d postgres -U postgres -p 5432" --health-interval 10s --health-timeout 5s --health-retries 5 - steps: - - name: Checkout repository - uses: actions/checkout@v4 + steps: + - name: Checkout repository + uses: actions/checkout@v4 - - name: Set up Python - id: setup-python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} + - name: Set up Python + id: setup-python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} - - name: Install dependencies - id: install-dependencies - run: | - python -m pip install --upgrade pip tox tox-gh-actions - - name: Test with tox - run: tox -- -v1 - env: - DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres - DATABASE: postgres + - name: Install dependencies + id: install-dependencies + run: | + python -m pip install --upgrade pip tox tox-gh-actions + - name: Test with tox + run: tox -- -v1 + env: + DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres + DATABASE: postgres - coverage: - runs-on: ubuntu-latest - needs: - - test-sqlite - - test-postgres - strategy: - matrix: - python: ['3.11'] + coverage: + runs-on: ubuntu-latest + needs: + - test-sqlite + - test-postgres + strategy: + matrix: + python: ['3.11'] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: | - python -Im pip install -U flit - python -Im pip install "coverage>=7.0,<8.0" - flit install --deps production --extras testing - - name: Test - run: | - coverage run testmanage.py test - - name: 'Upload coverage to Codecov' - uses: codecov/codecov-action@v3 - with: - fail_ci_if_error: true + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + python -Im pip install -U flit + python -Im pip install "coverage>=7.0,<8.0" + flit install --deps production --extras testing + - name: Test + run: | + coverage run testmanage.py test + - name: 'Upload coverage to Codecov' + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: true diff --git a/docs/concept/content-paths.md b/docs/concept/content-paths.md index e4261580c..d6c726988 100644 --- a/docs/concept/content-paths.md +++ b/docs/concept/content-paths.md @@ -2,8 +2,8 @@ Content paths are used by Wagtail Localize to reference a field within a page or snippet. They are needed for two purposes: -- They are generated whenever Wagtail Localize extracts segments from an object to provide an address for inserting the translations later on -- They are used in the `msgctxt` field in PO files to allow the same source string to be translated differently for different fields +- They are generated whenever Wagtail Localize extracts segments from an object to provide an address for inserting the translations later on +- They are used in the `msgctxt` field in PO files to allow the same source string to be translated differently for different fields This document describes how content paths are generated. diff --git a/docs/concept/segments.md b/docs/concept/segments.md index 48818d47b..fa4adc10b 100644 --- a/docs/concept/segments.md +++ b/docs/concept/segments.md @@ -52,9 +52,9 @@ string segments need to be inserted. If you combined the above template with the following string segments: -- `The Heading` -- `A paragraph with some Bold text` -- `A list item` +- `The Heading` +- `A paragraph with some Bold text` +- `A list item` This would produce the following rich text value: diff --git a/docs/concept/translatable-fields-autogen.md b/docs/concept/translatable-fields-autogen.md index 4f7033a2f..b589d9ca7 100644 --- a/docs/concept/translatable-fields-autogen.md +++ b/docs/concept/translatable-fields-autogen.md @@ -13,18 +13,18 @@ The first step is to loop through all fields defined on the model. This is done The following are excluded: -- Auto fields, such as `id` -- Any field with `editable=False` -- `ManyToManyField` and `ParentalKey` -- Parent link fields, such as `page_ptr` -- Inherited `MP_Node` fields named `path`, `depth`, and `numchild` -- Inherited `Page` fields named `go_live_at`, `expire_at`, `first_published_at`, `content_type` and `owner` +- Auto fields, such as `id` +- Any field with `editable=False` +- `ManyToManyField` and `ParentalKey` +- Parent link fields, such as `page_ptr` +- Inherited `MP_Node` fields named `path`, `depth`, and `numchild` +- Inherited `Page` fields named `go_live_at`, `expire_at`, `first_published_at`, `content_type` and `owner` Next, we look at text fields. All text fields (including `RichTextField` and `StreamField`) are set to translatable, except for the following which are set to synchronised: -- `URLField` and `EmailField` -- `CharField` with `choices` set +- `URLField` and `EmailField` +- `CharField` with `choices` set `ForeignKey` and `OneToOneField` fields are set to translatable if the referenced model inherits from `TranslatableMixin`, otherwise they are set to synchronised. diff --git a/docs/how-to/integrations/pontoon.md b/docs/how-to/integrations/pontoon.md index 6eab45dc7..2a698cae1 100644 --- a/docs/how-to/integrations/pontoon.md +++ b/docs/how-to/integrations/pontoon.md @@ -26,8 +26,8 @@ It will prompt for a password, leave that blank. Now you need to create a git repo for the PO files to live in. You can use any host for this you like as long as it: -- Is accessible over the network from both Pontoon and Wagtail -- Supports deploy keys that can write to the repository (Both GitHub and Gitlab support this) +- Is accessible over the network from both Pontoon and Wagtail +- Supports deploy keys that can write to the repository (Both GitHub and Gitlab support this) Note that you do not need to make your repo public as both Pontoon and Wagtail Localize can authenticate using a deploy key. @@ -72,13 +72,13 @@ use it. There are instructions on how to do this on Heroku at the end of this gu On your Wagtail server, you'll need to set two Django settings: -- `WAGTAILLOCALIZE_GIT_URL` should be set to the SSH git clone URL of your repository +- `WAGTAILLOCALIZE_GIT_URL` should be set to the SSH git clone URL of your repository -- `WAGTAILLOCALIZE_GIT_CLONE_DIR` needs to be set to a directory that Wagtail Localize can clone the git repository into. +- `WAGTAILLOCALIZE_GIT_CLONE_DIR` needs to be set to a directory that Wagtail Localize can clone the git repository into. - If you're running on an ephermeral file system (such as on Heroku), this can be pointed to a temporary directory. - Wagtail Localize will re-clone the repository if it's ever deleted. It keeps track of what the previous `HEAD` - commit was in the database so it will not lose track of anything if a deletion occurs. + If you're running on an ephermeral file system (such as on Heroku), this can be pointed to a temporary directory. + Wagtail Localize will re-clone the repository if it's ever deleted. It keeps track of what the previous `HEAD` + commit was in the database so it will not lose track of anything if a deletion occurs. For example: diff --git a/docs/tutorial/2-configure-wagtail-localize.md b/docs/tutorial/2-configure-wagtail-localize.md index 588ada186..6ca819d87 100644 --- a/docs/tutorial/2-configure-wagtail-localize.md +++ b/docs/tutorial/2-configure-wagtail-localize.md @@ -87,8 +87,8 @@ Open `tutorial/urls.py` in your text editor. You'll see that there are two group The patterns that need to be made translatable are: -- `path('search/', search_views.search, name='search'),` -- `path("", include(wagtail_urls)),` +- `path('search/', search_views.search, name='search'),` +- `path("", include(wagtail_urls)),` To make these translatable, move the 'search/' pattern into the second block, above the `wagtail_urls` pattern. Then, replace the square brakets around that block with diff --git a/docs/tutorial/3-content.md b/docs/tutorial/3-content.md index 108305203..11efb78cd 100644 --- a/docs/tutorial/3-content.md +++ b/docs/tutorial/3-content.md @@ -113,10 +113,10 @@ the following screenshot, and publish it. Then navigate to the new blog index page, click "Add child page" then click "Blog post page". Fill it in how you like, but make sure that you cover the following: -- Upload an image and add it to the "Image" field -- Create a "Blog Category" and select it in the "Category" field -- Add an item in the paragraph block, with some text and a couple of list items. Use some inline formatting - (bold, italic, etc) and add a link +- Upload an image and add it to the "Image" field +- Create a "Blog Category" and select it in the "Category" field +- Add an item in the paragraph block, with some text and a couple of list items. Use some inline formatting + (bold, italic, etc) and add a link ![Blog post page being edited in Wagtail](../assets/tutorial/wagtail-edit-source.png) diff --git a/docs/tutorial/4-templates.md b/docs/tutorial/4-templates.md index ff2427612..1bb567039 100644 --- a/docs/tutorial/4-templates.md +++ b/docs/tutorial/4-templates.md @@ -87,7 +87,7 @@ the currently active language which can be found with `Locale.get_active()`. To implement this, open up `search/views.py` in your favourite editor, then modify the following lines: -- Change the import line `from wagtail.models import Page` to `from wagtail.models import Page, Locale` -- Change the query `Page.objects.live().search(search_query)` to `Page.objects.live().filter(locale=Locale.get_active()).search(search_query)` +- Change the import line `from wagtail.models import Page` to `from wagtail.models import Page, Locale` +- Change the query `Page.objects.live().search(search_query)` to `Page.objects.live().filter(locale=Locale.get_active()).search(search_query)` Refresh the search page in the browser, the results should now be filtered. diff --git a/wagtail_localize/static_src/common/components/DocumentChooser/index.tsx b/wagtail_localize/static_src/common/components/DocumentChooser/index.tsx index 5b7f883b2..86e20ff74 100644 --- a/wagtail_localize/static_src/common/components/DocumentChooser/index.tsx +++ b/wagtail_localize/static_src/common/components/DocumentChooser/index.tsx @@ -16,7 +16,7 @@ const DocumentChooser: FunctionComponent = ({ documentId, }) => { const [documentInfo, setDocumentInfo] = React.useState( - null + null, ); React.useEffect(() => { diff --git a/wagtail_localize/static_src/common/components/SnippetChooser/index.tsx b/wagtail_localize/static_src/common/components/SnippetChooser/index.tsx index 6a67564d6..2abf2246d 100644 --- a/wagtail_localize/static_src/common/components/SnippetChooser/index.tsx +++ b/wagtail_localize/static_src/common/components/SnippetChooser/index.tsx @@ -24,7 +24,7 @@ const SnippetChooser: FunctionComponent = ({ snippetId, }) => { const [snippetInfo, setSnippetInfo] = React.useState( - null + null, ); React.useEffect(() => { @@ -32,7 +32,7 @@ const SnippetChooser: FunctionComponent = ({ if (snippetId) { fetch( - `${adminBaseUrl}localize/api/snippets/${snippetModel.app_label}/${snippetModel.model_name}/${snippetId}/` + `${adminBaseUrl}localize/api/snippets/${snippetModel.app_label}/${snippetModel.model_name}/${snippetId}/`, ) .then((response) => response.json()) .then(setSnippetInfo); @@ -58,7 +58,7 @@ const SnippetChooser: FunctionComponent = ({ > {gettext('Edit this %s').replace( '%s', - snippetModel.verbose_name + snippetModel.verbose_name, )} @@ -70,7 +70,7 @@ const SnippetChooser: FunctionComponent = ({

{gettext('Fetching %s information...').replace( '%s', - snippetModel.verbose_name + snippetModel.verbose_name, )}

); @@ -86,7 +86,7 @@ const SnippetChooser: FunctionComponent = ({ > {gettext('Choose a %s').replace( '%s', - snippetModel.verbose_name + snippetModel.verbose_name, )} diff --git a/wagtail_localize/static_src/common/components/Tabs/index.tsx b/wagtail_localize/static_src/common/components/Tabs/index.tsx index 9f0de3dc8..cac6e633b 100644 --- a/wagtail_localize/static_src/common/components/Tabs/index.tsx +++ b/wagtail_localize/static_src/common/components/Tabs/index.tsx @@ -22,7 +22,7 @@ export const Tabs: FunctionComponent = ({ tabs, children }) => {
{tabs.map((tab) => { const onClick = ( - e: React.MouseEvent + e: React.MouseEvent, ) => { e.preventDefault(); setCurrentTab(tab.slug); diff --git a/wagtail_localize/static_src/component_form/main.tsx b/wagtail_localize/static_src/component_form/main.tsx index 78bc5793b..f0acc105d 100644 --- a/wagtail_localize/static_src/component_form/main.tsx +++ b/wagtail_localize/static_src/component_form/main.tsx @@ -11,7 +11,7 @@ document.addEventListener('DOMContentLoaded', () => { } const enableInput = componentForm.querySelector( - '.component-form__fieldname-enabled input' + '.component-form__fieldname-enabled input', ) as HTMLInputElement | null; if (enableInput) { enableInput.checked = isChecked; diff --git a/wagtail_localize/static_src/editor/components/TranslationEditor/footer.tsx b/wagtail_localize/static_src/editor/components/TranslationEditor/footer.tsx index 5649fb90d..d523c3b49 100644 --- a/wagtail_localize/static_src/editor/components/TranslationEditor/footer.tsx +++ b/wagtail_localize/static_src/editor/components/TranslationEditor/footer.tsx @@ -25,7 +25,7 @@ const EditorFooter: FunctionComponent = ({ data-controller="w-progress" data-action="w-progress#activate" data-w-progress-active-value={gettext( - 'Stopping Synced translation' + 'Stopping Synced translation', )} > @@ -47,7 +47,7 @@ const EditorFooter: FunctionComponent = ({ data-controller="w-progress" data-action="w-progress#activate" data-w-progress-active-value={gettext( - 'Converting to alias page' + 'Converting to alias page', )} > @@ -55,7 +55,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Convert to alias page')} - + , ); } @@ -64,7 +64,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Delete')} - + , ); } @@ -84,13 +84,13 @@ const EditorFooter: FunctionComponent = ({ data-controller="w-progress" data-action="w-progress#activate" data-w-progress-active-value={gettext( - 'Applying editor lock' + 'Applying editor lock', )} > {gettext('Lock')} - + , ); } @@ -110,13 +110,13 @@ const EditorFooter: FunctionComponent = ({ data-controller="w-progress" data-action="w-progress#activate" data-w-progress-active-value={gettext( - 'Removing editor lock' + 'Removing editor lock', )} > {gettext('Unlock')} - + , ); } @@ -125,7 +125,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Unpublish')} - + , ); } @@ -158,7 +158,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Publish in ') + locale.displayName} - + , ); } diff --git a/wagtail_localize/static_src/editor/components/TranslationEditor/index.tsx b/wagtail_localize/static_src/editor/components/TranslationEditor/index.tsx index b4beec77e..a6e62cd5e 100644 --- a/wagtail_localize/static_src/editor/components/TranslationEditor/index.tsx +++ b/wagtail_localize/static_src/editor/components/TranslationEditor/index.tsx @@ -231,7 +231,7 @@ const TranslationEditor: FunctionComponent = (props) => { if (state.editingSegments.size > 0) { const onUnload = (event: BeforeUnloadEvent) => { const confirmationMessage = gettext( - 'There are unsaved segments. Please save or cancel them before leaving.' + 'There are unsaved segments. Please save or cancel them before leaving.', ); // eslint-disable-next-line no-param-reassign @@ -249,17 +249,17 @@ const TranslationEditor: FunctionComponent = (props) => { const tabData = props.tabs .map((tab) => { const segments = props.segments.filter( - (segment) => segment.location.tab == tab.slug + (segment) => segment.location.tab == tab.slug, ); const translations = segments.map( (segment) => segment.type == 'string' && - state.stringTranslations.get(segment.id) + state.stringTranslations.get(segment.id), ); return { numErrors: translations.filter( - (translation) => translation && translation.isErrored + (translation) => translation && translation.isErrored, ).length, segments, ...tab, diff --git a/wagtail_localize/static_src/editor/components/TranslationEditor/legacy-footer.tsx b/wagtail_localize/static_src/editor/components/TranslationEditor/legacy-footer.tsx index cf3440585..70ce5c76a 100644 --- a/wagtail_localize/static_src/editor/components/TranslationEditor/legacy-footer.tsx +++ b/wagtail_localize/static_src/editor/components/TranslationEditor/legacy-footer.tsx @@ -43,7 +43,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Convert to alias page')} - + , ); } @@ -52,7 +52,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Delete')} - + , ); } @@ -74,7 +74,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Lock')} - + , ); } @@ -96,7 +96,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Unlock')} - + , ); } @@ -105,7 +105,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Unpublish')} - + , ); } @@ -136,7 +136,7 @@ const EditorFooter: FunctionComponent = ({ {gettext('Publish in ') + locale.displayName} - + , ); } diff --git a/wagtail_localize/static_src/editor/components/TranslationEditor/reducer.ts b/wagtail_localize/static_src/editor/components/TranslationEditor/reducer.ts index d7cc3729b..e682a1909 100644 --- a/wagtail_localize/static_src/editor/components/TranslationEditor/reducer.ts +++ b/wagtail_localize/static_src/editor/components/TranslationEditor/reducer.ts @@ -143,7 +143,7 @@ export function reducer(state: EditorState, action: EditorAction) { isSaving: false, isErrored: true, comment: gettext('Server error'), - }) + }), ); } break; @@ -168,7 +168,7 @@ export function reducer(state: EditorState, action: EditorAction) { action.segmentId, Object.assign({}, override, { isSaving: true, - }) + }), ); } break; @@ -194,7 +194,7 @@ export function reducer(state: EditorState, action: EditorAction) { action.segmentId, Object.assign({}, override, { isSaving: false, - }) + }), ); } break; diff --git a/wagtail_localize/static_src/editor/components/TranslationEditor/segments.tsx b/wagtail_localize/static_src/editor/components/TranslationEditor/segments.tsx index 0d243e452..ee7a22e58 100644 --- a/wagtail_localize/static_src/editor/components/TranslationEditor/segments.tsx +++ b/wagtail_localize/static_src/editor/components/TranslationEditor/segments.tsx @@ -40,7 +40,7 @@ function saveTranslation( segment: StringSegment, value: string, csrfToken: string, - dispatch: React.Dispatch + dispatch: React.Dispatch, ) { dispatch({ type: EDIT_STRING_TRANSLATION, @@ -108,7 +108,7 @@ function saveOverride( segment: SynchronisedValueSegment, value: any, csrfToken: string, - dispatch: React.Dispatch + dispatch: React.Dispatch, ) { dispatch({ type: EDIT_OVERRIDE, @@ -153,7 +153,7 @@ function saveOverride( function deleteOverride( segment: SynchronisedValueSegment, csrfToken: string, - dispatch: React.Dispatch + dispatch: React.Dispatch, ) { dispatch({ type: DELETE_OVERRIDE, @@ -416,7 +416,7 @@ const EditorStringSegment: FunctionComponent = ({ csrfToken, }) => { const [editingValue, setEditingValue] = React.useState( - (translation && translation.value) || '' + (translation && translation.value) || '', ); let comment = <>; @@ -501,7 +501,7 @@ const EditorStringSegment: FunctionComponent = ({ {translation ? gettext('Edit') : gettext('Translate')} - + , ); } @@ -584,7 +584,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< <> {gettext('Uses %s version').replace( '%s', - sourceLocale.displayName + sourceLocale.displayName, )}{' '} @@ -594,7 +594,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< const widget = segment.location.widget; if (widget.type == 'text') { const [editingValue, setEditingValue] = React.useState( - (override && override.value) || segment.value + (override && override.value) || segment.value, ); if (isEditing && !isLocked) { @@ -634,7 +634,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< buttons.push( {gettext('Edit')} - + , ); } @@ -659,7 +659,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< buttons.push( {gettext('Change page')} - + , ); } @@ -680,7 +680,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< segment, imageData.id, csrfToken, - dispatch + dispatch, ); }, }, @@ -690,7 +690,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< buttons.push( {gettext('Change image')} - + , ); } @@ -711,7 +711,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< segment, documentData.id, csrfToken, - dispatch + dispatch, ); }, }, @@ -721,7 +721,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< buttons.push( {gettext('Change document')} - + , ); } @@ -742,7 +742,7 @@ const EditorSynchronisedValueSegment: FunctionComponent< segment, snippetData.id, csrfToken, - dispatch + dispatch, ); }, }, @@ -753,9 +753,9 @@ const EditorSynchronisedValueSegment: FunctionComponent< {gettext('Change %s').replace( '%s', - widget.snippet_model.verbose_name + widget.snippet_model.verbose_name, )} - + , ); } @@ -778,9 +778,9 @@ const EditorSynchronisedValueSegment: FunctionComponent< {gettext('Revert to %s version').replace( '%s', - sourceLocale.displayName + sourceLocale.displayName, )} - + , ); } @@ -983,7 +983,7 @@ const EditorSegmentList: FunctionComponent = ({ {segmentsRendered} ); - } + }, ); return {segmentRendered}; diff --git a/wagtail_localize/static_src/editor/components/TranslationEditor/toolbox.tsx b/wagtail_localize/static_src/editor/components/TranslationEditor/toolbox.tsx index 9397e137e..67ebab2e4 100644 --- a/wagtail_localize/static_src/editor/components/TranslationEditor/toolbox.tsx +++ b/wagtail_localize/static_src/editor/components/TranslationEditor/toolbox.tsx @@ -95,7 +95,7 @@ const EditorToolbox: FunctionComponent = ({

{gettext( - 'Upload translated PO file to submit translations' + 'Upload translated PO file to submit translations', )}