@_linked/translation 0.2.2
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 +102 -0
- package/lib/cjs/data/translation.json +8 -0
- package/lib/esm/archive.d.ts +133 -0
- package/lib/esm/archive.js +567 -0
- package/lib/esm/archive.js.map +1 -0
- package/lib/esm/authorization.d.ts +12 -0
- package/lib/esm/authorization.js +10 -0
- package/lib/esm/authorization.js.map +1 -0
- package/lib/esm/backend.d.ts +1 -0
- package/lib/esm/backend.js +3 -0
- package/lib/esm/backend.js.map +1 -0
- package/lib/esm/cdn-loader.d.ts +40 -0
- package/lib/esm/cdn-loader.js +200 -0
- package/lib/esm/cdn-loader.js.map +1 -0
- package/lib/esm/checks.d.ts +56 -0
- package/lib/esm/checks.js +288 -0
- package/lib/esm/checks.js.map +1 -0
- package/lib/esm/compile.d.ts +64 -0
- package/lib/esm/compile.js +99 -0
- package/lib/esm/compile.js.map +1 -0
- package/lib/esm/core/messages.d.ts +25 -0
- package/lib/esm/core/messages.js +76 -0
- package/lib/esm/core/messages.js.map +1 -0
- package/lib/esm/data/translation.json +8 -0
- package/lib/esm/discovery.d.ts +97 -0
- package/lib/esm/discovery.js +365 -0
- package/lib/esm/discovery.js.map +1 -0
- package/lib/esm/exchange.d.ts +100 -0
- package/lib/esm/exchange.js +223 -0
- package/lib/esm/exchange.js.map +1 -0
- package/lib/esm/export.d.ts +28 -0
- package/lib/esm/export.js +92 -0
- package/lib/esm/export.js.map +1 -0
- package/lib/esm/formats/csv.d.ts +8 -0
- package/lib/esm/formats/csv.js +397 -0
- package/lib/esm/formats/csv.js.map +1 -0
- package/lib/esm/formats/json.d.ts +30 -0
- package/lib/esm/formats/json.js +459 -0
- package/lib/esm/formats/json.js.map +1 -0
- package/lib/esm/formats/xliff.d.ts +12 -0
- package/lib/esm/formats/xliff.js +577 -0
- package/lib/esm/formats/xliff.js.map +1 -0
- package/lib/esm/import.d.ts +197 -0
- package/lib/esm/import.js +391 -0
- package/lib/esm/import.js.map +1 -0
- package/lib/esm/index.d.ts +42 -0
- package/lib/esm/index.js +34 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/key-sync-node.d.ts +29 -0
- package/lib/esm/key-sync-node.js +174 -0
- package/lib/esm/key-sync-node.js.map +1 -0
- package/lib/esm/key-sync.d.ts +46 -0
- package/lib/esm/key-sync.js +114 -0
- package/lib/esm/key-sync.js.map +1 -0
- package/lib/esm/key-version.d.ts +50 -0
- package/lib/esm/key-version.js +134 -0
- package/lib/esm/key-version.js.map +1 -0
- package/lib/esm/languages.d.ts +18 -0
- package/lib/esm/languages.js +74 -0
- package/lib/esm/languages.js.map +1 -0
- package/lib/esm/linked-discovery.d.ts +44 -0
- package/lib/esm/linked-discovery.js +267 -0
- package/lib/esm/linked-discovery.js.map +1 -0
- package/lib/esm/message-format.d.ts +41 -0
- package/lib/esm/message-format.js +133 -0
- package/lib/esm/message-format.js.map +1 -0
- package/lib/esm/mt.d.ts +111 -0
- package/lib/esm/mt.js +142 -0
- package/lib/esm/mt.js.map +1 -0
- package/lib/esm/ontologies/translation.d.ts +203 -0
- package/lib/esm/ontologies/translation.js +219 -0
- package/lib/esm/ontologies/translation.js.map +1 -0
- package/lib/esm/package.d.ts +4 -0
- package/lib/esm/package.js +11 -0
- package/lib/esm/package.js.map +1 -0
- package/lib/esm/react.d.ts +55 -0
- package/lib/esm/react.js +127 -0
- package/lib/esm/react.js.map +1 -0
- package/lib/esm/records.d.ts +151 -0
- package/lib/esm/records.js +2 -0
- package/lib/esm/records.js.map +1 -0
- package/lib/esm/release.d.ts +198 -0
- package/lib/esm/release.js +435 -0
- package/lib/esm/release.js.map +1 -0
- package/lib/esm/shape-catalog.d.ts +79 -0
- package/lib/esm/shape-catalog.js +118 -0
- package/lib/esm/shape-catalog.js.map +1 -0
- package/lib/esm/shapes/GlossaryTerm.d.ts +28 -0
- package/lib/esm/shapes/GlossaryTerm.js +94 -0
- package/lib/esm/shapes/GlossaryTerm.js.map +1 -0
- package/lib/esm/shapes/TranslationInventoryOrigin.d.ts +33 -0
- package/lib/esm/shapes/TranslationInventoryOrigin.js +209 -0
- package/lib/esm/shapes/TranslationInventoryOrigin.js.map +1 -0
- package/lib/esm/shapes/TranslationKey.d.ts +92 -0
- package/lib/esm/shapes/TranslationKey.js +194 -0
- package/lib/esm/shapes/TranslationKey.js.map +1 -0
- package/lib/esm/shapes/TranslationKeyVersion.d.ts +19 -0
- package/lib/esm/shapes/TranslationKeyVersion.js +125 -0
- package/lib/esm/shapes/TranslationKeyVersion.js.map +1 -0
- package/lib/esm/shapes/TranslationLanguage.d.ts +15 -0
- package/lib/esm/shapes/TranslationLanguage.js +102 -0
- package/lib/esm/shapes/TranslationLanguage.js.map +1 -0
- package/lib/esm/shapes/TranslationProvider.d.ts +409 -0
- package/lib/esm/shapes/TranslationProvider.js +1376 -0
- package/lib/esm/shapes/TranslationProvider.js.map +1 -0
- package/lib/esm/shapes/TranslationRelease.d.ts +36 -0
- package/lib/esm/shapes/TranslationRelease.js +149 -0
- package/lib/esm/shapes/TranslationRelease.js.map +1 -0
- package/lib/esm/shapes/TranslationRevision.d.ts +39 -0
- package/lib/esm/shapes/TranslationRevision.js +159 -0
- package/lib/esm/shapes/TranslationRevision.js.map +1 -0
- package/lib/esm/shapes/TranslationUnit.d.ts +26 -0
- package/lib/esm/shapes/TranslationUnit.js +111 -0
- package/lib/esm/shapes/TranslationUnit.js.map +1 -0
- package/package.json +134 -0
- package/src/archive.ts +894 -0
- package/src/authorization.ts +33 -0
- package/src/backend.ts +2 -0
- package/src/cdn-loader.ts +264 -0
- package/src/checks.ts +413 -0
- package/src/compile.ts +168 -0
- package/src/core/messages.ts +106 -0
- package/src/data/translation.json +8 -0
- package/src/discovery.ts +594 -0
- package/src/exchange.ts +428 -0
- package/src/export.ts +135 -0
- package/src/formats/csv.ts +459 -0
- package/src/formats/json.ts +587 -0
- package/src/formats/xliff.ts +708 -0
- package/src/import.ts +648 -0
- package/src/index.ts +207 -0
- package/src/key-sync-node.ts +269 -0
- package/src/key-sync.ts +168 -0
- package/src/key-version.ts +206 -0
- package/src/languages.ts +102 -0
- package/src/linked-discovery.ts +385 -0
- package/src/message-format.ts +214 -0
- package/src/mt.ts +248 -0
- package/src/ontologies/translation.ts +234 -0
- package/src/package.ts +19 -0
- package/src/react.tsx +250 -0
- package/src/records.ts +180 -0
- package/src/release.ts +726 -0
- package/src/shape-catalog.ts +198 -0
- package/src/shapes/GlossaryTerm.ts +61 -0
- package/src/shapes/TranslationInventoryOrigin.ts +131 -0
- package/src/shapes/TranslationKey.ts +174 -0
- package/src/shapes/TranslationKeyVersion.ts +77 -0
- package/src/shapes/TranslationLanguage.ts +51 -0
- package/src/shapes/TranslationProvider.ts +1755 -0
- package/src/shapes/TranslationRelease.ts +114 -0
- package/src/shapes/TranslationRevision.ts +105 -0
- package/src/shapes/TranslationUnit.ts +72 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Shape } from '@_linked/core/shapes/Shape';
|
|
2
|
+
import { literalProperty, objectProperty } from '@_linked/core/shapes/SHACL';
|
|
3
|
+
import { xsd } from '@_linked/core/ontologies/xsd';
|
|
4
|
+
import { Server } from '@_linked/server-utils/utils/Server';
|
|
5
|
+
import { tr } from '../ontologies/translation.js';
|
|
6
|
+
import { linkedShape } from '../package.js';
|
|
7
|
+
import type { TranslationReleaseRecord } from '../records.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Graph metadata for an immutable translation release. Key/language selections
|
|
11
|
+
* live in the content-addressed manifest rather than repeated RDF predicates.
|
|
12
|
+
*/
|
|
13
|
+
@linkedShape
|
|
14
|
+
export class TranslationRelease extends Shape {
|
|
15
|
+
static targetClass = tr.TranslationRelease;
|
|
16
|
+
|
|
17
|
+
@objectProperty({ path: tr.ofApplication, maxCount: 1 })
|
|
18
|
+
get ofApplication(): string {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objectProperty({ path: tr.branch, maxCount: 1 })
|
|
23
|
+
get branch(): string {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@literalProperty({ path: tr.releaseId, maxCount: 1 })
|
|
28
|
+
get releaseId(): string {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@literalProperty({ path: tr.buildId, maxCount: 1 })
|
|
33
|
+
get buildId(): string {
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@literalProperty({ path: tr.channel, maxCount: 1 })
|
|
38
|
+
get channel(): string {
|
|
39
|
+
return 'preview';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@literalProperty({ path: tr.status, maxCount: 1 })
|
|
43
|
+
get status(): string {
|
|
44
|
+
return 'draft';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@literalProperty({ path: tr.contractSetHash, maxCount: 1 })
|
|
48
|
+
get contractSetHash(): string {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@literalProperty({ path: tr.manifestHash, maxCount: 1 })
|
|
53
|
+
get manifestHash(): string {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@literalProperty({ path: tr.hotfixSequence, datatype: xsd.integer, maxCount: 1 })
|
|
58
|
+
get hotfixSequence(): number {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@literalProperty({ path: tr.createdAt, datatype: xsd.dateTime, maxCount: 1 })
|
|
63
|
+
get createdAt(): Date {
|
|
64
|
+
return new Date(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@literalProperty({ path: tr.publishedAt, datatype: xsd.dateTime, maxCount: 1 })
|
|
68
|
+
get publishedAt(): Date {
|
|
69
|
+
return new Date(0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@literalProperty({ path: tr.supportedUntil, datatype: xsd.dateTime, maxCount: 1 })
|
|
73
|
+
get supportedUntil(): Date {
|
|
74
|
+
return new Date(0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Canonical JSON summary; the full per-language detail also lives in the manifest. */
|
|
78
|
+
@literalProperty({ path: tr.qualitySummary, maxCount: 1 })
|
|
79
|
+
get qualitySummary(): string {
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@objectProperty({ path: tr.supersedes, shape: TranslationRelease, maxCount: 1 })
|
|
84
|
+
get supersedes(): TranslationRelease {
|
|
85
|
+
return undefined as any;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static list(data: { appId: string }) {
|
|
89
|
+
return Server.call(this, 'listReleases', data) as Promise<
|
|
90
|
+
TranslationReleaseRecord[]
|
|
91
|
+
>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static createRelease(
|
|
95
|
+
data: Omit<TranslationReleaseRecord, 'id' | 'createdAt'> & {
|
|
96
|
+
createdAt?: string;
|
|
97
|
+
},
|
|
98
|
+
) {
|
|
99
|
+
return Server.call(this, 'createRelease', data) as Promise<
|
|
100
|
+
TranslationReleaseRecord
|
|
101
|
+
>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static advanceHotfix(data: {
|
|
105
|
+
id: string;
|
|
106
|
+
expectedSequence: number;
|
|
107
|
+
hotfixSequence: number;
|
|
108
|
+
manifestHash: string;
|
|
109
|
+
}) {
|
|
110
|
+
return Server.call(this, 'advanceReleaseHotfix', data) as Promise<
|
|
111
|
+
TranslationReleaseRecord
|
|
112
|
+
>;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Shape } from '@_linked/core/shapes/Shape';
|
|
2
|
+
import { literalProperty, objectProperty } from '@_linked/core/shapes/SHACL';
|
|
3
|
+
import { xsd } from '@_linked/core/ontologies/xsd';
|
|
4
|
+
import { tr } from '../ontologies/translation.js';
|
|
5
|
+
import { linkedShape } from '../package.js';
|
|
6
|
+
import { TranslationKey } from './TranslationKey.js';
|
|
7
|
+
import { TranslationKeyVersion } from './TranslationKeyVersion.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* One authored value for a (key, language) cell — append-only (Plan 017 AD-P).
|
|
11
|
+
* A single primitive powers three workflows: change HISTORY (every direct edit
|
|
12
|
+
* records a `status:'applied'` revision), translator PROPOSALS (`proposed`,
|
|
13
|
+
* decided by a reviewer), and MT SUGGESTIONS (`suggested`, authorKind
|
|
14
|
+
* `machine`). The {@link TranslationUnit} stays the fast runtime/grid read
|
|
15
|
+
* path; revisions are never updated in place except their decision fields
|
|
16
|
+
* (`status`, `decidedAt`, `decidedBy`).
|
|
17
|
+
*/
|
|
18
|
+
@linkedShape
|
|
19
|
+
export class TranslationRevision extends Shape {
|
|
20
|
+
static targetClass = tr.TranslationRevision;
|
|
21
|
+
|
|
22
|
+
/** IRI of the owning Application (same app-scoping law as Key/Unit). */
|
|
23
|
+
@objectProperty({ path: tr.ofApplication, maxCount: 1 })
|
|
24
|
+
get ofApplication(): string {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The key, NOT the unit — revisions can exist before any unit does. */
|
|
29
|
+
@objectProperty({ path: tr.ofKey, shape: TranslationKey, maxCount: 1 })
|
|
30
|
+
get ofKey(): TranslationKey {
|
|
31
|
+
return undefined as any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@objectProperty({
|
|
35
|
+
path: tr.ofKeyVersion,
|
|
36
|
+
shape: TranslationKeyVersion,
|
|
37
|
+
maxCount: 1,
|
|
38
|
+
})
|
|
39
|
+
get ofKeyVersion(): TranslationKeyVersion {
|
|
40
|
+
return undefined as any;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** BCP-47 language tag, e.g. "es", "zh-Hans". */
|
|
44
|
+
@literalProperty({ path: tr.language, maxCount: 1 })
|
|
45
|
+
get language(): string {
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@literalProperty({ path: tr.text, maxCount: 1 })
|
|
50
|
+
get text(): string {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** applied | proposed | suggested | accepted | rejected | superseded. */
|
|
55
|
+
@literalProperty({ path: tr.status, maxCount: 1 })
|
|
56
|
+
get status(): string {
|
|
57
|
+
return 'applied';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** WebID of the human author, or the MT provider IRI. */
|
|
61
|
+
@objectProperty({ path: tr.author, maxCount: 1 })
|
|
62
|
+
get author(): string {
|
|
63
|
+
return '';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** 'human' | 'machine'. */
|
|
67
|
+
@literalProperty({ path: tr.authorKind, maxCount: 1 })
|
|
68
|
+
get authorKind(): string {
|
|
69
|
+
return 'human';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** MT provider key ('claude', 'deepl', …) when authorKind is 'machine'. */
|
|
73
|
+
@literalProperty({ path: tr.mtProvider, maxCount: 1 })
|
|
74
|
+
get mtProvider(): string {
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The unit's text when this revision was authored (conflict detection). */
|
|
79
|
+
@literalProperty({ path: tr.basedOnText, maxCount: 1 })
|
|
80
|
+
get basedOnText(): string {
|
|
81
|
+
return '';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Free-text translator/reviewer comment. */
|
|
85
|
+
@literalProperty({ path: tr.note, maxCount: 1 })
|
|
86
|
+
get note(): string {
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@literalProperty({ path: tr.createdAt, datatype: xsd.dateTime, maxCount: 1 })
|
|
91
|
+
get createdAt(): Date {
|
|
92
|
+
return new Date(0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@literalProperty({ path: tr.decidedAt, datatype: xsd.dateTime, maxCount: 1 })
|
|
96
|
+
get decidedAt(): Date {
|
|
97
|
+
return new Date(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** WebID of the reviewer who accepted/rejected a pending revision. */
|
|
101
|
+
@objectProperty({ path: tr.decidedBy, maxCount: 1 })
|
|
102
|
+
get decidedBy(): string {
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Shape } from '@_linked/core/shapes/Shape';
|
|
2
|
+
import { literalProperty, objectProperty } from '@_linked/core/shapes/SHACL';
|
|
3
|
+
import { xsd } from '@_linked/core/ontologies/xsd';
|
|
4
|
+
import { tr } from '../ontologies/translation.js';
|
|
5
|
+
import { linkedShape } from '../package.js';
|
|
6
|
+
import { TranslationKey } from './TranslationKey.js';
|
|
7
|
+
import { TranslationKeyVersion } from './TranslationKeyVersion.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* One language's value for a {@link TranslationKey} (Plan 014 AD-H). Explicit
|
|
11
|
+
* per-language node (not `rdf:langString`) so it can be filtered per-language
|
|
12
|
+
* through the LINKED DSL AND carry management metadata — review `state` and
|
|
13
|
+
* provenance — that a bare literal cannot hold.
|
|
14
|
+
*/
|
|
15
|
+
@linkedShape
|
|
16
|
+
export class TranslationUnit extends Shape {
|
|
17
|
+
static targetClass = tr.TranslationUnit;
|
|
18
|
+
|
|
19
|
+
/** IRI of the owning Application (explicitly app-scoped per Plan 014 AD-I). */
|
|
20
|
+
@objectProperty({ path: tr.ofApplication, maxCount: 1 })
|
|
21
|
+
get ofApplication(): string {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@objectProperty({ path: tr.ofKey, shape: TranslationKey, maxCount: 1 })
|
|
26
|
+
get ofKey(): TranslationKey {
|
|
27
|
+
return undefined as any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@objectProperty({
|
|
31
|
+
path: tr.ofKeyVersion,
|
|
32
|
+
shape: TranslationKeyVersion,
|
|
33
|
+
maxCount: 1,
|
|
34
|
+
})
|
|
35
|
+
get ofKeyVersion(): TranslationKeyVersion {
|
|
36
|
+
return undefined as any;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** BCP-47 language tag, e.g. "es", "zh-Hans". */
|
|
40
|
+
@literalProperty({ path: tr.language, maxCount: 1 })
|
|
41
|
+
get language(): string {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@literalProperty({ path: tr.text, maxCount: 1 })
|
|
46
|
+
get text(): string {
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** untranslated | machine | reviewed | stale. */
|
|
51
|
+
@literalProperty({ path: tr.state, maxCount: 1 })
|
|
52
|
+
get state(): string {
|
|
53
|
+
return 'untranslated';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@literalProperty({ path: tr.updatedAt, datatype: xsd.dateTime, maxCount: 1 })
|
|
57
|
+
get updatedAt(): Date {
|
|
58
|
+
return new Date(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** WebID (IRI) of the last editor. */
|
|
62
|
+
@objectProperty({ path: tr.updatedBy, maxCount: 1 })
|
|
63
|
+
get updatedBy(): string {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Current-value provenance (`tm` for exact translation-memory reuse). */
|
|
68
|
+
@literalProperty({ path: tr.origin, maxCount: 1 })
|
|
69
|
+
get origin(): string {
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
}
|