# Personalizarea Weblate

Extindeți și personalizați folosind Django și Python. Contribuiți la modificările dvs. în amonte, astfel încât toată lumea să poată beneficia. Acest lucru vă reduce costurile de întreținere; codul din Weblate este luat în grijă atunci când modificați interfețele interne sau refactorizați codul.

#### HINT
You can also customize Weblate look in [Appearance customization](https://docs.weblate.org/ro/latest/admin/admin.md#manage-appearance).

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

#### SEE ALSO
[Contribuția la Weblate](https://docs.weblate.org/ro/latest/contributing/index.md#contributing)

<a id="custom-module"></a>

## Crearea unui modul Python

Dacă nu sunteți familiarizat cu Python, ar fi bine să consultați [Python pentru începători](https://www.python.org/about/gettingstarted/), care explică elementele de bază și indică alte tutoriale.

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.12/site-packages/`) or in the Weblate directory, which
is also added to the interpreter search path.

#### HINT
When [using Docker](https://docs.weblate.org/ro/latest/admin/install/docker.md#docker-deploy), you can place Python modules in
`/app/data/python/` (see [Volumele containerelor Docker](https://docs.weblate.org/ro/latest/admin/install/docker.md#docker-volume)), so they can be loaded
by Weblate, for example from a [settings override file](https://docs.weblate.org/ro/latest/admin/install/docker.md#docker-settings-override).

Mai bine, transformați-vă personalizarea într-un pachet Python propriu-zis:

1. Creați un folder pentru pachetul dumneavoastră (vom folosi weblate_customization).
2. Within it, create a `pyproject.toml` file to describe the package:
   ```toml
   [build-system]
   requires = ["uv_build>=0.8.18,<0.9.0"]
   build-backend = "uv_build"

   [project]
   name = "weblate-customization"
   version = "0.1.0"
   description = "Add your description here"
   requires-python = ">=3.13"
   dependencies = []
   ```
3. Create a folder for the Python module: `src/weblate_customization`
4. În cadrul acestuia, creați un fișier `__init__.py` pentru a vă asigura că Python poate importa modulul.
5. This package can now be installed using **uv pip install -e**. More info to be found in [Editable packages documentation](https://docs.astral.sh/uv/pip/packages/#editable-packages).
6. Odată instalat, modulul poate fi utilizat în configurația Weblate (de exemplu `weblate_customization.checks.FooCheck`).

Your package structure should look like this:

```text
weblate_customization
├── pyproject.toml
└── src
    └── weblate_customization
        ├── __init__.py
        ├── addons.py
        └── checks.py
```

Puteți găsi un exemplu de personalizare a Weblate la <[https://github.com/WeblateOrg/customize-example](https://github.com/WeblateOrg/customize-example)>, care acoperă toate subiectele descrise mai jos.

## Schimbarea logo-ului

1. Creați o aplicație Django simplă care să conțină fișierele statice pe care doriți să le suprascrieți (a se vedea [Crearea unui modul Python](#custom-module)).

   Brandingul apare în următoarele fișiere:

   `icons/weblate.svg`
   : Logo afișat în bara de navigare.

   `logo-*.png`
   : Pictogramele web depind de rezoluția ecranului și de browserul web.

   `favicon.ico`
   : Pictograma web utilizată de browserele vechi.

   `weblate-*.png`
   : Avataruri pentru roboți sau utilizatori anonimi. Unele browsere web le folosesc ca pictograme de scurtătură.

   `email-logo.png`
   : Folosit în e-mailurile de notificare.
2. Adăugați-l la [`INSTALLED_APPS`](https://docs.djangoproject.com/en/stable/ref/settings/#std-setting-INSTALLED_APPS):
   ```python
   INSTALLED_APPS = (
       # Add your customization as first
       "weblate_customization",
       # Weblate apps are here…
   )
   ```
3. Rulați `weblate collectstatic --noinput`, pentru a colecta fișierele statice servite clienților.

#### SEE ALSO
* [How to manage static files (e.g. images, JavaScript, CSS)](https://docs.djangoproject.com/en/stable/howto/static-files/)
* [Servirea fișierelor statice](https://docs.weblate.org/ro/latest/admin/install.md#static-files)

<a id="custom-addon-modules"></a>

<a id="custom-check-modules"></a>

<a id="custom-modules"></a>

## Custom quality checks, add-ons, translation services and auto-fixes

To install your code for [Reparații automate personalizate](https://docs.weblate.org/ro/latest/admin/checks.md#custom-autofix), [Întocmirea propriilor cecuri](https://docs.weblate.org/ro/latest/admin/checks.md#own-checks),
[Traducere automată personalizată](https://docs.weblate.org/ro/latest/admin/machine.md#custom-machinery) or [Add-on de scriere](https://docs.weblate.org/ro/latest/admin/addons.md#own-addon) in Weblate:

1. Place the files into your Python module containing the Weblate customization
   (see [Crearea unui modul Python](#custom-module) or [Customizing code](https://docs.weblate.org/ro/latest/admin/install/docker.md#docker-python-override)).
2. Add its fully-qualified path to the Python class in the dedicated settings:
   * [`WEBLATE_ADDONS`](https://docs.weblate.org/ro/latest/admin/config.md#std-setting-WEBLATE_ADDONS)
   * [`CHECK_LIST`](https://docs.weblate.org/ro/latest/admin/config.md#std-setting-CHECK_LIST)
   * [`WEBLATE_MACHINERY`](https://docs.weblate.org/ro/latest/admin/config.md#std-setting-WEBLATE_MACHINERY)
   * [`AUTOFIX_LIST`](https://docs.weblate.org/ro/latest/admin/config.md#std-setting-AUTOFIX_LIST)

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

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

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

# Translation services
WEBLATE_MACHINERY += ("weblate_customization.machinery.SampleTranslation",)
```

#### SEE ALSO
* [Reparații automate personalizate](https://docs.weblate.org/ro/latest/admin/checks.md#custom-autofix)
* [Întocmirea propriilor cecuri](https://docs.weblate.org/ro/latest/admin/checks.md#own-checks)
* [Add-on de scriere](https://docs.weblate.org/ro/latest/admin/addons.md#own-addon)
* [Executarea scripturilor din add-on](https://docs.weblate.org/ro/latest/admin/addons.md#addon-script)
