Please see the IATI Sphinx Theme Documentation for usage instructions.
pip install -r requirements_dev.txt
python -m piptools compile --extra=dev -o requirements_dev.txt pyproject.toml
pip install -r requirements_dev.txt
black iati_sphinx_theme/ docs/
isort iati_sphinx_theme/ docs/
flake8 iati_sphinx_theme/ docs/
mypy iati_sphinx_theme/ docs/
-
In one terminal, build the CSS in watch mode
npm run build:watch
-
In a separate terminal, install the Sphinx theme then start the docs development server:
pip install -e . sphinx-autobuild -a docs docs/_build/html --watch iati_sphinx_theme/
To run a local version of the theme with another project, e.g. my-docs
, take the following steps:
-
Clone the
sphinx-theme
repository, and checkout the branch or tag you want to use. -
Run the following command in the
sphinx-theme
directory, to build the CSS for the theme.npm run build
-
Go to
my-docs
directory, and install the Sphinx themepip install -e /path/to/sphinx-theme
-
Set the
html_theme
option in yourconf.py
html_theme = "iati_sphinx_theme"
-
Start the docs development server:
pip install sphinx-autobuild sphinx-autobuild docs docs/_build/html
Follow the steps below to translate the theme's built-in strings from the HTML templates in the iati_sphinx_theme
directory.
The message catalog name is sphinx.[pot|po|mo]
and is found in the iati_sphinx_theme/locale
directory.
These are bundled with the published theme in order for consumers to have access to the translations.
A Makefile
exists to make running the commands easier:
-
Extract text into
.pot
filesmake extract
-
Update existing
.po
files based on.pot
filesmake update
-
Optionally, initialise a
.po
file for a new languagemake init lang=es
-
Add translations to the
.po
files -
Compile to
.mo
files (only applies to the theme's built-in strings, so that they can be bundled with the theme)make compile