@antelopejs/dms-lang 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,68 +1,93 @@
1
+ <div align="center">
2
+
1
3
  # @antelopejs/dms-lang
2
4
 
3
- <div align="center">
4
- <a href="./LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue?style=for-the-badge&labelColor=000000"></a>
5
- <a href="https://discord.gg/sjK28QHrA7"><img src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000" alt="Discord"></a>
6
- <a href="https://antelopejs.com"><img src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000" alt="Documentation"></a>
7
- </div>
5
+ <a href="https://www.npmjs.com/package/@antelopejs/dms-lang"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/dms-lang?style=for-the-badge&labelColor=000000&color=000000"></a>
6
+ <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/dms-lang?style=for-the-badge&labelColor=000000&color=000000"></a>
7
+ <a href="https://discord.gg/sjK28QHrA7"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
8
+ <a href="https://dms.antelopejs.com/docs/modules/lang"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
8
9
 
9
- Language and translation management for AntelopeJS DMS, available under `/modules/lang`.
10
+ Language and translation management for the AntelopeJS DMS.
10
11
 
11
- It provides, under two sidebar groups:
12
+ </div>
12
13
 
13
- - **Translate › Overview**: the coverage of each language of the selected workspace, a namespace × language heatmap and the public locale endpoint.
14
- - **Translate › Translations**: a key-by-language matrix with per-cell save state, placeholder checks, "Missing in" and namespace filters, a key editor drawer and CSV export.
15
- - **Language** (opened from Overview): a translation queue for one language, with its progress by namespace.
16
- - **Manage › Workspaces**: every workspace with its kind, size and coverage, and the creation of new ones.
17
- - **Workspace settings** (opened from Workspaces): name, base language, languages, ready-to-paste app snippets and a danger zone.
14
+ ![The Lang overview: coverage KPIs, languages ranked by coverage and a namespace heatmap](./docs/images/overview.png)
18
15
 
19
- Every page names the workspace it works on in a scope bar, which also switches it; the selection is kept in the page URL (`?workspace=`). The command palette offers Translate missing keys, Add a translation key, Add a language and New translation workspace.
16
+ ## What it does
20
17
 
21
- Write routes check the permission of the page action they belong to (`modules.lang.translate.translations.scoped.matrix.edit`, `….keys`, `modules.lang.manage.workspaces.list.create`, …); module pages stay owner-only, as every DMS module.
18
+ - Reads every locale file the dashboard loads and shows how complete each language is, with a namespace × language heatmap.
19
+ - Edits every key side by side in a translation matrix, with placeholder checks, filters and CSV export.
20
+ - Walks one language key by key in a translation queue, with the base text and the other languages for context.
21
+ - Hosts translation workspaces for your other apps and serves them as public JSON at `/i18n/<workspace>/<locale>.json`.
22
22
 
23
- ## Installation
23
+ ## Install
24
24
 
25
- Add the module to a project that already uses `@antelopejs/dms`:
25
+ Run the AntelopeJS CLI from the root of a project that already loads `@antelopejs/dms`:
26
26
 
27
27
  ```bash
28
28
  ajs project modules add @antelopejs/dms-lang
29
29
  ```
30
30
 
31
- ## Configuration
31
+ ## Quick start
32
32
 
33
- Workspace mutations are disabled by default. Enable them explicitly in `antelope.config.ts` when
34
- the running process should be allowed to create, rename, and delete workspaces, locales, keys, and
35
- translations:
33
+ The module starts read-only. Allow writes on the process that edits translations:
36
34
 
