@_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.
Files changed (153) hide show
  1. package/README.md +102 -0
  2. package/lib/cjs/data/translation.json +8 -0
  3. package/lib/esm/archive.d.ts +133 -0
  4. package/lib/esm/archive.js +567 -0
  5. package/lib/esm/archive.js.map +1 -0
  6. package/lib/esm/authorization.d.ts +12 -0
  7. package/lib/esm/authorization.js +10 -0
  8. package/lib/esm/authorization.js.map +1 -0
  9. package/lib/esm/backend.d.ts +1 -0
  10. package/lib/esm/backend.js +3 -0
  11. package/lib/esm/backend.js.map +1 -0
  12. package/lib/esm/cdn-loader.d.ts +40 -0
  13. package/lib/esm/cdn-loader.js +200 -0
  14. package/lib/esm/cdn-loader.js.map +1 -0
  15. package/lib/esm/checks.d.ts +56 -0
  16. package/lib/esm/checks.js +288 -0
  17. package/lib/esm/checks.js.map +1 -0
  18. package/lib/esm/compile.d.ts +64 -0
  19. package/lib/esm/compile.js +99 -0
  20. package/lib/esm/compile.js.map +1 -0
  21. package/lib/esm/core/messages.d.ts +25 -0
  22. package/lib/esm/core/messages.js +76 -0
  23. package/lib/esm/core/messages.js.map +1 -0
  24. package/lib/esm/data/translation.json +8 -0
  25. package/lib/esm/discovery.d.ts +97 -0
  26. package/lib/esm/discovery.js +365 -0
  27. package/lib/esm/discovery.js.map +1 -0
  28. package/lib/esm/exchange.d.ts +100 -0
  29. package/lib/esm/exchange.js +223 -0
  30. package/lib/esm/exchange.js.map +1 -0
  31. package/lib/esm/export.d.ts +28 -0
  32. package/lib/esm/export.js +92 -0
  33. package/lib/esm/export.js.map +1 -0
  34. package/lib/esm/formats/csv.d.ts +8 -0
  35. package/lib/esm/formats/csv.js +397 -0
  36. package/lib/esm/formats/csv.js.map +1 -0
  37. package/lib/esm/formats/json.d.ts +30 -0
  38. package/lib/esm/formats/json.js +459 -0
  39. package/lib/esm/formats/json.js.map +1 -0
  40. package/lib/esm/formats/xliff.d.ts +12 -0
  41. package/lib/esm/formats/xliff.js +577 -0
  42. package/lib/esm/formats/xliff.js.map +1 -0
  43. package/lib/esm/import.d.ts +197 -0
  44. package/lib/esm/import.js +391 -0
  45. package/lib/esm/import.js.map +1 -0
  46. package/lib/esm/index.d.ts +42 -0
  47. package/lib/esm/index.js +34 -0
  48. package/lib/esm/index.js.map +1 -0
  49. package/lib/esm/key-sync-node.d.ts +29 -0
  50. package/lib/esm/key-sync-node.js +174 -0
  51. package/lib/esm/key-sync-node.js.map +1 -0
  52. package/lib/esm/key-sync.d.ts +46 -0
  53. package/lib/esm/key-sync.js +114 -0
  54. package/lib/esm/key-sync.js.map +1 -0
  55. package/lib/esm/key-version.d.ts +50 -0
  56. package/lib/esm/key-version.js +134 -0
  57. package/lib/esm/key-version.js.map +1 -0
  58. package/lib/esm/languages.d.ts +18 -0
  59. package/lib/esm/languages.js +74 -0
  60. package/lib/esm/languages.js.map +1 -0
  61. package/lib/esm/linked-discovery.d.ts +44 -0
  62. package/lib/esm/linked-discovery.js +267 -0
  63. package/lib/esm/linked-discovery.js.map +1 -0
  64. package/lib/esm/message-format.d.ts +41 -0
  65. package/lib/esm/message-format.js +133 -0
  66. package/lib/esm/message-format.js.map +1 -0
  67. package/lib/esm/mt.d.ts +111 -0
  68. package/lib/esm/mt.js +142 -0
  69. package/lib/esm/mt.js.map +1 -0
  70. package/lib/esm/ontologies/translation.d.ts +203 -0
  71. package/lib/esm/ontologies/translation.js +219 -0
  72. package/lib/esm/ontologies/translation.js.map +1 -0
  73. package/lib/esm/package.d.ts +4 -0
  74. package/lib/esm/package.js +11 -0
  75. package/lib/esm/package.js.map +1 -0
  76. package/lib/esm/react.d.ts +55 -0
  77. package/lib/esm/react.js +127 -0
  78. package/lib/esm/react.js.map +1 -0
  79. package/lib/esm/records.d.ts +151 -0
  80. package/lib/esm/records.js +2 -0
  81. package/lib/esm/records.js.map +1 -0
  82. package/lib/esm/release.d.ts +198 -0
  83. package/lib/esm/release.js +435 -0
  84. package/lib/esm/release.js.map +1 -0
  85. package/lib/esm/shape-catalog.d.ts +79 -0
  86. package/lib/esm/shape-catalog.js +118 -0
  87. package/lib/esm/shape-catalog.js.map +1 -0
  88. package/lib/esm/shapes/GlossaryTerm.d.ts +28 -0
  89. package/lib/esm/shapes/GlossaryTerm.js +94 -0
  90. package/lib/esm/shapes/GlossaryTerm.js.map +1 -0
  91. package/lib/esm/shapes/TranslationInventoryOrigin.d.ts +33 -0
  92. package/lib/esm/shapes/TranslationInventoryOrigin.js +209 -0
  93. package/lib/esm/shapes/TranslationInventoryOrigin.js.map +1 -0
  94. package/lib/esm/shapes/TranslationKey.d.ts +92 -0
  95. package/lib/esm/shapes/TranslationKey.js +194 -0
  96. package/lib/esm/shapes/TranslationKey.js.map +1 -0
  97. package/lib/esm/shapes/TranslationKeyVersion.d.ts +19 -0
  98. package/lib/esm/shapes/TranslationKeyVersion.js +125 -0
  99. package/lib/esm/shapes/TranslationKeyVersion.js.map +1 -0
  100. package/lib/esm/shapes/TranslationLanguage.d.ts +15 -0
  101. package/lib/esm/shapes/TranslationLanguage.js +102 -0
  102. package/lib/esm/shapes/TranslationLanguage.js.map +1 -0
  103. package/lib/esm/shapes/TranslationProvider.d.ts +409 -0
  104. package/lib/esm/shapes/TranslationProvider.js +1376 -0
  105. package/lib/esm/shapes/TranslationProvider.js.map +1 -0
  106. package/lib/esm/shapes/TranslationRelease.d.ts +36 -0
  107. package/lib/esm/shapes/TranslationRelease.js +149 -0
  108. package/lib/esm/shapes/TranslationRelease.js.map +1 -0
  109. package/lib/esm/shapes/TranslationRevision.d.ts +39 -0
  110. package/lib/esm/shapes/TranslationRevision.js +159 -0
  111. package/lib/esm/shapes/TranslationRevision.js.map +1 -0
  112. package/lib/esm/shapes/TranslationUnit.d.ts +26 -0
  113. package/lib/esm/shapes/TranslationUnit.js +111 -0
  114. package/lib/esm/shapes/TranslationUnit.js.map +1 -0
  115. package/package.json +134 -0
  116. package/src/archive.ts +894 -0
  117. package/src/authorization.ts +33 -0
  118. package/src/backend.ts +2 -0
  119. package/src/cdn-loader.ts +264 -0
  120. package/src/checks.ts +413 -0
  121. package/src/compile.ts +168 -0
  122. package/src/core/messages.ts +106 -0
  123. package/src/data/translation.json +8 -0
  124. package/src/discovery.ts +594 -0
  125. package/src/exchange.ts +428 -0
  126. package/src/export.ts +135 -0
  127. package/src/formats/csv.ts +459 -0
  128. package/src/formats/json.ts +587 -0
  129. package/src/formats/xliff.ts +708 -0
  130. package/src/import.ts +648 -0
  131. package/src/index.ts +207 -0
  132. package/src/key-sync-node.ts +269 -0
  133. package/src/key-sync.ts +168 -0
  134. package/src/key-version.ts +206 -0
  135. package/src/languages.ts +102 -0
  136. package/src/linked-discovery.ts +385 -0
  137. package/src/message-format.ts +214 -0
  138. package/src/mt.ts +248 -0
  139. package/src/ontologies/translation.ts +234 -0
  140. package/src/package.ts +19 -0
  141. package/src/react.tsx +250 -0
  142. package/src/records.ts +180 -0
  143. package/src/release.ts +726 -0
  144. package/src/shape-catalog.ts +198 -0
  145. package/src/shapes/GlossaryTerm.ts +61 -0
  146. package/src/shapes/TranslationInventoryOrigin.ts +131 -0
  147. package/src/shapes/TranslationKey.ts +174 -0
  148. package/src/shapes/TranslationKeyVersion.ts +77 -0
  149. package/src/shapes/TranslationLanguage.ts +51 -0
  150. package/src/shapes/TranslationProvider.ts +1755 -0
  151. package/src/shapes/TranslationRelease.ts +114 -0
  152. package/src/shapes/TranslationRevision.ts +105 -0
  153. package/src/shapes/TranslationUnit.ts +72 -0
@@ -0,0 +1,111 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Shape } from '@_linked/core/shapes/Shape';
11
+ import { literalProperty, objectProperty } from '@_linked/core/shapes/SHACL';
12
+ import { xsd } from '@_linked/core/ontologies/xsd';
13
+ import { tr } from '../ontologies/translation.js';
14
+ import { linkedShape } from '../package.js';
15
+ import { TranslationKey } from './TranslationKey.js';
16
+ import { TranslationKeyVersion } from './TranslationKeyVersion.js';
17
+ /**
18
+ * One language's value for a {@link TranslationKey} (Plan 014 AD-H). Explicit
19
+ * per-language node (not `rdf:langString`) so it can be filtered per-language
20
+ * through the LINKED DSL AND carry management metadata — review `state` and
21
+ * provenance — that a bare literal cannot hold.
22
+ */
23
+ let TranslationUnit = class TranslationUnit extends Shape {
24
+ /** IRI of the owning Application (explicitly app-scoped per Plan 014 AD-I). */
25
+ get ofApplication() {
26
+ return '';
27
+ }
28
+ get ofKey() {
29
+ return undefined;
30
+ }
31
+ get ofKeyVersion() {
32
+ return undefined;
33
+ }
34
+ /** BCP-47 language tag, e.g. "es", "zh-Hans". */
35
+ get language() {
36
+ return '';
37
+ }
38
+ get text() {
39
+ return '';
40
+ }
41
+ /** untranslated | machine | reviewed | stale. */
42
+ get state() {
43
+ return 'untranslated';
44
+ }
45
+ get updatedAt() {
46
+ return new Date(0);
47
+ }
48
+ /** WebID (IRI) of the last editor. */
49
+ get updatedBy() {
50
+ return '';
51
+ }
52
+ /** Current-value provenance (`tm` for exact translation-memory reuse). */
53
+ get origin() {
54
+ return '';
55
+ }
56
+ };
57
+ TranslationUnit.targetClass = tr.TranslationUnit;
58
+ __decorate([
59
+ objectProperty({ path: tr.ofApplication, maxCount: 1 }),
60
+ __metadata("design:type", String),
61
+ __metadata("design:paramtypes", [])
62
+ ], TranslationUnit.prototype, "ofApplication", null);
63
+ __decorate([
64
+ objectProperty({ path: tr.ofKey, shape: TranslationKey, maxCount: 1 }),
65
+ __metadata("design:type", TranslationKey),
66
+ __metadata("design:paramtypes", [])
67
+ ], TranslationUnit.prototype, "ofKey", null);
68
+ __decorate([
69
+ objectProperty({
70
+ path: tr.ofKeyVersion,
71
+ shape: TranslationKeyVersion,
72
+ maxCount: 1,
73
+ }),
74
+ __metadata("design:type", TranslationKeyVersion),
75
+ __metadata("design:paramtypes", [])
76
+ ], TranslationUnit.prototype, "ofKeyVersion", null);
77
+ __decorate([
78
+ literalProperty({ path: tr.language, maxCount: 1 }),
79
+ __metadata("design:type", String),
80
+ __metadata("design:paramtypes", [])
81
+ ], TranslationUnit.prototype, "language", null);
82
+ __decorate([
83
+ literalProperty({ path: tr.text, maxCount: 1 }),
84
+ __metadata("design:type", String),
85
+ __metadata("design:paramtypes", [])
86
+ ], TranslationUnit.prototype, "text", null);
87
+ __decorate([
88
+ literalProperty({ path: tr.state, maxCount: 1 }),
89
+ __metadata("design:type", String),
90
+ __metadata("design:paramtypes", [])
91
+ ], TranslationUnit.prototype, "state", null);
92
+ __decorate([
93
+ literalProperty({ path: tr.updatedAt, datatype: xsd.dateTime, maxCount: 1 }),
94
+ __metadata("design:type", Date),
95
+ __metadata("design:paramtypes", [])
96
+ ], TranslationUnit.prototype, "updatedAt", null);
97
+ __decorate([
98
+ objectProperty({ path: tr.updatedBy, maxCount: 1 }),
99
+ __metadata("design:type", String),
100
+ __metadata("design:paramtypes", [])
101
+ ], TranslationUnit.prototype, "updatedBy", null);
102
+ __decorate([
103
+ literalProperty({ path: tr.origin, maxCount: 1 }),
104
+ __metadata("design:type", String),
105
+ __metadata("design:paramtypes", [])
106
+ ], TranslationUnit.prototype, "origin", null);
107
+ TranslationUnit = __decorate([
108
+ linkedShape
109
+ ], TranslationUnit);
110
+ export { TranslationUnit };
111
+ //# sourceMappingURL=TranslationUnit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationUnit.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;IAAC,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;8BAC1D,cAAc;;4CAE1B;AAED;IAAC,cAAc,CAAC;QACd,IAAI,EAAE,EAAE,CAAC,YAAY;QACrB,KAAK,EAAE,qBAAqB;QAC5B,QAAQ,EAAE,CAAC;KACZ,CAAC;8BACkB,qBAAqB;;mDAExC;AAGD;IAAC,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;;;+CAGnD;AAED;IAAC,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;;;2CAG/C;AAGD;IAAC,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;;;4CAGhD;AAED;IAAC,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;8BAC5D,IAAI;;gDAEpB;AAGD;IAAC,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;;;gDAGnD;AAGD;IAAC,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;;;6CAGjD;AAvDU,eAAe;IAD3B,WAAW;GACC,eAAe,CAwD3B"}
package/package.json ADDED
@@ -0,0 +1,134 @@
1
+ {
2
+ "name": "@_linked/translation",
3
+ "description": "LINKED translation management — graph-native i18n keys + units, Tolgee-compatible client, CDN delivery. Built inside Create Now for now; structured to extract to its own repo unchanged.",
4
+ "version": "0.2.2",
5
+ "packageManager": "npm@11.19.1",
6
+ "linkedPackage": true,
7
+ "type": "module",
8
+ "main": "lib/esm/index.js",
9
+ "types": "index.d.ts",
10
+ "license": "ISC",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/linked-fw/translation.git"
14
+ },
15
+ "homepage": "https://github.com/linked-fw/translation#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/linked-fw/translation/issues"
18
+ },
19
+ "files": [
20
+ "lib",
21
+ "src"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "start": "npm exec linked dev",
28
+ "build": "npm exec linked build",
29
+ "test": "vitest run",
30
+ "prepublishOnly": "npm exec linked build production",
31
+ "postpublish": "npm exec linked register"
32
+ },
33
+ "keywords": [
34
+ "linked",
35
+ "linked data",
36
+ "i18n",
37
+ "translation",
38
+ "localization"
39
+ ],
40
+ "module": "lib/esm/index.js",
41
+ "exports": {
42
+ ".": {
43
+ "types": "./lib/esm/index.d.ts",
44
+ "development": "./src/index.ts",
45
+ "import": "./lib/esm/index.js"
46
+ },
47
+ "./react": {
48
+ "types": "./lib/esm/react.d.ts",
49
+ "development": "./src/react.tsx",
50
+ "import": "./lib/esm/react.js"
51
+ },
52
+ "./key-sync": {
53
+ "types": "./lib/esm/key-sync.d.ts",
54
+ "development": "./src/key-sync.ts",
55
+ "import": "./lib/esm/key-sync.js"
56
+ },
57
+ "./key-sync/node": {
58
+ "types": "./lib/esm/key-sync-node.d.ts",
59
+ "development": "./src/key-sync-node.ts",
60
+ "import": "./lib/esm/key-sync-node.js"
61
+ },
62
+ "./shape-catalog": {
63
+ "types": "./lib/esm/shape-catalog.d.ts",
64
+ "development": "./src/shape-catalog.ts",
65
+ "import": "./lib/esm/shape-catalog.js"
66
+ },
67
+ "./discovery": {
68
+ "types": "./lib/esm/discovery.d.ts",
69
+ "development": "./src/discovery.ts",
70
+ "import": "./lib/esm/discovery.js"
71
+ },
72
+ "./linked-discovery": {
73
+ "types": "./lib/esm/linked-discovery.d.ts",
74
+ "development": "./src/linked-discovery.ts",
75
+ "import": "./lib/esm/linked-discovery.js"
76
+ },
77
+ "./exchange": {
78
+ "types": "./lib/esm/exchange.d.ts",
79
+ "development": "./src/exchange.ts",
80
+ "import": "./lib/esm/exchange.js"
81
+ },
82
+ "./*.js": {
83
+ "types": "./lib/esm/*.d.ts",
84
+ "development": "./src/*.ts",
85
+ "import": "./lib/esm/*.js"
86
+ },
87
+ "./*": {
88
+ "types": "./lib/esm/*.d.ts",
89
+ "development": "./src/*.ts",
90
+ "import": "./lib/esm/*.js"
91
+ }
92
+ },
93
+ "typesVersions": {
94
+ "*": {
95
+ "*": [
96
+ "lib/esm/*"
97
+ ]
98
+ }
99
+ },
100
+ "dependencies": {
101
+ "@_linked/core": "^2.18.1",
102
+ "@_linked/server-utils": "^1.1.0",
103
+ "@formatjs/icu-messageformat-parser": "3.5.15",
104
+ "fflate": "^0.8.2",
105
+ "intl-messageformat": "11.2.12"
106
+ },
107
+ "peerDependencies": {
108
+ "react": "*",
109
+ "typescript": ">=5.7.0"
110
+ },
111
+ "peerDependenciesMeta": {
112
+ "react": {
113
+ "optional": true
114
+ },
115
+ "typescript": {
116
+ "optional": true
117
+ }
118
+ },
119
+ "devDependencies": {
120
+ "@_linked/cli": "^1.11.1",
121
+ "@testing-library/dom": "^10.4.1",
122
+ "@testing-library/react": "^16.3.0",
123
+ "@types/node": "^22.13.14",
124
+ "@types/react": "^18.3.24",
125
+ "@types/react-dom": "^18.3.7",
126
+ "jsdom": "^26.1.0",
127
+ "react": "^18.3.1",
128
+ "react-dom": "^18.3.1",
129
+ "typescript": "5.7.3",
130
+ "vitest": "^3.2.4",
131
+ "@changesets/cli": "^2.29.8",
132
+ "@changesets/changelog-github": "^0.5.2"
133
+ }
134
+ }