diff --git a/.env.example b/.env.example index 51d9a8062..75311d6f8 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ # Allows to only build the default language of the documentation for faster development -DEFAULT_LANGUAGE_ONLY=false +BUILD_ONLY_LOCALE="en" diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index ed5b0cb2e..d3b6509a2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -79,8 +79,6 @@ jobs: - name: Build documentation run: mkdocs build - env: - DEFAULT_LANGUAGE_ONLY: false - uses: actions/upload-artifact@v4 if: ${{ github.event_name == 'pull_request' }} diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 7e5405e17..ac32623c6 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -32,4 +32,4 @@ jobs: - name: Build documentation run: mkdocs build env: - DEFAULT_LANGUAGE_ONLY: true + BUILD_ONLY_LOCALE: "en" diff --git a/Dockerfile b/Dockerfile index 1c3f04b13..1dba832d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,6 @@ RUN curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | # Token pass through for docker build --build-arg ... ARG tx_token ENV TX_TOKEN $tx_token -ENV DEFAULT_LANGUAGE_ONLY false # Setting up and fetch translations the docs RUN ./tx add --project qfield-documentation --file-filter 'documentation/./.' remote https://www.transifex.com/opengisch/qfield-documentation/dashboard/ && \ diff --git a/README.md b/README.md index 5cc72af19..a5bc62c42 100644 --- a/README.md +++ b/README.md @@ -110,14 +110,19 @@ The `tx_slug` identifies the resource on Transifex. It should *not* be changed i #### Testing your changes (on your local machine) ```sh +cp .env.example .env pipenv install -r requirements.txt pipenv run mkdocs serve ``` The local doc will be available at http://localhost:8000. +This will build the pages only in English. +If you want to see the site in all the translations, in `.env` file set `BUILD_ONLY_LOCALE=""` to empty. + + #### Contribute -Before commiting, install [pre-commit](https://pre-commit.com/) to auto-format your contributions. You can install pre-commit for the current user with +Before committing, install [pre-commit](https://pre-commit.com/) to auto-format your contributions. You can install pre-commit for the current user with pip install --user pre-commit pre-commit install @@ -150,14 +155,14 @@ request](https://help.github.com/articles/using-pull-requests/). ### Translation process -*Note: You will need to have a [transifex account](https://transifex.com/) for this.* +*Note: You will need to have a [Transifex account](https://transifex.com/) for this.* -Navigate to our [transifex +Navigate to our [Transifex project](https://www.transifex.com/organization/opengisch/dashboard/qfield-documentation) and click on the language you would like to translate. You will see a link `Join Team`. Click it and wait for approval (you will receive an email). -Once you receive the email you can head back to the transifex project page, +Once you receive the email you can head back to the Transifex project page, click on your language again and then will have the possibility to choose a documentation chapter to translate. There is a `Translate` button after choosing a chapter. diff --git a/mkdocs.yml b/mkdocs.yml index 28a92e306..bec038aaf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -171,7 +171,7 @@ plugins: background_color: "#72ad2e" color: "#FFFFFF" - i18n: - default_language_only: !ENV [DEFAULT_LANGUAGE_ONLY, true] + build_only_locale: !ENV [BUILD_ONLY_LOCALE] # FIX ME: Add autodetection to translation rates so that only languages # with >30% translations are built. See https://www.transifex.com/opengisch/qfield-documentation/dashboard/ languages: