Installation
The Lang module runs inside a project that already loads @antelopejs/dms. It depends only on the published @antelopejs/interface-dms, @antelopejs/interface-api and @antelopejs/interface-core interfaces, which the DMS provides.
Requirements
| Package | Version |
|---|---|
@antelopejs/dms | >=0.9.0 <1.0.0 |
@antelopejs/interface-dms | >=0.7.0 <1.0.0 |
@antelopejs/dms-frontend (the renderer) | 0.6 |
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 a dms-lang entry to antelope.config.ts.
Allow editing
The module starts read-only. Set editable: true on the process that should create workspaces and write translations:
export default defineConfig({
name: "my-project",
modules: {
"dms-lang": {
source: { type: "package", package: "@antelopejs/dms-lang", version: "^0.2.0" },
config: {
editable: true,
},
},
// dms, api, mongodb, ...
},
});
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 discovered locale directories becomes a project file: app-en-GB.json, 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 discovery rules and Project files for write routing.
Restart and open the module
Restart the backend and the frontend dev server. The module appears under Modules › Translations, at /modules/lang/overview.
?workspace= is redirected on the server 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:
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; set MONGO_URL to use another instance. On first start, the dashboard opens the DMS onboarding to create the owner account.