@antelopejs/dms-lang 0.4.0 → 0.5.0
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 +17 -8
- package/dist/pages/workspace.js +10 -1
- package/dist/pages/workspace.js.map +1 -1
- package/dist/routes/publicLocales.js +1 -1
- package/dist/routes/publicLocales.js.map +1 -1
- package/dist/utils/announce.js +2 -1
- package/dist/utils/announce.js.map +1 -1
- package/dist/utils/body.js +5 -1
- package/dist/utils/body.js.map +1 -1
- package/dist/utils/cache.d.ts +1 -1
- package/dist/utils/cache.js +11 -9
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/catalog.d.ts +1 -0
- package/dist/utils/catalog.js +6 -2
- package/dist/utils/catalog.js.map +1 -1
- package/dist/utils/errors.d.ts +5 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/export.d.ts +2 -2
- package/dist/utils/export.js +8 -6
- package/dist/utils/export.js.map +1 -1
- package/dist/utils/guards.d.ts +3 -0
- package/dist/utils/guards.js +15 -0
- package/dist/utils/guards.js.map +1 -0
- package/dist/utils/json.d.ts +16 -10
- package/dist/utils/json.js +48 -20
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/keys.d.ts +7 -6
- package/dist/utils/keys.js +4 -3
- package/dist/utils/keys.js.map +1 -1
- package/dist/utils/message-check.d.ts +2 -1
- package/dist/utils/message-check.js +7 -8
- package/dist/utils/message-check.js.map +1 -1
- package/dist/utils/public-url.d.ts +1 -0
- package/dist/utils/public-url.js +8 -8
- package/dist/utils/public-url.js.map +1 -1
- package/dist/utils/registry.d.ts +2 -2
- package/dist/utils/registry.js +2 -1
- package/dist/utils/registry.js.map +1 -1
- package/dist/utils/resolve.js +2 -1
- package/dist/utils/resolve.js.map +1 -1
- package/dist/utils/review.d.ts +2 -2
- package/dist/utils/review.js +2 -1
- package/dist/utils/review.js.map +1 -1
- package/dist/utils/snippets.js +2 -2
- package/dist/utils/snippets.js.map +1 -1
- package/dist/utils/tree.d.ts +7 -5
- package/dist/utils/tree.js +13 -7
- package/dist/utils/tree.js.map +1 -1
- package/dist/utils/workspaces.d.ts +3 -3
- package/dist/utils/workspaces.js +13 -6
- package/dist/utils/workspaces.js.map +1 -1
- package/dist/utils/write-target.d.ts +2 -1
- package/dist/utils/write-target.js +2 -2
- package/dist/utils/write-target.js.map +1 -1
- package/dist/validation/validate.js +1 -3
- package/dist/validation/validate.js.map +1 -1
- package/dist/validation/workspace.schema.d.ts +4 -3
- package/dist/validation/workspace.schema.js +5 -1
- package/dist/validation/workspace.schema.js.map +1 -1
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +28 -264
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +1 -4
- package/frontend-vue/app/build/composables/useCellSaves.ts +12 -16
- package/frontend-vue/app/build/composables/useMatrixExport.ts +97 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +8 -3
- package/frontend-vue/app/build/composables/useQueueToasts.ts +7 -4
- package/frontend-vue/app/build/drawer/KeyLanguageField.vue +308 -0
- package/frontend-vue/app/build/drawer/fieldStatus.ts +11 -0
- package/frontend-vue/app/build/matrix/MatrixDoneBanner.vue +36 -0
- package/frontend-vue/app/build/matrix/MatrixFooter.vue +61 -0
- package/frontend-vue/app/build/matrix/MatrixLanguageHeader.vue +52 -0
- package/frontend-vue/app/build/matrix/MatrixNoRows.vue +68 -0
- package/frontend-vue/app/components/LanguageNamespaces.vue +1 -1
- package/frontend-vue/app/components/NamespaceCoverage.vue +1 -1
- package/frontend-vue/app/components/TranslationMatrix.vue +40 -225
- package/frontend-vue/app/components/WorkspaceList.vue +1 -1
- package/frontend-vue/app/composables/translation/useMutationToast.ts +9 -12
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +8 -4
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +1 -1
- package/frontend-vue/app/utils/coverage.ts +139 -0
- package/frontend-vue/app/utils/translations.ts +1 -133
- package/frontend-vue/build/backend-boundary.ts +122 -0
- package/frontend-vue/dms.frontend.build.ts +3 -0
- package/frontend-vue/package.json +5 -5
- package/package.json +23 -12
- package/skills/dms-lang/SKILL.md +1 -1
- package/skills/dms-lang/cases.json +47 -0
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { baseCompile, CompileErrorCodes } from '@intlify/message-compiler'
|
|
2
|
-
import type {
|
|
3
|
-
FlatTranslationRow,
|
|
4
|
-
FlatTranslations,
|
|
5
|
-
LanguageCoverage,
|
|
6
|
-
NamespaceCoverage,
|
|
7
|
-
} from '../types/lang'
|
|
2
|
+
import type { FlatTranslationRow } from '../types/lang'
|
|
8
3
|
|
|
9
4
|
export type MessagePartKind =
|
|
10
5
|
'text' | 'placeholder' | 'literal' | 'linked' | 'pipe'
|
|
@@ -79,7 +74,6 @@ export type MessageTranslate = (
|
|
|
79
74
|
plural: number,
|
|
80
75
|
) => string
|
|
81
76
|
|
|
82
|
-
const FULL_COVERAGE = 100
|
|
83
77
|
export const NAMESPACE_SEPARATOR = '.'
|
|
84
78
|
const OPEN_BRACE = '{'
|
|
85
79
|
const CLOSE_BRACE = '}'
|
|
@@ -125,20 +119,6 @@ const SYNTAX_ESCAPES: Partial<Record<MessageIssueKind, string>> = {
|
|
|
125
119
|
strayBrace: "{'}'}",
|
|
126
120
|
}
|
|
127
121
|
|
|
128
|
-
export const HIGH_COVERAGE = 90
|
|
129
|
-
export const MID_COVERAGE = 60
|
|
130
|
-
|
|
131
|
-
export const EMPTY_FLAT: FlatTranslations = {
|
|
132
|
-
defaultLocale: '',
|
|
133
|
-
locales: [],
|
|
134
|
-
rows: [],
|
|
135
|
-
localeProgress: {},
|
|
136
|
-
localeMissing: {},
|
|
137
|
-
totalKeys: 0,
|
|
138
|
-
baseMissing: 0,
|
|
139
|
-
incompleteKeys: 0,
|
|
140
|
-
}
|
|
141
|
-
|
|
142
122
|
/** No value, or a text made of spaces only: the server stores neither. */
|
|
143
123
|
export function isLocaleValueMissing(value: unknown): boolean {
|
|
144
124
|
if (typeof value === 'string') return value.trim() === ''
|
|
@@ -638,118 +618,6 @@ export function replacePlaceholder(
|
|
|
638
618
|
.join('')
|
|
639
619
|
}
|
|
640
620
|
|
|
641
|
-
/**
|
|
642
|
-
* The share of `total` that is translated, in whole percent rounded down, so
|
|
643
|
-
* that one missing text keeps it under 100 (200 of 201 reads 99). Nothing to
|
|
644
|
-
* translate reads 100. The rule the server rounds every coverage with.
|
|
645
|
-
*/
|
|
646
|
-
export function coveragePercent(translated: number, total: number): number {
|
|
647
|
-
if (total <= 0) return FULL_COVERAGE
|
|
648
|
-
return Math.floor((Math.max(translated, 0) * FULL_COVERAGE) / total)
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export function coverageTone(
|
|
652
|
-
coverage: number,
|
|
653
|
-
): 'success' | 'warning' | 'error' {
|
|
654
|
-
if (coverage >= HIGH_COVERAGE) return 'success'
|
|
655
|
-
if (coverage >= MID_COVERAGE) return 'warning'
|
|
656
|
-
return 'error'
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
export function translatedCount(
|
|
660
|
-
rows: FlatTranslationRow[],
|
|
661
|
-
locale: string,
|
|
662
|
-
): number {
|
|
663
|
-
return rows.filter((row) => !isRowValueMissing(row, locale)).length
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
/** The coverage of each language, from the figures the server keeps. */
|
|
667
|
-
export function languageCoverage(
|
|
668
|
-
flat: FlatTranslations,
|
|
669
|
-
nameOf: (code: string) => string,
|
|
670
|
-
): LanguageCoverage[] {
|
|
671
|
-
return flat.locales.map((code) => {
|
|
672
|
-
const missing = flat.localeMissing[code] ?? 0
|
|
673
|
-
const translated = flat.totalKeys - missing
|
|
674
|
-
return {
|
|
675
|
-
code,
|
|
676
|
-
name: nameOf(code),
|
|
677
|
-
isBase: code === flat.defaultLocale,
|
|
678
|
-
coverage: coveragePercent(translated, flat.totalKeys),
|
|
679
|
-
translated,
|
|
680
|
-
missing,
|
|
681
|
-
}
|
|
682
|
-
})
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
function groupByNamespace(
|
|
686
|
-
rows: FlatTranslationRow[],
|
|
687
|
-
): Map<string, FlatTranslationRow[]> {
|
|
688
|
-
const groups = new Map<string, FlatTranslationRow[]>()
|
|
689
|
-
for (const row of rows) {
|
|
690
|
-
const namespace = namespaceOf(row.key)
|
|
691
|
-
const group = groups.get(namespace)
|
|
692
|
-
if (group) group.push(row)
|
|
693
|
-
else groups.set(namespace, [row])
|
|
694
|
-
}
|
|
695
|
-
return groups
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
export function namespaceCoverage(
|
|
699
|
-
rows: FlatTranslationRow[],
|
|
700
|
-
locales: string[],
|
|
701
|
-
): NamespaceCoverage[] {
|
|
702
|
-
return [...groupByNamespace(rows)].map(([namespace, group]) => {
|
|
703
|
-
const coverage: Record<string, number> = {}
|
|
704
|
-
const missing: Record<string, number> = {}
|
|
705
|
-
for (const locale of locales) {
|
|
706
|
-
const translated = translatedCount(group, locale)
|
|
707
|
-
coverage[locale] = coveragePercent(translated, group.length)
|
|
708
|
-
missing[locale] = group.length - translated
|
|
709
|
-
}
|
|
710
|
-
return { namespace, keys: group.length, coverage, missing }
|
|
711
|
-
})
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/** Where a key put back before `before` (a sibling key or namespace) goes: the end when none is there. */
|
|
715
|
-
function insertionIndex(rows: FlatTranslationRow[], before?: string): number {
|
|
716
|
-
if (before === undefined) return rows.length
|
|
717
|
-
const index = rows.findIndex(
|
|
718
|
-
(entry) =>
|
|
719
|
-
entry.key === before ||
|
|
720
|
-
entry.key.startsWith(`${before}${NAMESPACE_SEPARATOR}`),
|
|
721
|
-
)
|
|
722
|
-
return index < 0 ? rows.length : index
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
* The translations with one row put in place: replaced, added (before the
|
|
727
|
-
* `before` sibling, else at the end), or taken out when there is none (the
|
|
728
|
-
* key is gone). The other rows are kept as they are.
|
|
729
|
-
*/
|
|
730
|
-
export function withRow(
|
|
731
|
-
flat: FlatTranslations,
|
|
732
|
-
key: string,
|
|
733
|
-
row: FlatTranslationRow | undefined,
|
|
734
|
-
before?: string,
|
|
735
|
-
): FlatTranslations {
|
|
736
|
-
const index = flat.rows.findIndex((entry) => entry.key === key)
|
|
737
|
-
const rows = [...flat.rows]
|
|
738
|
-
if (row && index >= 0) rows[index] = row
|
|
739
|
-
else if (row) rows.splice(insertionIndex(rows, before), 0, row)
|
|
740
|
-
else if (index >= 0) rows.splice(index, 1)
|
|
741
|
-
return { ...flat, rows }
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
export const COVERAGE_TEXT_CLASSES: Record<
|
|
745
|
-
'success' | 'warning' | 'error',
|
|
746
|
-
string
|
|
747
|
-
> = {
|
|
748
|
-
success: 'text-success',
|
|
749
|
-
warning: 'text-warning',
|
|
750
|
-
error: 'text-error',
|
|
751
|
-
}
|
|
752
|
-
|
|
753
621
|
/** Placeholder names written as they appear in a text: `{name} {count}`. */
|
|
754
622
|
export function formatTokens(names: string[]): string {
|
|
755
623
|
return names.map((name) => `{${name}}`).join(' ')
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs'
|
|
2
|
+
import { dirname, isAbsolute, join, relative, sep } from 'node:path'
|
|
3
|
+
import type { DmsVitePluginEntry } from '#dms/frontend-build'
|
|
4
|
+
|
|
5
|
+
type VitePlugin = Extract<DmsVitePluginEntry, { name: string }>
|
|
6
|
+
|
|
7
|
+
const BACKEND_PACKAGE = '@antelopejs/dms-lang'
|
|
8
|
+
const BACKEND_SOURCE = 'src'
|
|
9
|
+
const QUERY_OR_HASH = /[?#].*$/
|
|
10
|
+
|
|
11
|
+
const backendRoots = new Map<string, string | null>()
|
|
12
|
+
|
|
13
|
+
/** Whether a parsed manifest names its package. */
|
|
14
|
+
function isNamedManifest(value: unknown): value is { name: string } {
|
|
15
|
+
return (
|
|
16
|
+
typeof value === 'object' &&
|
|
17
|
+
value !== null &&
|
|
18
|
+
'name' in value &&
|
|
19
|
+
typeof value.name === 'string'
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The package name a `package.json` declares, or `undefined`. */
|
|
24
|
+
function packageName(manifest: string): string | undefined {
|
|
25
|
+
try {
|
|
26
|
+
const parsed: unknown = JSON.parse(readFileSync(manifest, 'utf8'))
|
|
27
|
+
return isNamedManifest(parsed) ? parsed.name : undefined
|
|
28
|
+
} catch {
|
|
29
|
+
return undefined
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The directory of the backend package that holds `directory`, or null. */
|
|
34
|
+
function backendRoot(directory: string): string | null {
|
|
35
|
+
const known = backendRoots.get(directory)
|
|
36
|
+
if (known !== undefined) {
|
|
37
|
+
return known
|
|
38
|
+
}
|
|
39
|
+
const manifest = join(directory, 'package.json')
|
|
40
|
+
const parent = dirname(directory)
|
|
41
|
+
let root: string | null = null
|
|
42
|
+
if (existsSync(manifest)) {
|
|
43
|
+
root = packageName(manifest) === BACKEND_PACKAGE ? directory : null
|
|
44
|
+
} else if (parent !== directory) {
|
|
45
|
+
root = backendRoot(parent)
|
|
46
|
+
}
|
|
47
|
+
backendRoots.set(directory, root)
|
|
48
|
+
return root
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The real path of a resolved module id when it lies under the `src`
|
|
53
|
+
* directory of the backend package, or `undefined`. The package that owns the
|
|
54
|
+
* file decides, not a path, so the answer is the same in the repository and in
|
|
55
|
+
* the build workspace. Virtual ids and ids that are not files are ignored.
|
|
56
|
+
*/
|
|
57
|
+
function backendSourceFile(id: string): string | undefined {
|
|
58
|
+
const path = id.replace(QUERY_OR_HASH, '')
|
|
59
|
+
if (!isAbsolute(path)) {
|
|
60
|
+
return undefined
|
|
61
|
+
}
|
|
62
|
+
let real: string
|
|
63
|
+
try {
|
|
64
|
+
real = realpathSync(path)
|
|
65
|
+
} catch {
|
|
66
|
+
return undefined
|
|
67
|
+
}
|
|
68
|
+
const root = backendRoot(dirname(real))
|
|
69
|
+
if (root === null) {
|
|
70
|
+
return undefined
|
|
71
|
+
}
|
|
72
|
+
return relative(root, real).split(sep)[0] === BACKEND_SOURCE
|
|
73
|
+
? real
|
|
74
|
+
: undefined
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Fails the build and the dev server when a module of the frontend resolves to
|
|
79
|
+
* a file under the `src` of the backend package: the browser reaches the
|
|
80
|
+
* backend only through its HTTP interface. It checks what the whole resolution
|
|
81
|
+
* chain returns, an id marked external included, so an alias is seen through
|
|
82
|
+
* and a symlink the resolver returns is followed to its real path, and it runs
|
|
83
|
+
* before the other plugins (`enforce: "pre"`). Vite builds workers with their
|
|
84
|
+
* own plugin list, so the plugin adds itself there too.
|
|
85
|
+
*
|
|
86
|
+
* antelopejs-sync writes this file from `@antelopejs/tooling-configs` and
|
|
87
|
+
* restores it on every run: change the plugin in the pack, not here.
|
|
88
|
+
*/
|
|
89
|
+
export function backendBoundary(): VitePlugin {
|
|
90
|
+
return {
|
|
91
|
+
...boundaryCheck(),
|
|
92
|
+
config: () => ({ worker: { plugins: () => [boundaryCheck()] } }),
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** The check alone, as a worker build runs it. */
|
|
97
|
+
function boundaryCheck(): VitePlugin {
|
|
98
|
+
return {
|
|
99
|
+
name: `${BACKEND_PACKAGE}:backend-boundary`,
|
|
100
|
+
enforce: 'pre',
|
|
101
|
+
async resolveId(source, importer, options) {
|
|
102
|
+
const resolved = await this.resolve(source, importer, {
|
|
103
|
+
...options,
|
|
104
|
+
skipSelf: true,
|
|
105
|
+
})
|
|
106
|
+
if (resolved === null) {
|
|
107
|
+
return resolved
|
|
108
|
+
}
|
|
109
|
+
const file = backendSourceFile(resolved.id)
|
|
110
|
+
if (file === undefined) {
|
|
111
|
+
return resolved
|
|
112
|
+
}
|
|
113
|
+
const from =
|
|
114
|
+
importer === undefined
|
|
115
|
+
? 'an entry point'
|
|
116
|
+
: importer.replace(QUERY_OR_HASH, '')
|
|
117
|
+
return this.error(
|
|
118
|
+
`Backend boundary: ${from} imports ${file}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineDmsFrontendBuild } from '#dms/frontend-build'
|
|
2
|
+
import { backendBoundary } from './build/backend-boundary.ts'
|
|
2
3
|
|
|
4
|
+
/** The build of the frontend module: its auto-imports, and the backend boundary in every build. */
|
|
3
5
|
export default defineDmsFrontendBuild((build) => {
|
|
4
6
|
build.registerAutoImports(['app/composables', 'app/utils', 'app/types'])
|
|
7
|
+
build.registerVitePlugins(() => [backendBoundary()])
|
|
5
8
|
})
|
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"packageManager": "pnpm@10.6.5",
|
|
9
9
|
"engines": {
|
|
10
|
-
"@antelopejs/dms-frontend": ">=0.
|
|
10
|
+
"@antelopejs/dms-frontend": ">=0.9.2 <0.10.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "ajs dms build",
|
|
14
|
-
"dev": "
|
|
13
|
+
"build": "pnpm --dir ../playground exec ajs dms build",
|
|
14
|
+
"dev": "pnpm --dir ../playground frontend:dev",
|
|
15
15
|
"prepare-frontend": "ajs dms prepare",
|
|
16
16
|
"format": "prettier --write .",
|
|
17
17
|
"lint": "eslint .",
|
|
18
18
|
"lint:fix": "eslint . --fix"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@antelopejs/core": "1.
|
|
22
|
-
"@antelopejs/dms-frontend": "0.
|
|
21
|
+
"@antelopejs/core": "1.17.1",
|
|
22
|
+
"@antelopejs/dms-frontend": "0.9.2",
|
|
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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-lang",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Language and translation management for the AntelopeJS DMS: coverage overview, translation matrix, translation queue and public translation workspaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -46,37 +46,47 @@
|
|
|
46
46
|
"frontend:dev": "cd playground && pnpm frontend:dev",
|
|
47
47
|
"dev": "ajs project dev -w -p playground",
|
|
48
48
|
"lint:fix": "oxlint --fix --max-warnings=1000000 && oxfmt . && pnpm --dir frontend-vue lint:fix",
|
|
49
|
-
"lint": "oxlint &&
|
|
49
|
+
"lint": "oxlint && pnpm --dir frontend-vue lint && node node_modules/@antelopejs/dms/frontend-vue/scripts/check-api-error-presentation.mjs frontend-vue/app playground/frontend-vue && node scripts/check-locales.mts && node scripts/check-dms-versions.mjs && antelopejs-check-interface-ranges",
|
|
50
50
|
"typecheck": "tsc --noEmit",
|
|
51
51
|
"format": "oxfmt . && pnpm --dir frontend-vue format",
|
|
52
|
-
"test": "[ -n \"$DMS_PREBUILT\" ] || pnpm run build && ajs module test .",
|
|
52
|
+
"test": "[ -n \"$DMS_PREBUILT\" ] || pnpm run build && DMS_PREBUILT=1 ajs module test . && node --test tests/*.test.mjs",
|
|
53
53
|
"test:unit": "[ -n \"$DMS_PREBUILT\" ] || pnpm run build && mocha dist/test/locale-discovery.test.js dist/test/write-target.test.js && node --test tests/*.test.mjs",
|
|
54
54
|
"test:node": "[ -n \"$DMS_PREBUILT\" ] || pnpm run build && node --test tests/*.test.mjs",
|
|
55
55
|
"test:frontend": "ajs dms verify-source --layer node_modules/@antelopejs/dms/frontend-vue --module frontend-vue",
|
|
56
|
-
"release": "pnpm run lint && release-it",
|
|
56
|
+
"release": "pnpm run lint && pnpm run format:check && release-it",
|
|
57
57
|
"prepack": "pnpm run build",
|
|
58
|
-
"knip": "knip
|
|
59
|
-
"
|
|
58
|
+
"knip": "knip",
|
|
59
|
+
"prepare": "if git rev-parse --is-inside-work-tree >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1; then lefthook install; fi",
|
|
60
|
+
"checks": "antelopejs-checks",
|
|
61
|
+
"size": "antelopejs-check-size",
|
|
62
|
+
"ratchet": "antelopejs-ratchet",
|
|
63
|
+
"sync": "antelopejs-sync",
|
|
64
|
+
"ratchet:update": "antelopejs-ratchet --update",
|
|
65
|
+
"sync:check": "antelopejs-sync --check",
|
|
66
|
+
"format:check": "oxfmt --check .",
|
|
67
|
+
"suppressions": "antelopejs-suppressions",
|
|
68
|
+
"suppressions:update": "antelopejs-suppressions --update"
|
|
60
69
|
},
|
|
61
70
|
"dependencies": {
|
|
62
71
|
"@antelopejs/interface-api": ">=0.0.15 <1.0.0",
|
|
63
72
|
"@antelopejs/interface-api-util": ">=0.1.3 <1.0.0",
|
|
64
73
|
"@antelopejs/interface-core": ">=0.2.4 <1.0.0",
|
|
65
|
-
"@antelopejs/interface-dms": ">=0.
|
|
74
|
+
"@antelopejs/interface-dms": ">=0.9.0 <1.0.0",
|
|
66
75
|
"@intlify/message-compiler": "^11.1.12",
|
|
67
76
|
"zod": "~3.24.2"
|
|
68
77
|
},
|
|
69
78
|
"devDependencies": {
|
|
70
|
-
"@antelopejs/core": "1.17.
|
|
71
|
-
"@antelopejs/dms": ">=0.
|
|
72
|
-
"@antelopejs/dms-frontend": "0.
|
|
73
|
-
"@antelopejs/tooling-configs": "
|
|
79
|
+
"@antelopejs/core": "1.17.1",
|
|
80
|
+
"@antelopejs/dms": ">=0.13.1 <1.0.0",
|
|
81
|
+
"@antelopejs/dms-frontend": "0.9.2",
|
|
82
|
+
"@antelopejs/tooling-configs": "^0.2.17",
|
|
74
83
|
"@types/chai": "^5.2.3",
|
|
75
84
|
"@types/mocha": "^10.0.10",
|
|
76
85
|
"@types/node": "^24.0.0",
|
|
77
86
|
"@types/semver": "^7.8.0",
|
|
78
87
|
"chai": "^6.2.2",
|
|
79
88
|
"knip": "^6.34.0",
|
|
89
|
+
"lefthook": "^2.2.2",
|
|
80
90
|
"mocha": "^12.0.0",
|
|
81
91
|
"mongodb-memory-server-core": "^11.2.0",
|
|
82
92
|
"oxfmt": "^0.66.0",
|
|
@@ -85,7 +95,8 @@
|
|
|
85
95
|
"release-it": "^19.2.4",
|
|
86
96
|
"release-it-changelogen": "^0.1.0",
|
|
87
97
|
"rimraf": "^6.1.3",
|
|
88
|
-
"typescript": "^6.0.3"
|
|
98
|
+
"typescript": "^6.0.3",
|
|
99
|
+
"vue": "^3.5.0"
|
|
89
100
|
},
|
|
90
101
|
"packageManager": "pnpm@10.2.0",
|
|
91
102
|
"antelopeJs": {
|
package/skills/dms-lang/SKILL.md
CHANGED
|
@@ -28,7 +28,7 @@ ajs project modules add @antelopejs/dms-lang
|
|
|
28
28
|
- Writes to the project files go to the file defining the key; a new key goes to the file holding its longest namespace, else to `app-<xx-XX>.json`, else to the last file of the language. A rename stays in the key's file.
|
|
29
29
|
- Frontend modules registered or removed after Lang started (in their own `construct`/`start`) are picked up as soon as they register (the DMS fires `FrontendModulesChanged`), no restart; file edits show on the next read.
|
|
30
30
|
- `config.workspacesDir` stores the created workspaces outside the module's install folder (default `i18n-workspaces/` inside it, wiped by a reinstall).
|
|
31
|
-
- Lang 0.
|
|
31
|
+
- Lang 0.4.1 requires `@antelopejs/dms` >=0.11 (interface-dms 0.9, renderer `@antelopejs/dms-frontend` 0.9); Lang 0.4.0 is the DMS 0.10 line.
|
|
32
32
|
|
|
33
33
|
## Workspaces
|
|
34
34
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"cases": [
|
|
4
|
+
{
|
|
5
|
+
"id": "lang-translate-dashboard",
|
|
6
|
+
"area": "modules",
|
|
7
|
+
"style": "clean",
|
|
8
|
+
"prompt": "Translate the dashboard into German.",
|
|
9
|
+
"expect": {
|
|
10
|
+
"skills": ["dms-lang"],
|
|
11
|
+
"acceptable": ["dms", "dms-pages"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "lang-raw-keys-casual",
|
|
16
|
+
"area": "modules",
|
|
17
|
+
"style": "casual",
|
|
18
|
+
"prompt": "some labels show the raw i18n key instead of the text",
|
|
19
|
+
"expect": {
|
|
20
|
+
"skills": ["dms-lang"],
|
|
21
|
+
"acceptable": ["dms", "dms-pages"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "dms-lang-readonly-project-files",
|
|
26
|
+
"area": "modules",
|
|
27
|
+
"style": "clean",
|
|
28
|
+
"prompt": "I installed dms-lang but every edit fails with a read-only error and my app-en-GB.json is not listed as the project workspace. What do I configure?",
|
|
29
|
+
"expect": {
|
|
30
|
+
"skills": ["dms-lang"],
|
|
31
|
+
"acceptable": ["dms", "dms-project"],
|
|
32
|
+
"mustMention": ["editable", "dmsI18nAppLayer"]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "dms-lang-not-mail-locale",
|
|
37
|
+
"area": "modules",
|
|
38
|
+
"style": "clean",
|
|
39
|
+
"prompt": "My welcome e-mail template needs a Dutch version, and a send should fall back to English when the recipient's locale is missing.",
|
|
40
|
+
"expect": {
|
|
41
|
+
"skills": ["dms-mailing"],
|
|
42
|
+
"acceptable": ["dms"],
|
|
43
|
+
"avoid": ["dms-lang"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|