@antelopejs/dms-lang 0.0.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.
Files changed (76) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +62 -0
  3. package/dist/index.d.ts +7 -0
  4. package/dist/index.js +46 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/pages/index.d.ts +4 -0
  7. package/dist/pages/index.js +21 -0
  8. package/dist/pages/index.js.map +1 -0
  9. package/dist/pages/module.d.ts +1 -0
  10. package/dist/pages/module.js +12 -0
  11. package/dist/pages/module.js.map +1 -0
  12. package/dist/pages/overview.d.ts +9 -0
  13. package/dist/pages/overview.js +29 -0
  14. package/dist/pages/overview.js.map +1 -0
  15. package/dist/pages/translations.d.ts +9 -0
  16. package/dist/pages/translations.js +29 -0
  17. package/dist/pages/translations.js.map +1 -0
  18. package/dist/routes/index.d.ts +2 -0
  19. package/dist/routes/index.js +19 -0
  20. package/dist/routes/index.js.map +1 -0
  21. package/dist/routes/publicLocales.d.ts +6 -0
  22. package/dist/routes/publicLocales.js +46 -0
  23. package/dist/routes/publicLocales.js.map +1 -0
  24. package/dist/routes/translations.d.ts +72 -0
  25. package/dist/routes/translations.js +213 -0
  26. package/dist/routes/translations.js.map +1 -0
  27. package/dist/utils/config.d.ts +6 -0
  28. package/dist/utils/config.js +15 -0
  29. package/dist/utils/config.js.map +1 -0
  30. package/dist/utils/json.d.ts +5 -0
  31. package/dist/utils/json.js +86 -0
  32. package/dist/utils/json.js.map +1 -0
  33. package/dist/utils/locale-discovery.d.ts +3 -0
  34. package/dist/utils/locale-discovery.js +39 -0
  35. package/dist/utils/locale-discovery.js.map +1 -0
  36. package/dist/utils/mutations.d.ts +3 -0
  37. package/dist/utils/mutations.js +35 -0
  38. package/dist/utils/mutations.js.map +1 -0
  39. package/dist/utils/own.d.ts +3 -0
  40. package/dist/utils/own.js +64 -0
  41. package/dist/utils/own.js.map +1 -0
  42. package/dist/utils/registry.d.ts +11 -0
  43. package/dist/utils/registry.js +43 -0
  44. package/dist/utils/registry.js.map +1 -0
  45. package/dist/utils/resolve.d.ts +24 -0
  46. package/dist/utils/resolve.js +203 -0
  47. package/dist/utils/resolve.js.map +1 -0
  48. package/dist/utils/tree.d.ts +24 -0
  49. package/dist/utils/tree.js +161 -0
  50. package/dist/utils/tree.js.map +1 -0
  51. package/dist/utils/workspaces.d.ts +38 -0
  52. package/dist/utils/workspaces.js +236 -0
  53. package/dist/utils/workspaces.js.map +1 -0
  54. package/frontend-vue/.editorconfig +12 -0
  55. package/frontend-vue/.prettierrc +10 -0
  56. package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +284 -0
  57. package/frontend-vue/app/components/LanguageAddModal.vue +78 -0
  58. package/frontend-vue/app/components/WorkspaceEndpoint.vue +29 -0
  59. package/frontend-vue/app/components/WorkspaceSelector.vue +180 -0
  60. package/frontend-vue/app/components/WorkspaceStatus.vue +24 -0
  61. package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +177 -0
  62. package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +90 -0
  63. package/frontend-vue/app/composables/translation/useLocaleMeta.ts +18 -0
  64. package/frontend-vue/app/composables/translation/useMutationToast.ts +30 -0
  65. package/frontend-vue/app/composables/translation/useTranslationProgress.ts +73 -0
  66. package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +27 -0
  67. package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +81 -0
  68. package/frontend-vue/app/custom-pages/lang/overview.vue +397 -0
  69. package/frontend-vue/app/custom-pages/lang/translations.vue +498 -0
  70. package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +12 -0
  71. package/frontend-vue/dms.frontend.ts +42 -0
  72. package/frontend-vue/eslint.config.mjs +50 -0
  73. package/frontend-vue/i18n/locales/lang-en-GB.json +80 -0
  74. package/frontend-vue/i18n/locales/lang-fr-FR.json +80 -0
  75. package/frontend-vue/package.json +37 -0
  76. package/package.json +76 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright (c) 2025-present - AntelopeJS Team
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # @antelopejs/dms-lang
2
+
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>
8
+
9
+ Language and translation management for AntelopeJS DMS, available under `/modules/lang`.
10
+
11
+ It provides:
12
+
13
+ - **Overview** — workspace and locale summaries, translation coverage, and the public locale endpoint.
14
+ - **Translations** — a key-by-locale matrix with missing-translation filtering.
15
+ - **Workspace selection** — a global sidebar widget for switching workspaces.
16
+
17
+ ## Installation
18
+
19
+ Add the module to a project that already uses `@antelopejs/dms`:
20
+
21
+ ```bash
22
+ ajs project modules add @antelopejs/dms-lang
23
+ ```
24
+
25
+ ## Configuration
26
+
27
+ Workspace mutations are disabled by default. Enable them explicitly in `antelope.config.ts` when
28
+ the running process should be allowed to create, rename, and delete workspaces, locales, keys, and
29
+ translations:
30
+
31
+ ```typescript
32
+ config: {
33
+ editable: true,
34
+ }
35
+ ```
36
+
37
+ Added workspaces are stored in the module's `i18n-workspaces` directory. The module also registers
38
+ its bundled locale source and registry as a DMS frontend module.
39
+
40
+ ## Development
41
+
42
+ ```bash
43
+ pnpm install
44
+ pnpm build
45
+ pnpm test
46
+ ```
47
+
48
+ ## Vue and Inertia development
49
+
50
+ The backend registers `frontend-vue/dms.frontend.ts` through `AddFrontendModule` with the Vue 3 renderer. It exposes `DmsLang*` component names, pages and the sidebar widget. Nuxt is not required; `@nuxt/ui` provides its Vue components through the adapter's Vite integration.
51
+
52
+ The module 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.
53
+
54
+ `pnpm test:unit` checks locale discovery and fallback normalization. `pnpm test:frontend` compiles the module alongside the published core DMS frontend with the adapter's source verifier.
55
+
56
+ Run `pnpm dev` for the backend and `pnpm frontend:dev` for the Inertia workspace. 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.
57
+
58
+ ## Locale sources no longer require a frontend build
59
+
60
+ 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.
61
+
62
+ 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.
@@ -0,0 +1,7 @@
1
+ export * from "./pages";
2
+ export * from "./routes";
3
+ interface DmsLangConfig {
4
+ editable?: boolean;
5
+ }
6
+ export declare function construct(config?: DmsLangConfig): Promise<void>;
7
+ export declare function start(): Promise<void>;
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.construct = construct;
21
+ exports.start = start;
22
+ const node_path_1 = __importDefault(require("node:path"));
23
+ const page_1 = require("@antelopejs/interface-dms/page");
24
+ const config_1 = require("./utils/config");
25
+ const registry_1 = require("./utils/registry");
26
+ __exportStar(require("./pages"), exports);
27
+ __exportStar(require("./routes"), exports);
28
+ async function construct(config = {}) {
29
+ const sourcePath = node_path_1.default.join(__dirname, "../frontend-vue");
30
+ const workspacesDir = node_path_1.default.join(__dirname, "../i18n-workspaces");
31
+ (0, config_1.setTranslationConfig)({
32
+ workspacesDir,
33
+ editable: config.editable ?? false,
34
+ });
35
+ await (0, page_1.AddFrontendModule)({
36
+ name: "@antelopejs/dms-lang-frontend-vue",
37
+ sourcePath,
38
+ renderer: { name: "vue", version: "3" },
39
+ configKey: "dmsLang",
40
+ priority: 0,
41
+ });
42
+ }
43
+ async function start() {
44
+ await (0, registry_1.initializeLocaleRegistry)();
45
+ }
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAYA,8BAgBC;AAED,sBAEC;AAhCD,0DAA6B;AAC7B,yDAAmE;AACnE,2CAAsD;AACtD,+CAA4D;AAE5D,0CAAwB;AACxB,2CAAyB;AAMlB,KAAK,UAAU,SAAS,CAAC,SAAwB,EAAE;IACxD,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC3D,MAAM,aAAa,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAEjE,IAAA,6BAAoB,EAAC;QACnB,aAAa;QACb,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;KACnC,CAAC,CAAC;IAEH,MAAM,IAAA,wBAAiB,EAAC;QACtB,IAAI,EAAE,mCAAmC;QACzC,UAAU;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE;QACvC,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,CAAC;KACZ,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,KAAK;IACzB,MAAM,IAAA,mCAAwB,GAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import "./module";
2
+ export * from "./module";
3
+ export * from "./overview";
4
+ export * from "./translations";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("./module");
18
+ __exportStar(require("./module"), exports);
19
+ __exportStar(require("./overview"), exports);
20
+ __exportStar(require("./translations"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pages/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAkB;AAElB,2CAAyB;AACzB,6CAA2B;AAC3B,iDAA+B"}
@@ -0,0 +1 @@
1
+ export declare const langModule: import("@antelopejs/interface-dms/dist/page").CategoryInfo;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.langModule = void 0;
4
+ const page_1 = require("@antelopejs/interface-dms/page");
5
+ exports.langModule = (0, page_1.RegisterModule)({
6
+ id: "lang",
7
+ title: "$dms_lang.title",
8
+ description: "$dms_lang.description",
9
+ icon: "i-ph-translate",
10
+ landingPage: "overview",
11
+ });
12
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/pages/module.ts"],"names":[],"mappings":";;;AAAA,yDAAgE;AAEnD,QAAA,UAAU,GAAG,IAAA,qBAAc,EAAC;IACvC,EAAE,EAAE,MAAM;IACV,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,uBAAuB;IACpC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,UAAU;CACxB,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ declare const LangOverviewController_base: {
2
+ new (...args: any[]): {};
3
+ extend: <T extends import("@antelopejs/interface-api").ControllerClass>(this: T, location: string) => T;
4
+ location: string;
5
+ };
6
+ export declare class LangOverviewController extends LangOverviewController_base {
7
+ static overviewComponent: import("@antelopejs/interface-dms").ComponentBuilder<unknown>;
8
+ }
9
+ export {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LangOverviewController = void 0;
10
+ const page_1 = require("@antelopejs/interface-dms/page");
11
+ const custom_1 = require("@antelopejs/interface-dms/base/custom");
12
+ const layouts_1 = require("@antelopejs/interface-dms/base/layouts");
13
+ let LangOverviewController = class LangOverviewController extends (0, page_1.PageController)("overview", {
14
+ displayName: "$dms_lang.overview.title",
15
+ module: "lang",
16
+ icon: "i-ph-gauge",
17
+ description: "$dms_lang.overview.description",
18
+ order: 0,
19
+ }, (0, layouts_1.DefaultLayout)({ fullWidth: true })) {
20
+ static overviewComponent = (0, custom_1.CustomComponent)("DmsLangOverview").meta({
21
+ name: "$dms_lang.overview.title",
22
+ icon: "i-ph-gauge",
23
+ });
24
+ };
25
+ exports.LangOverviewController = LangOverviewController;
26
+ exports.LangOverviewController = LangOverviewController = __decorate([
27
+ (0, page_1.RegisterPage)()
28
+ ], LangOverviewController);
29
+ //# sourceMappingURL=overview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overview.js","sourceRoot":"","sources":["../../src/pages/overview.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAA8E;AAC9E,kEAAwE;AACxE,oEAAuE;AAGhE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,IAAA,qBAAc,EACxD,UAAU,EACV;IACE,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,gCAAgC;IAC7C,KAAK,EAAE,CAAC;CACT,EACD,IAAA,uBAAa,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CACnC;IACC,MAAM,CAAC,iBAAiB,GAAG,IAAA,wBAAe,EAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC;QACjE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,YAAY;KACnB,CAAC,CAAC;;AAdQ,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAY,GAAE;GACF,sBAAsB,CAelC"}
@@ -0,0 +1,9 @@
1
+ declare const LangTranslationsController_base: {
2
+ new (...args: any[]): {};
3
+ extend: <T extends import("@antelopejs/interface-api").ControllerClass>(this: T, location: string) => T;
4
+ location: string;
5
+ };
6
+ export declare class LangTranslationsController extends LangTranslationsController_base {
7
+ static translationsComponent: import("@antelopejs/interface-dms").ComponentBuilder<unknown>;
8
+ }
9
+ export {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LangTranslationsController = void 0;
10
+ const page_1 = require("@antelopejs/interface-dms/page");
11
+ const custom_1 = require("@antelopejs/interface-dms/base/custom");
12
+ const layouts_1 = require("@antelopejs/interface-dms/base/layouts");
13
+ let LangTranslationsController = class LangTranslationsController extends (0, page_1.PageController)("translations", {
14
+ displayName: "$dms_lang.editor.title",
15
+ module: "lang",
16
+ icon: "i-ph-translate",
17
+ description: "$dms_lang.editor.description",
18
+ order: 1,
19
+ }, (0, layouts_1.DefaultLayout)({ fullWidth: true })) {
20
+ static translationsComponent = (0, custom_1.CustomComponent)("DmsLangTranslations").meta({
21
+ name: "$dms_lang.editor.title",
22
+ icon: "i-ph-translate",
23
+ });
24
+ };
25
+ exports.LangTranslationsController = LangTranslationsController;
26
+ exports.LangTranslationsController = LangTranslationsController = __decorate([
27
+ (0, page_1.RegisterPage)()
28
+ ], LangTranslationsController);
29
+ //# sourceMappingURL=translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.js","sourceRoot":"","sources":["../../src/pages/translations.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAA8E;AAC9E,kEAAwE;AACxE,oEAAuE;AAGhE,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,IAAA,qBAAc,EAC5D,cAAc,EACd;IACE,WAAW,EAAE,wBAAwB;IACrC,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,8BAA8B;IAC3C,KAAK,EAAE,CAAC;CACT,EACD,IAAA,uBAAa,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CACnC;IACC,MAAM,CAAC,qBAAqB,GAAG,IAAA,wBAAe,EAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC;QACzE,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,gBAAgB;KACvB,CAAC,CAAC;;AAdQ,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAY,GAAE;GACF,0BAA0B,CAetC"}
@@ -0,0 +1,2 @@
1
+ export * from "./publicLocales";
2
+ export * from "./translations";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./publicLocales"), exports);
18
+ __exportStar(require("./translations"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,iDAA+B"}
@@ -0,0 +1,6 @@
1
+ import { HTTPResult } from "@antelopejs/interface-api";
2
+ declare const PublicLocalesController_base: import("@antelopejs/interface-api").ControllerClass<object>;
3
+ export declare class PublicLocalesController extends PublicLocalesController_base {
4
+ locale(workspace: string, rawLocale: string): Record<string, unknown> | HTTPResult;
5
+ }
6
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.PublicLocalesController = void 0;
16
+ const interface_api_1 = require("@antelopejs/interface-api");
17
+ const workspaces_1 = require("../utils/workspaces");
18
+ const JSON_SUFFIX_RE = /\.json$/i;
19
+ class PublicLocalesController extends (0, interface_api_1.Controller)("/i18n") {
20
+ locale(workspace, rawLocale) {
21
+ const locale = rawLocale.replace(JSON_SUFFIX_RE, "");
22
+ let messages;
23
+ try {
24
+ messages = (0, workspaces_1.readWorkspaceLocale)(workspace, locale);
25
+ }
26
+ catch {
27
+ messages = null;
28
+ }
29
+ if (messages === null) {
30
+ return new interface_api_1.HTTPResult(404, {
31
+ error: `No such locale: ${workspace}/${locale}`,
32
+ });
33
+ }
34
+ return messages;
35
+ }
36
+ }
37
+ exports.PublicLocalesController = PublicLocalesController;
38
+ __decorate([
39
+ (0, interface_api_1.Get)("/:workspace/:locale"),
40
+ __param(0, (0, interface_api_1.Parameter)("workspace", "param")),
41
+ __param(1, (0, interface_api_1.Parameter)("locale", "param")),
42
+ __metadata("design:type", Function),
43
+ __metadata("design:paramtypes", [String, String]),
44
+ __metadata("design:returntype", void 0)
45
+ ], PublicLocalesController.prototype, "locale", null);
46
+ //# sourceMappingURL=publicLocales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicLocales.js","sourceRoot":"","sources":["../../src/routes/publicLocales.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAKmC;AACnC,oDAA0D;AAE1D,MAAM,cAAc,GAAG,UAAU,CAAC;AAElC,MAAa,uBAAwB,SAAQ,IAAA,0BAAU,EAAC,OAAO,CAAC;IAE9D,MAAM,CAC6B,SAAiB,EACpB,SAAiB;QAE/C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAErD,IAAI,QAAwC,CAAC;QAC7C,IAAI,CAAC;YACH,QAAQ,GAAG,IAAA,gCAAmB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;QAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,OAAO,IAAI,0BAAU,CAAC,GAAG,EAAE;gBACzB,KAAK,EAAE,mBAAmB,SAAS,IAAI,MAAM,EAAE;aAChD,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAvBD,0DAuBC;AArBC;IADC,IAAA,mBAAG,EAAC,qBAAqB,CAAC;IAExB,WAAA,IAAA,yBAAS,EAAC,WAAW,EAAE,OAAO,CAAC,CAAA;IAC/B,WAAA,IAAA,yBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;;;;qDAkB9B"}
@@ -0,0 +1,72 @@
1
+ import { type WorkspaceLocale, type WorkspaceSummary } from "../utils/workspaces";
2
+ interface WorkspaceCreateBody {
3
+ id: string;
4
+ locale: WorkspaceLocale;
5
+ }
6
+ interface WorkspaceRenameBody {
7
+ id: string;
8
+ newId: string;
9
+ }
10
+ interface WorkspaceDeleteBody {
11
+ id: string;
12
+ }
13
+ interface LocaleCreateBody {
14
+ workspace: string;
15
+ code: string;
16
+ name?: string;
17
+ flag?: string;
18
+ }
19
+ interface LocaleDeleteBody {
20
+ workspace: string;
21
+ code: string;
22
+ }
23
+ interface LocaleDefaultBody {
24
+ workspace: string;
25
+ code: string;
26
+ }
27
+ interface KeyUpsertBody {
28
+ workspace: string;
29
+ path: string;
30
+ values?: Record<string, unknown>;
31
+ defaultLocale?: string;
32
+ }
33
+ interface KeyRenameBody {
34
+ workspace: string;
35
+ path: string;
36
+ newPath: string;
37
+ }
38
+ interface KeyDeleteBody {
39
+ workspace: string;
40
+ path: string;
41
+ }
42
+ declare const TranslationsController_base: import("@antelopejs/interface-api").ControllerClass<object>;
43
+ export declare class TranslationsController extends TranslationsController_base {
44
+ workspaces(): {
45
+ editable: boolean;
46
+ workspaces: WorkspaceSummary[];
47
+ };
48
+ tree(defaultLocale?: string, workspace?: string): {
49
+ tree: import("../utils/tree").TreeItem[];
50
+ totalKeys: number;
51
+ };
52
+ progress(defaultLocale?: string, workspace?: string): {
53
+ localeProgress: Record<string, number>;
54
+ totalKeys: number;
55
+ };
56
+ flat(defaultLocale?: string, workspace?: string): import("../utils/resolve").FlatResult;
57
+ byPath(path?: string, workspace?: string): {
58
+ path: string;
59
+ translations: Record<string, import("../utils/tree").TranslationValue>;
60
+ inherited: Record<string, import("../utils/tree").TranslationValue> | undefined;
61
+ };
62
+ createWorkspace(body: WorkspaceCreateBody): void;
63
+ renameWorkspace(body: WorkspaceRenameBody): void;
64
+ deleteWorkspace(body: WorkspaceDeleteBody): void;
65
+ addLocale(body: LocaleCreateBody): void;
66
+ removeLocale(body: LocaleDeleteBody): void;
67
+ setDefaultLocale(body: LocaleDefaultBody): void;
68
+ upsertKey(body: KeyUpsertBody): void;
69
+ renameKey(body: KeyRenameBody): void;
70
+ deleteKey(body: KeyDeleteBody): void;
71
+ }
72
+ export {};