Installation
Add the Lang module to an AntelopeJS DMS project and open it in the dashboard.
The Lang module runs inside a project that already loads @antelopejs/dms. Its AntelopeJS dependencies are the published @antelopejs/interface-dms, @antelopejs/interface-api and @antelopejs/interface-core packages.
Requirements
The module needs a DMS backend in a release that implements the @antelopejs/interface-dms range in the README requirements table. It also needs the @antelopejs/dms-frontend renderer in the range that engines["@antelopejs/dms-frontend"] of frontend-vue/package.json declares. The ajs dms CLI refuses to build the module with a renderer outside that range.
Upgrade the backend, the interface and the renderer together. See DMS installation for the toolchain and Troubleshooting for dependency and frontend integration errors.
Add it to a project
Add the module
Run the AntelopeJS CLI from your project root:
ajs project modules add @antelopejs/dms-lang
The command adds an @antelopejs/dms-lang entry to antelope.config.ts, with a caret range on the latest release.
Allow editing
The module starts read-only. Set editable: true on the process that creates workspaces and writes translations:
import { defineConfig } from "@antelopejs/interface-core/config";
export default defineConfig({
name: "my-project",
modules: {
"@antelopejs/dms-lang": {
source: { type: "package", package: "@antelopejs/dms-lang", version: "<latest>" },
config: {
editable: true,
},
},
},
});
Keep the other modules of your project, such as dms, api and mongodb, in the same modules object.
Mark your app's translations as writable
The Project files workspace edits the locale files of your own frontend module. Flag that module with dmsI18nAppLayer when you register it:
import path from "node:path";
import { AddFrontendModule } from "@antelopejs/interface-dms/page";
export async function construct(): Promise<void> {
await AddFrontendModule({
name: "my-project-frontend-vue",
sourcePath: path.join(__dirname, "../frontend-vue"),
renderer: { name: "vue", version: "3" },
configKey: "myProject",
priority: 1,
options: { dmsI18nAppLayer: true },
});
}
Every JSON file named <name>-<xx-XX>.json in the module's locale directories becomes a project file. That can be app-en-GB.json alone, or one file per domain such as crm-en-GB.json and team-en-GB.json. Lang scans i18n/locales recursively, or layers/*/i18n/locales instead when a layers directory exists. The app- prefix is a convention, not a requirement. See Frontend module options for the discovery rules and Project files for where writes go.
Restart and open the module
Restart the backend and the frontend dev server. The module appears under Modules › Translations, at /modules/lang/overview.
The locale files need no frontend build step. Lang finds them through the registered frontend modules. It follows modules registered or removed after it started, as soon as the DMS announces them, and it reads file changes on the next read.
The pages render on the server. The frontend server reads the workspace list and the translations with the page, so the matrix and the queue arrive filled. When you open a page without ?workspace=, the server redirects it to the workspace you used last, or to the project files.
Try it in the playground
The repository ships a playground with editing on and a writable app layer. Run each server in its own terminal:
pnpm install
pnpm dev # backend on http://localhost:5010
pnpm frontend:dev # dashboard on http://localhost:3001
The playground connects to MongoDB at mongodb://localhost:27017. To use another instance, set MONGO_URL. On first start, the dashboard opens the DMS onboarding to create the owner account.