[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationExtending

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.

text
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>.json files become the writable Project files, in as many files per language as you like (see Project files).
Note

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.

Terminal bash
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:

Example response json
{
  "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. OPTIONS preflight 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.

404 response json
{
  "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 pathPurpose
GET /workspacesEvery workspace with its size and public URL, the editable flag, and the permission id of each write
GET /summaryEvery 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-confirmThe 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 pathPurposePermission (component › action)
POST /workspace, POST /importCreate a workspace, or create one from a backupWorkspaces › Create workspaces
PATCH /workspaceUpdate the description and typeGeneral settings › Edit workspaces
POST /workspace/renameRename a workspaceDanger zone › Rename workspaces
DELETE /workspaceDelete a workspaceDanger zone › Delete workspaces
POST /locale, DELETE /languages/:workspace/:code, POST /languages/:workspace/:code/baseAdd, remove, or make base a languageGeneral settings › Manage languages
POST /key, POST /key/rename, DELETE /keyCreate, rename, or delete a keyTranslation matrix › Manage keys
PUT /key, DELETE /key/override, POST /key/reviewedWrite 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.

The pages read these query parameters, in links and quick actions:

QueryPagesEffect
workspace=<id>AllSelects the workspace (default, modules, or one you created)
locale=<code>Translation queueSelects the language
mode=missing, issues, allTranslation queueSelects the queue mode (missing by default)
filter=missing, complete, issues, allTranslation matrixFilters the rows (all by default)
missingIn=<code>Translation matrixCounts and filters on one language
namespace=<name>Translation matrix, translation queueLimits the rows or the queue to one namespace
q=<text>Translation matrixSearches keys and values
key=<path>Translation matrix, translation queueOpens the key drawer on that key, or starts the queue on it
action=add-keyTranslation matrixOpens the add key dialog on arrival
action=add-languagePages with the scope barOpens the add language dialog on arrival
action=new-workspaceWorkspacesOpens the new workspace dialog on arrival