Skip to content

Commit

Permalink
Merge pull request #507 from opengisch/build_only_locale
Browse files Browse the repository at this point in the history
Allow building the docs for single language
  • Loading branch information
suricactus authored Oct 10, 2024
2 parents b44df7e + 8f84f20 commit 8758f7d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 0 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
- name: Build documentation
run: mkdocs build
env:
DEFAULT_LANGUAGE_ONLY: true
BUILD_ONLY_LOCALE: "en"
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/<project_slug>.<resource_slug>/<lang>.<ext>' remote https://www.transifex.com/opengisch/qfield-documentation/dashboard/ && \
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. <!-- markdown-link-check-disable-line -->

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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,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:
Expand Down

0 comments on commit 8758f7d

Please sign in to comment.