Coverage for app/venv/lib/python3.14/site-packages/weblate/addons/example.py: 0%
15 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
1# Copyright © Michal Čihař <michal@weblate.org>
2#
3# SPDX-License-Identifier: GPL-3.0-or-later
5from __future__ import annotations
7from typing import TYPE_CHECKING, ClassVar
9from django.utils.translation import gettext_lazy
11from weblate.addons.base import BaseAddon
12from weblate.addons.events import AddonEvent
14if TYPE_CHECKING:
15 from weblate.addons.base import CompatDict
18class ExampleAddon(BaseAddon):
19 # Filter for compatible components, every key is
20 # matched against property of component
21 compat: ClassVar[CompatDict] = {
22 "file_format": {"po", "po-mono"},
23 }
24 # List of events add-on should receive
25 events: ClassVar[set[AddonEvent]] = {
26 AddonEvent.EVENT_PRE_COMMIT,
27 }
28 # Add-on unique identifier
29 name = "weblate.example.example"
30 # Verbose name shown in the user interface
31 verbose = gettext_lazy("Example add-on")
32 # Detailed add-on description
33 description = gettext_lazy("This add-on does nothing it is just an example.")
35 # Callback to implement custom behavior
36 def pre_commit(
37 self,
38 translation,
39 author: str,
40 store_hash: bool,
41 activity_log_id: int | None = None,
42 ) -> None:
43 return