How mdwikicx/cx-1 works
Main Components
• Frontend (UI Layer):
– Represented by the “app” directory and its sub-directories (src, components, store, router, etc.).
– Built with Vue.js with numerous Vue components (e.g., CXDashboard, SXEditor, SXPublisher) and libraries (mediawiki.ui components from “app/src/lib/mediawiki.ui”).
– Uses modern UI patterns and state management (Vuex) to handle translation workflows, language selectors, and suggestions.
• Backend (API & Business Logic Layer):
– Located mainly in the “includes” directory plus additional PHP modules and templates (found in “modules”, “minT”, and other PHP-related directories).
– Implements MediaWiki-specific API endpoints (see files under includes/ActionApi/) and hook handlers managing translation events.
– Contains service classes (in includes/Service and includes/Store) that handle translation operations, notifications, and integration with other MediaWiki components.
• Database and Schema:
– SQL scripts in the “sql” folder show migrations, schema changes, and table definitions that support the translation data model.
– These scripts clarify how translation units, draft/published translation records, and notification logs are managed.
• External Services and Integrations:
– Integration with MediaWiki’s Parsoid (ParsoidClient.php), machine translation APIs (under modules/mw.cx.MachineTranslationService.js and similar files), and Chart.js (included as a dependency).
– Event logging and notifications likely interface with external logging or MediaWiki’s Echo notification system.
Out the Relationships and Interactions
– API calls are routed through the Vuex store actions and routed via the “router” configuration.
– These calls hit the backend (PHP API endpoints in includes/ActionApi and modules) to perform create, update, and delete operations.
• Communication between the backend and database:
– Backend services (in includes/Service, includes/Store) interact with the database using the SQL schema defined in the “sql” folder.
• Integration with external services:
Architectural Patterns and Dependencies
• Frontend:
– Use of an SPA pattern with separation of UI, state management, and routing.
– The frontend is modular, with clearly separated components (each translation tool has its own Vue file and supporting JavaScript logic).
• Backend:
– Many modules follow a service/handler pattern to plug into MediaWiki’s hook system.
– The use of API endpoints and DTO (Data Transfer Objects) in includes/DTO indicates clear separation between internal models and API communications.
• Dependency Flow:
– How front-end components rely on mediawiki.ui libraries and custom UI components for presenting translation interfaces.
– How backend modules rely on the MediaWiki framework’s hook system and external APIs.