@iveri/contracts 0.140.0 → 0.141.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 CHANGED
@@ -212,6 +212,9 @@ frontend build pulls and commits; `RenderBody`/`RenderedMessage` is what a backe
212
212
  needs a string in the _recipient's_ language. `Locale`, `Namespace`, `Message` with its
213
213
  `MessageVariable` declarations, `Translation`, `Release` and `ReleaseDiff` carry the authoring
214
214
  surface the translator panel is written against, with `TranslationStatus` and `VariableType`.
215
+ `TranslationMemory` (what other messages already say for the same source text) and
216
+ `TranslationConsistencyPage` (source texts translated more than one way in a locale) are the
217
+ translator aids, with `TranslationMatchKind`.
215
218
 
216
219
  `Locale` is a row rather than an enum on purpose — see the type's own note. Nothing in the
217
220
  platform branches on _which_ language a string is in, so encoding the set in a type would make
@@ -319,6 +322,9 @@ Conduit's outbox.
319
322
  `UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
320
323
  - Version `0.139.0` adds a trainer's notes on a member: `GymTrainerNote`, `GymTrainerNotes`, `SaveGymTrainerNoteRequest`,
321
324
  `GymMyTrainerNote` and the `GymRefusal` member `not-their-trainer` under `@iveri/contracts/gym`.
325
+ - Version `0.141.0` adds `TranslationMemory`, `TranslationMemorySuggestion`, `TranslationUse`, the
326
+ `TranslationConsistencyPage`/`Group`/`Variant` shapes and the `TranslationMatchKind` enum under
327
+ `@iveri/contracts/localization`, for translation memory and the consistency report.
322
328
  - Version `0.140.0` adds `DeleteOwnAccountBody` and the `IdentityRefusal` enum (`password-incorrect`,
323
329
  `not-self-registered`) under `@iveri/contracts/identity`, for deleting one's own account at `DELETE /auth/me`.
324
330
  - Version `0.134.0` adds `delivery:job:create-any`, `delivery:job:read-any` and `delivery:job:operate-any`, so a shop's
@@ -4,6 +4,8 @@ export * from './message.type.js';
4
4
  export * from './namespace.type.js';
5
5
  export * from './release.type.js';
6
6
  export * from './render.type.js';
7
+ export * from './translation-match-kind.enum.js';
8
+ export * from './translation-memory.type.js';
7
9
  export * from './translation-status.enum.js';
8
10
  export * from './translation.type.js';
9
11
  export * from './variable-type.enum.js';
@@ -4,6 +4,8 @@ export * from './message.type.js';
4
4
  export * from './namespace.type.js';
5
5
  export * from './release.type.js';
6
6
  export * from './render.type.js';
7
+ export * from './translation-match-kind.enum.js';
8
+ export * from './translation-memory.type.js';
7
9
  export * from './translation-status.enum.js';
8
10
  export * from './translation.type.js';
9
11
  export * from './variable-type.enum.js';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * How a translation memory suggestion's source text relates to the message being translated.
3
+ *
4
+ * Two kinds and no third, because the panel shows them differently and a translator acts on them
5
+ * differently: an exact match is the same English, so its translation can be taken as it stands;
6
+ * a similar one is different English, so its source is shown beside it and the translator decides
7
+ * what to change.
8
+ */
9
+ export declare enum TranslationMatchKind {
10
+ /** The same source text once runs of whitespace are collapsed and the ends trimmed. */
11
+ EXACT = "exact",
12
+ /**
13
+ * Source text that is close but not the same, scored by trigram similarity. A difference of
14
+ * case alone lands here too, because `Cancel` and `cancel` can need different words.
15
+ */
16
+ SIMILAR = "similar"
17
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * How a translation memory suggestion's source text relates to the message being translated.
3
+ *
4
+ * Two kinds and no third, because the panel shows them differently and a translator acts on them
5
+ * differently: an exact match is the same English, so its translation can be taken as it stands;
6
+ * a similar one is different English, so its source is shown beside it and the translator decides
7
+ * what to change.
8
+ */
9
+ export var TranslationMatchKind;
10
+ (function (TranslationMatchKind) {
11
+ /** The same source text once runs of whitespace are collapsed and the ends trimmed. */
12
+ TranslationMatchKind["EXACT"] = "exact";
13
+ /**
14
+ * Source text that is close but not the same, scored by trigram similarity. A difference of
15
+ * case alone lands here too, because `Cancel` and `cancel` can need different words.
16
+ */
17
+ TranslationMatchKind["SIMILAR"] = "similar";
18
+ })(TranslationMatchKind || (TranslationMatchKind = {}));
@@ -0,0 +1,78 @@
1
+ import type { Paginated } from '../../type/paginated.type.js';
2
+ import type { TranslationMatchKind } from './translation-match-kind.enum.js';
3
+ import type { TranslationStatus } from './translation-status.enum.js';
4
+ /** One message that carries a given translation: where to find it, and how far along it is. */
5
+ export interface TranslationUse {
6
+ namespaceKey: string;
7
+ messageKey: string;
8
+ status: TranslationStatus;
9
+ }
10
+ /**
11
+ * One way another message already says this in the target language.
12
+ *
13
+ * Grouped by the translated text rather than listed per message: when `Cancel` is `Отмена` in
14
+ * twelve namespaces, twelve identical rows bury the one that differs. `useCount` says how many
15
+ * messages carry it and `uses` names a few of them, so a translator can open the one they trust.
16
+ */
17
+ export interface TranslationMemorySuggestion {
18
+ matchKind: TranslationMatchKind;
19
+ /** 1 for an exact match; the trigram similarity, between 0 and 1, for a similar one. */
20
+ similarity: number;
21
+ /** The other message's source text, shown so a similar match's difference is visible. */
22
+ sourceValue: string;
23
+ /** Its translation in the requested locale, as stored. ICU MessageFormat. */
24
+ value: string;
25
+ /** How many messages carry this source and this translation. */
26
+ useCount: number;
27
+ /** At most five of them, approved ones first. */
28
+ uses: TranslationUse[];
29
+ }
30
+ /**
31
+ * `GET /api/v1/namespaces/:key/messages/:messageKey/translations/:localeCode/memory`.
32
+ *
33
+ * What other messages in the workspace already say in this locale for the same or nearly the same
34
+ * source text. It reads and never writes: taking a suggestion fills the editor, and the translator
35
+ * still saves it through the ordinary write, with its placeholder check.
36
+ */
37
+ export interface TranslationMemory {
38
+ localeCode: string;
39
+ sourceLocaleCode: string;
40
+ /** The message's own source text, which every suggestion is compared against. */
41
+ sourceValue: string;
42
+ /** Exact matches first, then similar ones by score; at most ten. */
43
+ suggestions: TranslationMemorySuggestion[];
44
+ }
45
+ /** One spelling a source text has in a locale, and the messages that use it. */
46
+ export interface TranslationConsistencyVariant {
47
+ /** The translation, as stored. Two variants differ once runs of whitespace are collapsed. */
48
+ value: string;
49
+ useCount: number;
50
+ /** At most twenty of the messages, approved ones first. */
51
+ uses: TranslationUse[];
52
+ }
53
+ /**
54
+ * One source text that the workspace translates into one locale in more than one way.
55
+ *
56
+ * Not necessarily a mistake: `Open` as a button and `Open` as a status are one English word and
57
+ * two Georgian ones. The report says where the words differ; the translator decides whether they
58
+ * should.
59
+ */
60
+ export interface TranslationConsistencyGroup {
61
+ /** The source text, with runs of whitespace collapsed. Compared with case kept. */
62
+ sourceValue: string;
63
+ /** Messages with this source text that have a translation in the locale. */
64
+ messageCount: number;
65
+ /** Most used first. Always two or more. */
66
+ variants: TranslationConsistencyVariant[];
67
+ }
68
+ /**
69
+ * `GET /api/v1/translation-consistency?localeCode=&namespaceKey=`.
70
+ *
71
+ * Groups ordered by how many messages they touch. With `namespaceKey`, only groups with at least
72
+ * one message in that namespace — but each group still lists every variant in the workspace,
73
+ * because the inconsistency is between namespaces.
74
+ */
75
+ export interface TranslationConsistencyPage extends Paginated<TranslationConsistencyGroup> {
76
+ localeCode: string;
77
+ sourceLocaleCode: string;
78
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.140.0",
3
+ "version": "0.141.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {