How weblateorg/weblate works
Main Components
• Frontend:
– The "client" directory contains JavaScript files (e.g., main.js, webpack.config.js) and other assets that build the client-side application.
– It is responsible for the user interface, interacting with the API and rendering translation workflows.
• Backend (Application Server):
– The “weblate” directory houses the core Django application and many Django apps such as accounts, auth, addons, api, billing, checks, machinery, trans (translations), vcs, and more.
– These apps cover user management, external integrations (e.g., machinery and VCS), translation memory handling, and the REST API.
• API Layer:
– Found under weblate/api, this layer exposes endpoints for programmatic access and integrates with the frontend.
– It uses Django’s REST framework features (and potentially DRF Spectacular for schema generation).
• Database:
– The various ci/docker-compose files and installation instructions suggest that the deployable system uses a SQL database (PostgreSQL, MySQL, or MariaDB) as the persistent storage for all state including user data, translations, and configuration.
• External Services and Integrations:
– Machinery: The “weblate/machinery” directory includes connectors to various translation service providers (Google, DeepL, IBM, etc.) indicating that the system integrates with external machine translation APIs.
– VCS Integration: The “weblate/vcs” directory contains components for interacting with version control systems and repository management.
– Addons: Extend core functionality. The “weblate/addons” directory hints at plug-in architecture to support custom or third-party capabilities.
– Celery/Task Queue: Many modules (in “utils/celery.py” and “tasks.py” files in various apps) indicate asynchronous tasks are used for background processing (e.g., sending notifications, importing translations, triggering external APIs).
Relationships and Interactions
• The Frontend communicates with the Backend via HTTP/HTTPS REST API calls.
• The Backend Django application processes user requests, accesses business logic spread across various submodules (accounts, trans, addons, etc.), and updates the Database.
• The API layer (within the Django app) provides JSON endpoints used both by the frontend and by external services.
• Asynchronous tasks (handled via Celery or similar) interact with external APIs (like machine translation services) and update the Database when complete.
• Integrations for version control and backup are depicted as external systems sending data to and receiving data from the backend.
• Infrastructure elements (depicted in CI workflows and Docker Compose files) point to containerized services, including separate database containers.
Architectural Patterns and Key Technologies
• MVC/MVT: The Django project naturally follows the Model-View-Template (MVT) pattern.
• Modular/Pluggable Architecture: Numerous Django apps (accounts, addons, api, machinery, etc.) suggest clear separation of concerns.
• Asynchronous Task Processing: Use of Celery-style tasks for background job handling.
• API-First Design: The presence of a dedicated “api” module and REST framework configuration.
• Frontend Bundling: The use of a dedicated “client” directory with webpack indicates a modern JavaScript frontend build process.
• Configuration and Deployment: Docker Compose files (in "dev-docker" and "ci") and configuration files (pyproject.toml, setup.py) showcase a containerized and CI/CD ready deployment architecture.
Specific Elements
• Use clear labels for each major component: "Frontend Client", "Django Application Server", "REST API", "Database (PostgreSQL/MySQL/etc.)", "Asynchronous Task Queue", "External Translation Services", "Version Control Integration", etc.
– From the Frontend to the Backend/API.
– From the Backend to the Database.
– From the Backend/Task Queue to External APIs (e.g., machine translation and VCS systems).
– Use cloud or external symbols for third-party services and integrations.
Detail Without Overcomplication
• You may optionally annotate critical technologies (e.g., Django, Celery, webpack, PostgreSQL) which are essential for understanding the overall architecture.