37
- ```typescript
38
- config: {
39
- editable: true,
40
- }
35
+ ```ts
36
+ // antelope.config.ts
37
+ "dms-lang": {
38
+ source: { type: "package", package: "@antelopejs/dms-lang", version: "^0.2.0" },
39
+ config: {
40
+ editable: true,
41
+ },
42
+ },
41
43
  ```
42
44
 
43
- Added workspaces are stored in the module's `i18n-workspaces` directory. The module also registers
44
- its bundled locale source and registry as a DMS frontend module.
45
+ Restart the backend, then the frontend, and open **Modules › Translations** (`/modules/lang/overview`). To edit your own frontend module's locale files, register it with `options: { dmsI18nAppLayer: true }`: see [Installation](https://dms.antelopejs.com/docs/modules/lang/installation).
46
+
47
+ ## Compatibility
48
+
49
+ | Package | Version |
50
+ | --- | --- |
51
+ | `@antelopejs/dms` | `>=0.9.0 <1.0.0` |
52
+ | `@antelopejs/interface-dms` | `>=0.7.0 <1.0.0` |
53
+ | `@antelopejs/dms-frontend` (renderer) | `>=0.6.0 <0.7.0` |
54
+
55
+ On DMS 0.8, use `@antelopejs/dms-lang` 0.1.
45
56
 
46
- ## Development
57
+ ## Documentation
58
+
59
+ - [Introduction](https://dms.antelopejs.com/docs/modules/lang/introduction)
60
+ - [Installation](https://dms.antelopejs.com/docs/modules/lang/installation)
61
+ - [Configuration](https://dms.antelopejs.com/docs/modules/lang/configuration)
62
+ - [Usage](https://dms.antelopejs.com/docs/modules/lang/usage/overview)
63
+ - [Extending](https://dms.antelopejs.com/docs/modules/lang/extending)
64
+ - [FAQ](https://dms.antelopejs.com/docs/modules/lang/faq)
65
+
66
+ The canonical guide lives in [`docs/`](./docs), including the [supported extension boundary](./docs/5.extending.md#supported-extension-boundary). There is no separate DMS Lang interface package. The package also ships the `dms-lang` Claude Code skill in [`skills/`](./skills), declared under `antelopeJs.skills`.
67
+
68
+ ## Contributing
69
+
70
+ Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening a pull request. The playground connects to MongoDB at `mongodb://localhost:27017`; set `MONGO_URL` to use another instance.
47
71
 
48
72
  ```bash
49
73
  pnpm install
50
- pnpm build
74
+ pnpm dev # playground backend
75
+ pnpm frontend:dev # dashboard, in a second terminal
76
+ pnpm lint
77
+ pnpm typecheck
51
78
  pnpm test
52
79
  ```
53
80
 
54
- ## Vue and Inertia development
55
-
56
- The backend registers `frontend-vue/dms.frontend.ts` through `AddFrontendModule` with the Vue 3 renderer. The module declares `componentPrefix: "DmsLang"` and registers every component of `app/components` and `app/build/components` under it; the backend pages name them (`CustomComponent("DmsLangTranslationMatrix")`). `dms.frontend.build.ts` declares `app/composables`, `app/utils` and `app/types` for auto-import; `app/build/` is private and imported by path. Nuxt is not required; `@nuxt/ui` provides its Vue components through the adapter's Vite integration.
57
-
58
- Its pages read the data they render with the DMS's `useApiData`, which a server render reads and hands to the browser with the page; the dialogs that ask the server for their wording read it when they open. The module requires `@antelopejs/dms` 0.9, `@antelopejs/interface-dms` 0.7 and `@antelopejs/dms-frontend` 0.6. The public language files (`/i18n/**`) are declared to the frontend server as a backend prefix without a session (`backendProxies`), so the DMS's own origin serves them. It compiles against the published `@antelopejs/interface-dms` package, its only DMS runtime dependency. The `@antelopejs/dms` backend and the `@antelopejs/dms-frontend` adapter are development dependencies, needed to run the tests and the playground. Run `pnpm install`, `pnpm build` and `pnpm test` here.
59
-
60
- `pnpm test:unit` checks locale discovery, the coverage, placeholder and message helpers of the frontend and the locale files, and renders the workspace composables on a server with the installed adapter and `useApiData` (`tests/frontend-runtime.mjs`). The backend tests (`src/test`: keys, workspaces, validation, coverage, summaries) run with `pnpm test` only: every backend file reaches an AntelopeJS interface (`@antelopejs/interface-api` for the errors, `@antelopejs/interface-dms` for the pages), and an interface refuses to load outside the AntelopeJS runtime. `pnpm test:frontend` compiles the module alongside the published core DMS frontend with the adapter's source verifier.
81
+ <details>
82
+ <summary>Repository notes</summary>
61
83
 
