English | Русский |
First of all, thank you for your desire to contribute in that project.
You will need to install the following tools to work with the project:
- Python 3.11 or higher: Required for project dependencies and scripts (uses tomllib module available since Python 3.11)
- Docker: Required for building and running containers
- Docker Compose: Required for building and running containers
- make: Required to run Makefile targets
- uv: Package manager and project manager for Python
Installing make and uv:
sudo apt update
sudo apt install make
sudo apt install python3-pip
pip install uv
Internationalization is implemented using Django i18n.
The project supports two languages: English and Russian.
Translation files are located at src/imgtests/web/locale/. The .po files contain the actual translations, and .mo files (compiled binaries) are generated during the Docker build.
In Django templates, wrap translatable strings with {% translate %} for simple strings and {% blocktranslate %} for strings with variables:
{% load i18n %}
{% translate "Test Dashboard" %}
{% blocktranslate %}Size: {{ report.size|filesizeformat }}{% endblocktranslate %}
After adding or modifying {% translate %} tags, regenerate the .po files:
cd src/imgtests/web
django-admin makemessages -l ru
django-admin makemessages -d djangojs -l ruThen edit the .po file and fill in the msgstr fields.
- Add the language code to the
LANGUAGESlist insettings.py(src/imgtests/web/tests/settings.py). - Generate a
.pofile:cd src/imgtests/web django-admin makemessages -l <language_code>
- Translate the strings in the created
.pofile.
During Docker build, .mo files are compiled using msgfmt. The .mo files are not stored in git - they are generated while building Docker image.
Checks all the repository files using pre-commit hooks described in the .pre-commit-config.yaml file:
make pre-commit-check
Runs all unit tests in the tests/unit and tests/misc directories:
make unit-test
The unit test configuration is described within pyproject.toml file. The testing files and functions begin with the test_ prefix.