Wewnętrzna struktura Weblate

Informacja

Ten rozdział zawiera podstawowe podsumowanie wewnętrznej struktury Weblate.

Weblate derives most of its code structure from, and is based on Django.

Struktura katalogów

Quick overview of directory structure of Weblate main repository:

docs

Source code for this documentation, which can be built using Sphinx.

dev-docker

Docker code to run development server, see Running Weblate locally in Docker.

weblate

Source code of Weblate as a Django application, see Wewnętrzna struktura Weblate.

weblate/static

Client files (CSS, Javascript and images), see Frontend Weblate.

Moduły

Weblate consists of several Django applications (some optional, see Opcjonalne moduły Weblate):

accounts

User account, profiles and notifications.

addons

Add-ons to tweak Weblate behavior, see Dodatki.

api

API based on Django REST framework.

auth

Uwierzytelnianie i uprawnienia.

billing

Opcjonalny moduł Rozliczenia.

checks

Translation string Kontrole jakości module.

fonts

Moduł kontroli renderowania czcionek.

formats

File format abstraction layer based on translate-toolkit.

gitexport

Opcjonalny moduł Eksporter Git.

lang

Module defining language and plural models.

legal

Opcjonalny moduł Legal module.

machinery

Integration of machine translation services.

memory

Wbudowana pamięć tłumaczeń, zobacz Pamięć tłumaczeniowa.

screenshots

Screenshots management and OCR module.

trans

Główny moduł obsługujący tłumaczenia.

utils

Różne narzędzia pomocnicze.

vcs

Version control system abstraction.

wladmin

Dostosowywanie interfejsu administratora Django.

Background tasks internals

Podpowiedź

This section describes Celery task internals. Zadania w tle korzystające z 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.