62
- Run `pnpm dev` for the backend and `pnpm frontend:dev` for the Inertia workspace. The playground connects to MongoDB at `mongodb://localhost:27017`; set `MONGO_URL` to use another instance. The frontend workspace uses the `ajs dms` commands for development, preparation and production builds. Use `pnpm typecheck` for the backend; run `pnpm typecheck` in the generated Vite workspace for frontend types. The adapter owns the generated aliases, auto-import declarations and Vue compiler configuration.
84
+ - The backend registers `frontend-vue/dms.frontend.ts` through `AddFrontendModule` with the Vue 3 renderer, under the `DmsLang` component prefix: every component of `app/components` and `app/build/components` is registered under it, and the backend pages name them (`CustomComponent("DmsLangTranslationMatrix")`). `dms.frontend.build.ts` auto-imports `app/composables`, `app/utils` and `app/types`; `app/build/` is private and imported by path.
85
+ - The pages read their data with the DMS's `useApiData`, which the server render hands to the browser with the page. The public language files (`/i18n/**`) are declared to the frontend server as a backend prefix without a session (`backendProxies`).
86
+ - The module compiles against the published `@antelopejs/interface-dms`; `@antelopejs/dms` and `@antelopejs/dms-frontend` are development dependencies, needed by the tests and the playground.
87
+ - `pnpm test:unit` checks locale discovery, the coverage, placeholder and message helpers, and renders the workspace composables on a server (`tests/frontend-runtime.mjs`). The backend tests (`src/test`) run with `pnpm test` only, since an interface refuses to load outside the AntelopeJS runtime. `pnpm test:frontend` compiles the module against the published DMS frontend with the renderer's source verifier.
63
88
 
64
- ## Locale sources no longer require a frontend build
89
+ </details>
65
90
 
66
- At module startup, Lang obtains the registered frontend sources through `GetFrontendModules()`, after backend construction completes. Each translation read discovers JSON files under `i18n/locales`, including the DMS's nested `layers/*` directories. Files follow the adapter convention, such as `app-en-GB.json` and `lang-fr-FR.json`. Changes to files appear on subsequent reads; registering another frontend module requires restarting the backend.
91
+ ## License
67
92
 
