Coverage for app/venv/lib/python3.14/site-packages/weblate/addons/example_pre.py: 0%

12 statements  

« 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 

4 

5"""Example pre commit script.""" 

6 

7from __future__ import annotations 

8 

9from typing import ClassVar 

10 

11from django.utils.translation import gettext_lazy 

12 

13from weblate.addons.events import AddonEvent 

14from weblate.addons.scripts import BaseScriptAddon 

15 

16 

17class ExamplePreAddon(BaseScriptAddon): 

18 # Event used to trigger the script 

19 events: ClassVar[set[AddonEvent]] = { 

20 AddonEvent.EVENT_PRE_COMMIT, 

21 } 

22 # Name of the addon, has to be unique 

23 name = "weblate.example.pre" 

24 # Verbose name and long description 

25 verbose = gettext_lazy("Execute script before commit") 

26 description = gettext_lazy("This add-on executes a script.") 

27 

28 # Script to execute 

29 script = "/bin/true" 

30 # File to add in commit (for pre commit event) 

31 # does not have to be set 

32 add_file = "po/{{ language_code }}.po"