Commencer à contribuer au code de Weblate¶
Comprenez le code source de Weblate en lisant Code source de Weblate, Interface de Weblate et Weblate internals.
Starting with the codebase¶
Familiarisez-vous avec la base de code de Weblate en allant voir les bogues étiquetés good first issue.
Vous êtes le bienvenu pour commencer à travailler sur ces problèmes sans demander d’autorisation. Faites-en simplement l’annonce dans le rapport afin que l’on sache que quelqu’un a pris en charge le sujet.
Activer Weblate localement¶
The most comfortable approach to get started with Weblate development is to follow Installation en cours à partir des sources.. It will get you a virtualenv with editable Weblate sources.
Clone the Weblate source code:
git clone https://github.com/WeblateOrg/weblate.git cd weblate
Create a virtualenv:
uv venv .venv source .venv/bin/activate
Install Weblate (for this you need some system dependencies, see Installation en cours à partir des sources.) and all dependencies useful for development:
uv pip install -e '.[dev]'
Démarrer un serveur de développement :
weblate runserver
En fonction de votre configuration vous pourrez aussi démarrer les services Celery :
./weblate/examples/celery start
Pour exécuter un test (voir Local testing pour plus d’informations) :
. scripts/test-database.sh pytest
Voir aussi
Exécuter Weblate localement dans Docker¶
If you have Docker and the docker-compose-plugin installed, you need an additional tool
called jq
which you can install through your favorite package manager. Then, you can
spin up the development environment by simply running:
./rundev.sh
Cela va créer et démarrer une image Docker de développement. Weblate s’exécute sur <http://127.0.0.1:8080/> et vous pouvez vous connecter en tant qu’utilisateur admin
avec le mot de passe admin
. La nouvelle installation est vide donc vous pourrez continuer avec Ajouter des projets et des composant de traduction.
The Dockerfile
and docker-compose.yml
for this are located in the
dev-docker
directory. For easier access to the database during development,
the container running PostgreSQL is exposed on port 5433
.
Le script accepte aussi certains paramètres, pour exécuter les tests utilisez le paramètre test
et spécifiez les paramètres test
s’il y en a, par exemple pour ne faire que les tests du module weblate.machine
:
./rundev.sh test --exitfirst weblate/machine
Note
Faites attention à ce que vos conteneurs Docker soient activés et qu’ils s’exécutent avant d’exécuter les tests. Vous pouvez vérifier cela en exécutant la commande docker ps
.
Pour afficher les journaux :
./rundev.sh logs
Pour arrêter les conteneurs en tâche de fond, exécutez :
./rundev.sh stop
Si vous exécutez le script sans argument il va recréer et redémarrer le conteneur Docker.
Avertissement
This container is not suitable for production use. Security is sacrificed to make the development easier.
Bootstrapper votre instance de développement¶
You might want to use import_demo
to create demo translations and
createadmin
to make an admin user.
Coding Weblate with PyCharm¶
PyCharm is a known IDE for Python, here are some guidelines to help you set up your Weblate project in it.
Considering you have just cloned the GitHub repository to a folder, just open it with PyCharm. Once the IDE is open, the first step is to specify the interpreter you want to use:

You can either choose to let PyCharm create the virtualenv for you, or select an already existing one:

Don’t forget to install the dependencies once the interpreter is set: Either through the console (the console from the IDE will directly use your virtualenv by default), or through the interface when you get a warning about missing dependencies.
The second step is to set the right info to use Django natively inside PyCharm: The idea is to be able to immediately trigger the unit tests in the IDE. For that you need to specify the root path of the Django project and the path to its settings:

Be careful, the Django project root is the actual root of the repository, not the Weblate
sub-directory. About the settings, you could use the weblate/settings_test.py
from the
repository, but you could create your own setting and set it there.
The last step is to run the server and to put breakpoints in the code to be able to debug it. This is done by creating a new Django Server configuration:


Indication
Be careful with the property called No reload: It prevents the server from being reloaded live if you modify files. This allows the existing debugger breakpoints to persist, when they normally would be discarded upon reloading the server.