Interne Weblate

Notă

Acest capitol vă va oferi o prezentare generală de bază a componentelor interne ale Weblate.

Weblate derivă cea mai mare parte din structura codului său de la, și se bazează pe Django.

Structura directoarelor

Prezentare rapidă a structurii de directoare a depozitului principal Weblate:

docs

Codul sursă pentru această documentație, care poate fi construit folosind Sphinx.

dev-docker

Codul Docker pentru a rula serverul de dezvoltare, vezi Rularea Weblate la nivel local în Docker.

weblate

Codul sursă al Weblate ca aplicație Django, vezi Interne Weblate.

weblate/static

Fișiere client (CSS, Javascript și imagini), vezi Weblate front-end.

Module

Weblate este format din mai multe aplicații Django (unele opționale, vezi Module Weblate opționale):

accounts

Cont de utilizator, profiluri și notificări.

addons

Componente suplimentare pentru a modifica comportamentul Weblate, vezi Suplimente.

api

API bazat pe Django REST framework.

auth

Autentificare și permisiuni.

billing

Modulul opțional Facturare.

checks

Șir de traducere Controale de calitate modul.

fonts

Modul de verificare a redării fonturilor.

formats

Strat de abstractizare a formatului de fișier bazat pe translate-toolkit.

gitexport

Modulul opțional Exportator Git.

lang

Modul de definire a limbajului și a modelelor de plural.

legal

Modulul opțional Legal module.

machinery

Integrarea serviciilor de traducere automată.

memory

Memorie de traducere încorporată, a se vedea Memorie de traducere.

screenshots

Modul de gestionare a capturilor de ecran și modul OCR.

trans

Modulul principal care gestionează traducerile.

utils

Diverse utilități de ajutor.

vcs

Abstractizarea sistemului de control al versiunilor.

wladmin

Personalizarea interfeței de administrare Django.

Background tasks internals

Sugestie

This section describes Celery task internals. Sarcini de fundal folosind Celery describes how to configure Celery to run the tasks.

Weblate uses Celery to execute tasks in the background. Some tasks are event-triggered, and some tasks are schedule-triggered.

The Celery Beat is used for scheduling tasks, and django-celery-beat is used to store the periodic task schedule in the database. The tasks schedule is configured in tasks.py in each of the Django apps.

The tasks are consumed using several queues; the routing is configured in settings.py. The queues were designed to separate different types of workload:

celery

The default queue where background tasks are processed.

notify

Delivers notification e-mails, both for events within Weblate and for authentication or registration. This is a separate queue to make e-mail delivery smooth even if there is a backlog of other tasks.

memory

Updates translation memory entries. The updating queue can be long when importing new strings, and long processing does not matter much here, so having a separate queue avoids blocking other tasks.

backup

The backup tasks cannot be executed in parallel, and a single dedicated worker makes this easier.

translate

Automatic translation tasks are known to take long because they hit external services.