68
- Module translations remain external and read-only. An application's frontend registration marks its own writable translations with `options: { dmsI18nAppLayer: true }`, replacing the same flag in its old Nuxt configuration. The playground demonstrates this registration. Editing also requires the existing Lang `editable: true` setting. No locale path list or generated registry file is required.
93
+ [Apache-2.0](./LICENSE)
@@ -90,9 +90,9 @@ export declare const workspaceSchema: {
90
90
  }, "strip", z.ZodTypeAny, {
91
91
  id: string;
92
92
  messages: Record<string, unknown>;
93
+ version?: number | undefined;
93
94
  type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
94
95
  description?: string | null | undefined;
95
- version?: number | undefined;
96
96
  format?: "dms-lang.workspace" | undefined;
97
97
  defaultLocale?: string | undefined;
98
98
  locales?: {
@@ -103,9 +103,9 @@ export declare const workspaceSchema: {
103
103
  }, {
104
104
  id: string;
105
105
  messages: Record<string, unknown>;
106
+ version?: number | undefined;
106
107
  type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
107
108
  description?: string | null | undefined;
108
- version?: number | undefined;
109
109
  format?: "dms-lang.workspace" | undefined;
110
110
  defaultLocale?: string | undefined;
111
111
  locales?: {
@@ -7,7 +7,7 @@
7
7
  "license": "Apache-2.0",
8
8
  "packageManager": "pnpm@10.6.5",
9
9
  "engines": {
10
- "@antelopejs/dms-frontend": ">=0.6.0 <0.7.0"
10
+ "@antelopejs/dms-frontend": ">=0.6.3 <0.7.0"
11
11
  },
12
12
  "scripts": {
13
13
  "build": "ajs dms build",
@@ -18,8 +18,8 @@
18
18
  "lint:fix": "eslint . --fix"
19
19
  },
20
20
  "devDependencies": {
21
- "@antelopejs/core": "1.14.0",
22
- "@antelopejs/dms-frontend": "0.6.0",
21
+ "@antelopejs/core": "1.16.0",
22
+ "@antelopejs/dms-frontend": "0.6.3",
23
23
  "@eslint/js": "^9",
24
24
  "@typescript-eslint/eslint-plugin": "^8",
25
25
  "@typescript-eslint/parser": "^8",
package/package.json CHANGED
@@ -1,6 +1,19 @@
1
1
  {
2
2
  "name": "@antelopejs/dms-lang",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
+ "description": "Language and translation management for the AntelopeJS DMS: coverage overview, translation matrix, translation queue and public translation workspaces.",
5
+ "keywords": [
6
+ "antelopejs",
7
+ "dms",
8
+ "dms-module",
9
+ "i18n",
10
+ "localization",
11
+ "translations"
12
+ ],
13
+ "homepage": "https://dms.antelopejs.com/docs/modules/lang",
14
+ "bugs": {
15
+ "url": "https://github.com/AntelopeJS/dms-lang/issues"
16
+ },
4
17
  "license": "Apache-2.0",
5
18
  "repository": {
6
19
  "type": "git",
@@ -10,7 +23,8 @@
10
23
  "dist",
11
24
  "!dist/test",
12
25
  "!dist/.tsbuildinfo",
13
- "frontend-vue"
26
+ "frontend-vue",
27
+ "skills"
14
28
  ],
15
29
  "main": "dist/index.js",
16
30
  "types": "dist/index.d.ts",
@@ -45,18 +59,18 @@
45
59
  "knip:all": "knip"
46
60
  },
47
61
  "dependencies": {
48
- "@antelopejs/interface-api": ">=0.0.14 <1.0.0",
49
- "@antelopejs/interface-api-util": ">=0.1.2 <1.0.0",
50
- "@antelopejs/interface-core": ">=0.1.1 <1.0.0",
51
- "@antelopejs/interface-dms": ">=0.7.0 <1.0.0",
62
+ "@antelopejs/interface-api": ">=0.0.15 <1.0.0",
63
+ "@antelopejs/interface-api-util": ">=0.1.3 <1.0.0",
64
+ "@antelopejs/interface-core": ">=0.2.4 <1.0.0",
65
+ "@antelopejs/interface-dms": ">=0.7.2 <1.0.0",
52
66
  "@intlify/message-compiler": "^11.1.12",
53
67
  "zod": "~3.24.2"
54
68
  },
55
69
  "devDependencies": {
56
- "@antelopejs/core": "1.14.0",
57
- "@antelopejs/dms": ">=0.9.0 <1.0.0",
58
- "@antelopejs/dms-frontend": "0.6.0",
59
- "@antelopejs/tooling-configs": ">=0.0.7 <1.0.0",
70
+ "@antelopejs/core": "1.16.0",
71
+ "@antelopejs/dms": ">=0.9.3 <1.0.0",
72
+ "@antelopejs/dms-frontend": "0.6.3",
73
+ "@antelopejs/tooling-configs": ">=0.0.9 <1.0.0",
60
74
  "@types/chai": "^5.2.3",
61
75
  "@types/mocha": "^10.0.10",
62
76
  "@types/node": "^24.0.0",
@@ -77,6 +91,9 @@
77
91
  "antelopeJs": {
78
92
  "baseUrl": "dist",
79
93
  "implements": [],
80
- "test": "src/test/harness.ts"
94
+ "test": "src/test/harness.ts",
95
+ "skills": [
96
+ "./skills"
97
+ ]
81
98
  }
82
99
  }
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: dms-lang
3
+ description: Manages translations with the @antelopejs/dms-lang module of the AntelopeJS DMS. Use when installing or configuring dms-lang, adding or translating i18n keys of a DMS project (app-*.json), overriding a module's texts, creating a translation workspace served as public JSON to another app (website, mobile), or debugging read-only, missing or 404 translations.
4
+ icon: i-lucide-languages
5
+ category: i18n
6
+ tags: [i18n, translations, locales, workspaces, dms-module]
7
+ ---
8
+
9
+ # dms-lang
10
+
11
+ Translation management for the DMS, under `/modules/lang` (owner-only, like every module page).
12
+ User docs: `docs/` of this package, published at https://dms.antelopejs.com/docs/modules/lang.
13
+
14
+ ## When to reach for it
15
+
16
+ - A project needs its dashboard texts (`$app.*` keys) translated or edited without touching JSON by hand.
17
+ - Another app (website, mobile app) needs translation files hosted and edited in the DMS.
18
+ - A module's built-in text must read differently in one project: override the key, never edit the module's files.
19
+
20
+ ## Setup
21
+
22
+ ```bash
23
+ ajs project modules add @antelopejs/dms-lang
24
+ ```
25
+
26
+ - `config.editable: true` in `antelope.config.ts` allows every write. Default `false`: writes fail with a read-only error.
27
+ - The project's own frontend module needs `options: { dmsI18nAppLayer: true }` in `AddFrontendModule`; its `i18n/locales/app-<locale>.json` files become the writable **Project files** workspace.
28
+ - A new frontend module is discovered at backend start only; file edits show on the next read.
29
+ - Lang 0.2 requires `@antelopejs/dms` >=0.9 (interface-dms 0.7, renderer `@antelopejs/dms-frontend` 0.6); Lang 0.1 is the DMS 0.8 line.
30
+
31
+ ## Workspaces
32
+
33
+ | Id | Kind | Editable | Public |
34
+ | --- | --- | --- | --- |
35
+ | `default` | Project files (`app-*.json`) | yes, with `editable` | no |
36
+ | `modules` | Files shipped by the DMS and installed modules | no, override into `default` | no |
37
+ | any other | Created in the UI or by `POST /api/lang/translations/workspace` / `import` | yes, with `editable` | `GET <apiBaseUrl>/i18n/<id>/<locale>.json`, any origin |
38
+
39
+ Created workspaces live in the module's `i18n-workspaces/<id>/` folder: back them up (Download backup) before reinstalling.
40
+
41
+ ## Pages and links
42
+
43
+ Overview, Translation matrix (`translations`), Translation queue (`language?locale=`), Workspaces, Workspace settings (`workspace`). Every page takes `?workspace=<id>`; `?action=add-key|add-language|new-workspace` opens the dialog, `?filter=missing` filters the matrix.
44
+
45
+ ## Gotchas
46
+
47
+ - Messages use the vue-i18n format: `{name}` placeholders, `one | many` plurals, a literal `@` written `{'@'}`. A placeholder that differs from the base text is flagged as an issue.
48
+ - In `default`, a key a module already translates counts as translated ("From a module"); writing a value overrides it.
49
+ - Write routes check page-action permissions (`modules.lang.translate.translations.scoped.matrix.edit`, `….keys`, `modules.lang.manage.workspaces.list.create`, …) on top of `@AuthOwnerOnly`.
50
+ - Writes publish on the realtime topic `dms-lang.translations`.
51
+ - Pages render on the server (`useApiData`); a page without `?workspace=` is redirected server-side to the remembered workspace or `default`.
52
+ - The public files are declared to the frontend server (`backendProxies: [{ path: "/i18n/**", auth: "none" }]`), so they answer on the dashboard origin as well as the backend's.
53
+ - Labels of a page or custom block you write stay i18n keys (`$app.my_page.title`) in `app-*.json`; Lang is where people translate them, never a reason to hard-code text.