Dostosowywanie Weblate

Extend and customize using Django and Python. Contribute your changes upstream so that everybody can benefit. This reduces your maintenance costs; code in Weblate is taken care of when changing internal interfaces or refactoring the code.


Neither internal interfaces nor templates are considered a stable API. Please review your own customizations for every upgrade, the interfaces or their semantics might change without notice.

Tworzenie modułu Pythona

If you are not familiar with Python, you might want to look into Python For Beginners, explaining the basics and pointing to further tutorials.

To write a file with custom Python code (called a module), a place to store it is needed, either in the system path (usually something like /usr/lib/python3.9/site-packages/) or in the Weblate directory, which is also added to the interpreter search path.

Nowe w wersji 3.8-5: When using Docker, you can place Python modules in /app/data/python/ (see Woluminy kontenerów platformy Docker), so they can be loaded by Weblate, for example from a settings override file.

Better yet, turn your customization into a proper Python package:

  1. Create a folder for your package (we will use weblate_customization).

  2. Within it, create a file to describe the package:

    from setuptools import setup
        author="Your name",
        description="Sample Custom check for Weblate.",
        keywords="Weblate check example",
  3. Create a folder for the Python module (also called weblate_customization) for the customization code.

  4. Within it, create a file to make sure Python can import the module.

  5. This package can now be installed using pip install -e. More info to be found in Editable installs.

  6. Once installed, the module can be used in the Weblate configuration (for example weblate_customization.checks.FooCheck).

Your package structure should look like this:

└── weblate_customization

You can find an example of customizing Weblate at <>, it covers all the topics described below.

Custom quality checks, add-ons and auto-fixes

To install your code for Niestandardowe automatyczne korekty, Pisanie własnych kontroli or Pisanie dodatku in Weblate:

  1. Place the files into your Python module containing the Weblate customization (see Tworzenie modułu Pythona).

  2. Add its fully-qualified path to the Python class in the dedicated settings (WEBLATE_ADDONS, CHECK_LIST or AUTOFIX_LIST):

# Checks
CHECK_LIST += ("weblate_customization.checks.FooCheck",)

# Autofixes
AUTOFIX_LIST += ("weblate_customization.autofix.FooFixer",)

# Add-ons
WEBLATE_ADDONS += ("weblate_customization.addons.ExamplePreAddon",)