Desarrollo de complementos

Complementos are way to customize localization workflow in Weblate.

class weblate.addons.base.BaseAddon(storage=None)
classmethod can_install(component, user)

Check whether addon is compatible with given component.


Save configuration.


Actuador desencadenado diariamente.

classmethod get_add_form(user, component, **kwargs)

Return configuration form for adding new addon.

get_settings_form(user, **kwargs)

Return configuration form for this addon.


Actuador desencadenado tras añadirse una traducción nueva.


Actuador desencadenado tras consignarse cambios en el repositorio.


Actuador desencadenado tras enviar el repositorio a la ubicación del proyecto originario.

post_update(component, previous_head: str, skip_push: bool)

Actuador desencadenado tras actualizarse el repositorio desde el origen.

  • previous_head (str) – «HEAD» del repositorio antes de la actualización; puede estar vacía durante la clonación inicial.

  • skip_push (bool) – Whether the addon operation should skip pushing changes upstream. Usually you can pass this to underlying methods as commit_and_push or commit_pending.

pre_commit(translation, author)

Hook triggered before changes are committed to the repository.


Hook triggered before repository is pushed upstream.


Hook triggered before repository is updated from upstream.


Save addon state information.

stay_on_create = False

Clase de base para complementos de Weblate.

store_post_load(translation, store)

Actuador desencadenado tras procesar un archivo.

It receives an instance of a file format class as a argument.

This is useful to modify file format class parameters, for example adjust how the file will be saved.


Actuador desencadenado antes de crearse una unidad nueva.

He aquí un complemento de ejemplo:

# Copyright © 2012 - 2021 Michal Čihař <>
# This file is part of Weblate <>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <>.

from django.utils.translation import gettext_lazy as _

from weblate.addons.base import BaseAddon
from import EVENT_PRE_COMMIT

class ExampleAddon(BaseAddon):
    # Filter for compatible components, every key is
    # matched against property of component
    compat = {"file_format": {"po", "po-mono"}}
    # List of events addon should receive
    events = (EVENT_PRE_COMMIT,)
    # Addon unique identifier
    name = "weblate.example.example"
    # Verbose name shown in the user interface
    verbose = _("Example addon")
    # Detailed addon description
    description = _("This addon does nothing it is just an example.")

    # Callback to implement custom behavior
    def pre_commit(self, translation, author):