Extending
Ship translations from your own module, load a workspace in another app, and call the Lang HTTP API.
The Lang module has no AntelopeJS interface of its own. Other code plugs into it through locale files, the public endpoint, the HTTP API, and the realtime topic.
Supported extension boundary
The contracts on this page are the supported integration points. The runtime root also re-exports its page and route classes. Those exports are not an extension SDK and not a supported subclassing contract. Registering those controllers again, or calling their methods to bypass the HTTP guards, is not supported. Pages of your own are defined through @antelopejs/interface-dms, and they integrate with Lang through the locale, HTTP, and realtime contracts below.
Ship translations from a module
Any DMS frontend module registered with AddFrontendModule contributes its <name>-<xx-XX>.json files from the discovered locale directories. Lang lists the modules with GetFrontendModules() and checks the file stamps on each read, so a changed file shows on the next read.
frontend-vue/
i18n/
locales/
my_module-en-GB.json
my_module-fr-FR.json
- A module's files appear in the Installed modules workspace, read-only. A project changes one of their texts by overriding the key in its project files.
- The project's own frontend module carries
options: { dmsI18nAppLayer: true }. Its<name>-<xx-XX>.jsonfiles become the writable Project files, in as many files per language as you like (see Project files).
A frontend module that registers or leaves after Lang started, in its own construct or start, shows up or disappears as soon as the DMS fires FrontendModulesChanged, without a restart. Changes to existing files show on the next read.
A module registered again with a different dmsI18nAppLayer option changes origin on the next module refresh, even when its files have not changed. The messages, the matrix rows, and the coverage then follow the new origin.
Load a workspace in another app
GET /i18n/<workspace>/<locale>.json serves each workspace you create, without credentials, to any origin. The project files and installed modules workspaces are not served there.
curl https://api.example.com/i18n/storefront/fr.json
The response is the nested message tree of the language. It leaves out the keys that have no text in that language. The endpoint does not merge base language texts into the response, so the base language is loaded too and the fallback is configured in the i18n library. The Use in your app card of the workspace settings generates vue-i18n, i18next, fetch, and curl snippets for this setup.
After checkout.pay is translated to Payer maintenant in fr, the response includes:
{
"checkout": {
"pay": "Payer maintenant"
}
}
If checkout.cancel exists only in the base language, it is absent from this response.
The response headers are:
Access-Control-Allow-Origin: *, whatever the CORS configuration of the api module.OPTIONSpreflight requests answer 204.Cache-Control: no-cache, so a saved change is served on the next request.Content-Language, the code of the file served.
A regional code without a file of its own falls back to its language. A request for fr-BE.json is served the fr file, and Content-Language is fr.
A missing workspace or language answers 404 with the code unknown_locale. A valid language with missing keys answers 200. The endpoint has no authentication, so these files hold public texts only.
{
"workspace": "storefront",
"locale": "de",
"message": "$dms_lang.errors.unknown_locale",
"code": "unknown_locale"
}
HTTP API
The dashboard pages read and write through /api/lang/translations. Every route is reserved to the platform owner (@AuthOwnerOnly). Every write also checks the permission of its page action with @AuthUserWithPermission and answers 403 read_only unless the module is configured with editable: true.
Workspaces are platform-wide catalogs, not tenant-isolated resources. These routes select a workspace by id, not by tenantId, and the public /i18n route has no tenant or authentication guard. Changing workspacesDir changes the process-wide storage root, not its access policy.
A read route that takes ?workspace= selects the project files (default) when the parameter is omitted. An unknown workspace answers 404 unknown_workspace.
| Method and path | Purpose |
|---|---|
GET /workspaces | Every workspace with its size and public URL, the editable flag, and the permission id of each write |
GET /summary | Every workspace with its locales, keys, coverage, and missing counts |
GET /workspace?workspace= | One workspace with its languages and details |
GET /flat?workspace= | The flattened keys and values of a workspace |
GET /row?workspace=&key= | One key of a workspace, with the workspace counts |
GET /namespaces?workspace= | The coverage of each namespace |
GET /languages?workspace= | The languages table of the overview and the workspace settings |
GET /kpis?workspace=, GET /locale-stats?workspace=&locale=, GET /about?workspace= | The data of the overview figures, the language progress, and the workspace About card |
GET /notice?workspace=&page= | The banner of the overview or workspace page |
GET /endpoint?workspace=, GET /snippet?workspace=&kind= | The public URL and the vue, i18next, fetch, or curl snippet |
GET /languages/:workspace/:code/removal-confirm, GET /languages/:workspace/:code/base-confirm | The texts of the confirmation dialogs |
GET /export?workspace=&locale= | One language as JSON, or every language when locale is omitted |
GET /backup?workspace= | The whole workspace as a backup |
| Method and path | Purpose | Permission (component › action) |
|---|---|---|
POST /workspace, POST /import | Create a workspace, or create one from a backup | Workspaces › Create workspaces |
PATCH /workspace | Update the description and type | General settings › Edit workspaces |
POST /workspace/rename | Rename a workspace | Danger zone › Rename workspaces |
DELETE /workspace | Delete a workspace | Danger zone › Delete workspaces |
POST /locale, DELETE /languages/:workspace/:code, POST /languages/:workspace/:code/base | Add, remove, or make base a language | General settings › Manage languages |
POST /key, POST /key/rename, DELETE /key | Create, rename, or delete a key | Translation matrix › Manage keys |
PUT /key, DELETE /key/override, POST /key/reviewed | Write values, drop an override, or take translations out of To review (created workspaces only) | Translation matrix › Edit translations |
Permission ids follow the page tree. Examples are modules.lang.translate.translations.scoped.matrix.edit, modules.lang.translate.translations.scoped.matrix.keys, and modules.lang.manage.workspaces.list.create. GET /workspaces returns the full list under permissions.
An error answers a JSON body with message, a $dms_lang.errors.* i18n key, and code, a stable error code that sets the HTTP status.
Realtime
Every write publishes a changed message on the dms-lang.translations topic. Its payload carries the workspace id, the keys the write changed when it changed only keys, and the realtime session of the tab that wrote it. The Lang pages subscribe to the topic, so another tab or another user sees a change without reloading. RegisterPageTopic subscribes a page of your own to the same topic.
Deep links
The pages read these query parameters, in links and quick actions:
| Query | Pages | Effect |
|---|---|---|
workspace=<id> | All | Selects the workspace (default, modules, or one you created) |
locale=<code> | Translation queue | Selects the language |
mode=missing, issues, all | Translation queue | Selects the queue mode (missing by default) |
filter=missing, complete, issues, all | Translation matrix | Filters the rows (all by default) |
missingIn=<code> | Translation matrix | Counts and filters on one language |
namespace=<name> | Translation matrix, translation queue | Limits the rows or the queue to one namespace |
q=<text> | Translation matrix | Searches keys and values |
key=<path> | Translation matrix, translation queue | Opens the key drawer on that key, or starts the queue on it |
action=add-key | Translation matrix | Opens the add key dialog on arrival |
action=add-language | Pages with the scope bar | Opens the add language dialog on arrival |
action=new-workspace | Workspaces | Opens the new workspace dialog on arrival |