@cliff-format/i18n 0.0.0-stage → 0.2.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.
@@ -0,0 +1,462 @@
1
+ import { CliffDocument, CliffGroup, ValidationIssue, Correction, CliffEntry, ParseOptions } from '@cliff-format/core';
2
+
3
+ interface EntryIdCatalogContext {
4
+ readonly knownNamespaces: ReadonlySet<string>;
5
+ readonly knownClans: ReadonlySet<string>;
6
+ readonly defaultGroup: string;
7
+ readonly aliases: Readonly<Record<string, string>>;
8
+ hasCanonical(canonical: string): boolean;
9
+ recordForCanonical(canonical: string): MessageRecord | undefined;
10
+ suffixMatches(suffix: string): readonly string[];
11
+ }
12
+ declare function joinCanonical(namespace: string, clan: string, group: string, id: string): string;
13
+ declare function assertScope(scope: TranslationScope): void;
14
+ declare function resolveEntryId(input: EntryIdInput, scope: TranslationScope, context: EntryIdCatalogContext, strictEntryIds?: boolean): ResolvedEntryId;
15
+
16
+ interface CatalogOptions {
17
+ aliases?: Readonly<Record<string, string>>;
18
+ defaultGroup?: string;
19
+ }
20
+ declare class Catalog implements EntryIdCatalogContext {
21
+ readonly defaultGroup: string;
22
+ readonly aliases: Readonly<Record<string, string>>;
23
+ private readonly documentsList;
24
+ private readonly byLocale;
25
+ private readonly byCanonical;
26
+ private readonly suffixMap;
27
+ private readonly namespaceSet;
28
+ private readonly clanSet;
29
+ private readonly groupSet;
30
+ private readonly localeSet;
31
+ private readonly sourceLanguageSet;
32
+ constructor(options?: CatalogOptions);
33
+ get knownNamespaces(): ReadonlySet<string>;
34
+ get knownClans(): ReadonlySet<string>;
35
+ get documents(): readonly CliffDocument[];
36
+ get sourceLanguages(): readonly string[];
37
+ addDocument(document: CliffDocument): MessageRecord[];
38
+ addDraft(parts: {
39
+ namespace: string;
40
+ clan: string;
41
+ group: string;
42
+ id: string;
43
+ sourceLanguage: string;
44
+ targetLanguage: string;
45
+ }, draft: TranslatedDraft): MessageRecord;
46
+ private ensureDocument;
47
+ private indexRecord;
48
+ hasCanonical(canonical: string): boolean;
49
+ recordForCanonical(canonical: string): MessageRecord | undefined;
50
+ recordsForCanonical(canonical: string): readonly MessageRecord[];
51
+ suffixMatches(suffix: string): readonly string[];
52
+ record(canonical: string, locale: string): MessageRecord | undefined;
53
+ selectRecord(canonical: string, localeChain: readonly string[], sourceLanguage?: string): MessageRecord | undefined;
54
+ localeChain(locale: string, fallbacks?: readonly string[], sourceLanguage?: string): string[];
55
+ namespaces(): string[];
56
+ clans(namespace?: string): string[];
57
+ groups(scope?: Partial<TranslationScope>): string[];
58
+ entryIds(scope?: Partial<TranslationScope>): string[];
59
+ allRecords(): MessageRecord[];
60
+ query(options?: EntryQuery): MessageRecord[];
61
+ untranslated(options?: Omit<EntryQuery, "status" | "target">): MessageRecord[];
62
+ byStatus(status: StatusTag, options?: Omit<EntryQuery, "status">): MessageRecord[];
63
+ statusCounts(options?: Omit<EntryQuery, "status">): StatusCounts;
64
+ locales(): string[];
65
+ findGroup(namespace: string, clan: string, groupPath: string): CliffGroup | undefined;
66
+ files(options?: FileOptions): CliffFile[];
67
+ toCliff(options?: FileOptions): string;
68
+ validate(): ValidationIssue[];
69
+ }
70
+ declare function assertCatalogParts(parts: {
71
+ namespace: string;
72
+ clan: string;
73
+ group: string;
74
+ id: string;
75
+ }): void;
76
+
77
+ type IcuDialect = "plain" | "mf1" | "mf2";
78
+ interface IcuError {
79
+ type: string;
80
+ message: string;
81
+ source?: string;
82
+ }
83
+ type MessagePart = {
84
+ type: "literal";
85
+ value: string;
86
+ } | {
87
+ type: "expression";
88
+ source: string;
89
+ value: string;
90
+ locale?: string;
91
+ } | {
92
+ type: "markup";
93
+ kind: "open" | "close" | "standalone";
94
+ name: string;
95
+ source: string;
96
+ };
97
+ interface IcuFormatResult {
98
+ text: string;
99
+ errors: IcuError[];
100
+ }
101
+ interface IcuPartsResult {
102
+ parts: MessagePart[];
103
+ errors: IcuError[];
104
+ }
105
+ interface IcuAnalysis {
106
+ dialect: IcuDialect;
107
+ arguments: string[];
108
+ errors: IcuError[];
109
+ }
110
+ interface IcuFormatOptions {
111
+ currency?: string;
112
+ timeZone?: string;
113
+ }
114
+ interface IcuRuntime {
115
+ format(message: string, locale: string, values: Record<string, unknown>, options?: IcuFormatOptions): IcuFormatResult;
116
+ formatToParts(message: string, locale: string, values: Record<string, unknown>, options?: IcuFormatOptions): IcuPartsResult;
117
+ analyze(message: string): IcuAnalysis;
118
+ }
119
+
120
+ declare const TYPE: {
121
+ readonly noun: "noun";
122
+ readonly verb: "verb";
123
+ readonly adjective: "adjective";
124
+ readonly adverb: "adverb";
125
+ readonly pronoun: "pronoun";
126
+ readonly numeral: "numeral";
127
+ readonly preposition: "preposition";
128
+ readonly conjunction: "conjunction";
129
+ readonly particle: "particle";
130
+ readonly interjection: "interjection";
131
+ readonly "proper-noun": "proper-noun";
132
+ readonly "noun-phrase": "noun-phrase";
133
+ readonly "verb-phrase": "verb-phrase";
134
+ readonly "adjective-phrase": "adjective-phrase";
135
+ readonly "adverb-phrase": "adverb-phrase";
136
+ readonly "fixed-phrase": "fixed-phrase";
137
+ readonly idiom: "idiom";
138
+ readonly sentence: "sentence";
139
+ readonly description: "description";
140
+ readonly narration: "narration";
141
+ readonly dialogue: "dialogue";
142
+ readonly monologue: "monologue";
143
+ readonly prompt: "prompt";
144
+ readonly label: "label";
145
+ readonly subtitle: "subtitle";
146
+ readonly "accessibility-cue": "accessibility-cue";
147
+ };
148
+ type TypeTag = (typeof TYPE)[keyof typeof TYPE];
149
+ declare const EMOTION: {
150
+ readonly neutral: "neutral";
151
+ readonly objective: "objective";
152
+ readonly mechanical: "mechanical";
153
+ readonly joyful: "joyful";
154
+ readonly sad: "sad";
155
+ readonly angry: "angry";
156
+ readonly fearful: "fearful";
157
+ readonly surprised: "surprised";
158
+ readonly curious: "curious";
159
+ readonly disgusted: "disgusted";
160
+ readonly anxious: "anxious";
161
+ readonly calm: "calm";
162
+ readonly playful: "playful";
163
+ readonly serious: "serious";
164
+ readonly urgent: "urgent";
165
+ readonly romantic: "romantic";
166
+ readonly hopeful: "hopeful";
167
+ readonly grateful: "grateful";
168
+ readonly formal: "formal";
169
+ readonly informal: "informal";
170
+ readonly polite: "polite";
171
+ readonly rude: "rude";
172
+ readonly nostalgic: "nostalgic";
173
+ };
174
+ type EmotionTag = (typeof EMOTION)[keyof typeof EMOTION];
175
+ declare const STATUS: {
176
+ readonly initial: "initial";
177
+ readonly translated: "translated";
178
+ readonly reviewed: "reviewed";
179
+ readonly final: "final";
180
+ };
181
+ type StatusTag = (typeof STATUS)[keyof typeof STATUS];
182
+ declare const VARIANT: {
183
+ readonly standard: "standard";
184
+ readonly glossary: "glossary";
185
+ };
186
+ type VariantTag = (typeof VARIANT)[keyof typeof VARIANT];
187
+ declare const STATUS_ORDER: readonly ["initial", "translated", "reviewed", "final"];
188
+ type Params = Record<string, unknown>;
189
+ type EntryIdOf<EntryIds extends string> = string extends EntryIds ? string : EntryIds | (string & {});
190
+ type CliffResource = string | Uint8Array | CliffDocument;
191
+ interface TranslationScope {
192
+ namespace: string;
193
+ clan: string;
194
+ group?: string;
195
+ }
196
+ type EntryIdInput = string | {
197
+ namespace?: string;
198
+ clan?: string;
199
+ group?: string;
200
+ id: string;
201
+ };
202
+ interface EntryQuery {
203
+ namespace?: string;
204
+ clan?: string;
205
+ group?: string;
206
+ locale?: string | "all";
207
+ status?: StatusTag | readonly StatusTag[];
208
+ target?: "any" | "present" | "missing";
209
+ }
210
+ type StatusCounts = Record<StatusTag, number>;
211
+ interface ResolvedEntryId {
212
+ namespace: string;
213
+ clan: string;
214
+ group: string;
215
+ id: string;
216
+ canonical: string;
217
+ exists: boolean;
218
+ ambiguous?: boolean;
219
+ candidates?: readonly string[];
220
+ }
221
+ interface MessageRecord {
222
+ canonical: string;
223
+ namespace: string;
224
+ clan: string;
225
+ group: string;
226
+ id: string;
227
+ locale: string;
228
+ sourceLanguage: string;
229
+ document: CliffDocument;
230
+ groupRef: CliffGroup;
231
+ entry: CliffEntry;
232
+ variant: string;
233
+ source: string;
234
+ target?: string;
235
+ type?: string;
236
+ emotion: string[];
237
+ status?: string;
238
+ context?: string;
239
+ maxWidth?: number;
240
+ reference: string[];
241
+ reviewer?: string;
242
+ extensions: Record<string, string>;
243
+ filePath?: string;
244
+ }
245
+ interface MessageMetadata {
246
+ entryId: string;
247
+ namespace: string;
248
+ clan: string;
249
+ group: string;
250
+ id: string;
251
+ locale: string;
252
+ sourceLanguage: string;
253
+ targetLanguage: string;
254
+ variant: string;
255
+ source: string;
256
+ target?: string;
257
+ type?: string;
258
+ emotion: string[];
259
+ status?: string;
260
+ context?: string;
261
+ maxWidth?: number;
262
+ reference: string[];
263
+ reviewer?: string;
264
+ extensions: Record<string, string>;
265
+ }
266
+ interface MessageState {
267
+ source: boolean;
268
+ type: boolean;
269
+ }
270
+ type RenderMethod<S extends MessageState> = S["source"] extends true ? S["type"] extends true ? (params?: Params) => string : never : (params?: Params) => string;
271
+ type RenderPartsMethod<S extends MessageState> = S["source"] extends true ? S["type"] extends true ? (params?: Params) => MessagePart[] : never : (params?: Params) => MessagePart[];
272
+ interface CommitOptions {
273
+ overwrite?: boolean;
274
+ validate?: boolean;
275
+ }
276
+ interface MessageBuilder<S extends MessageState = {
277
+ source: false;
278
+ type: false;
279
+ }> {
280
+ source(text: string, params?: Params): MessageBuilder<{
281
+ source: true;
282
+ type: S["type"];
283
+ }>;
284
+ type(tag: TypeTag): MessageBuilder<{
285
+ source: S["source"];
286
+ type: true;
287
+ }>;
288
+ typeFromGroup: S extends {
289
+ source: true;
290
+ type: false;
291
+ } ? () => MessageBuilder<{
292
+ source: true;
293
+ type: true;
294
+ }> : never;
295
+ emotion(...tags: readonly (EmotionTag | readonly EmotionTag[])[]): MessageBuilder<S>;
296
+ context(text: string): MessageBuilder<S>;
297
+ maxWidth(cells: number): MessageBuilder<S>;
298
+ reference(...paths: string[]): MessageBuilder<S>;
299
+ reviewer(name: string): MessageBuilder<S>;
300
+ extension(name: string, value: string): MessageBuilder<S>;
301
+ target(text: string, params?: Params): MessageBuilder<S>;
302
+ status(tag: StatusTag): MessageBuilder<S>;
303
+ locale(tag: string): MessageBuilder<S>;
304
+ params(params: Params): MessageBuilder<S>;
305
+ count(value: number): MessageBuilder<S>;
306
+ render: RenderMethod<S>;
307
+ renderToParts: RenderPartsMethod<S>;
308
+ commit: S extends {
309
+ source: true;
310
+ type: true;
311
+ } ? (options?: CommitOptions) => MessageBuilder<S> : never;
312
+ meta(): MessageMetadata;
313
+ entry(): CliffEntry | undefined;
314
+ width(params?: Params): number;
315
+ fits(params?: Params): boolean;
316
+ toString(): string;
317
+ }
318
+ interface TFunction<EntryIds extends string = string> {
319
+ (entryId: EntryIdOf<EntryIds>): MessageBuilder<{
320
+ source: false;
321
+ type: false;
322
+ }>;
323
+ (entryId: EntryIdOf<EntryIds>, params: Params): string;
324
+ render(entryId: EntryIdOf<EntryIds>, params?: Params): string;
325
+ renderToParts(entryId: EntryIdOf<EntryIds>, params?: Params): MessagePart[];
326
+ has(entryId: EntryIdOf<EntryIds>): boolean;
327
+ entry(entryId: EntryIdOf<EntryIds>): CliffEntry | undefined;
328
+ meta(entryId: EntryIdOf<EntryIds>): MessageMetadata | undefined;
329
+ entryIds(): string[];
330
+ }
331
+ interface ScopedI18n<EntryIds extends string = string> {
332
+ readonly t: TFunction<EntryIds>;
333
+ readonly scope: TranslationScope;
334
+ }
335
+ type MissingBehavior = "entryId" | "empty" | "throw" | "source";
336
+ type WidthPolicy = "off" | "warn" | "error";
337
+ type DiagnosticSeverity = "error" | "warning" | "info";
338
+ interface I18nDiagnostic {
339
+ code: string;
340
+ severity: DiagnosticSeverity;
341
+ message: string;
342
+ entryId?: string;
343
+ locale?: string;
344
+ namespace?: string;
345
+ clan?: string;
346
+ group?: string;
347
+ line?: number;
348
+ details?: Record<string, unknown>;
349
+ }
350
+ interface I18nOptions {
351
+ locale: string;
352
+ fallbackLocale?: string | readonly string[];
353
+ resources?: readonly CliffResource[];
354
+ sourceLanguage?: string;
355
+ defaultGroup?: string;
356
+ params?: Params;
357
+ aliases?: Readonly<Record<string, string>>;
358
+ missing?: MissingBehavior;
359
+ strictEntryIds?: boolean;
360
+ requireEmotion?: boolean | readonly TypeTag[];
361
+ enforceMaxWidth?: WidthPolicy;
362
+ icu?: IcuRuntime;
363
+ parse?: ParseOptions;
364
+ onDiagnostic?: (diagnostic: I18nDiagnostic) => void;
365
+ maxDiagnostics?: number;
366
+ }
367
+ interface TranslatedDraft {
368
+ source?: string;
369
+ target?: string;
370
+ type?: string;
371
+ emotion?: readonly string[];
372
+ status?: string;
373
+ context?: string;
374
+ maxWidth?: number;
375
+ reference?: readonly string[];
376
+ reviewer?: string;
377
+ extensions?: Record<string, string>;
378
+ }
379
+ interface AddOptions {
380
+ sourcePath?: string;
381
+ tolerant?: boolean;
382
+ validate?: boolean;
383
+ }
384
+ interface AddResult {
385
+ documents: readonly CliffDocument[];
386
+ issues: readonly ValidationIssue[];
387
+ corrections: readonly Correction[];
388
+ }
389
+ interface FileOptions {
390
+ layout?: "folder" | "flat";
391
+ }
392
+ interface CliffFile {
393
+ filePath: string;
394
+ namespace: string;
395
+ clan: string;
396
+ locale: string;
397
+ text: string;
398
+ document: CliffDocument;
399
+ }
400
+ interface I18n<EntryIds extends string = string> {
401
+ readonly locale: string;
402
+ readonly language: string;
403
+ readonly sourceLanguage: string | undefined;
404
+ getLocale(): string;
405
+ setLocale(locale: string): void;
406
+ changeLanguage(locale: string): void;
407
+ getVersion(): number;
408
+ subscribe(listener: () => void): () => void;
409
+ scope(scope: TranslationScope): ScopedI18n<EntryIds>;
410
+ add(resource: CliffResource, options?: AddOptions): AddResult;
411
+ addDocument(document: CliffDocument, options?: AddOptions): AddResult;
412
+ has(entryId: EntryIdOf<EntryIds> | Exclude<EntryIdInput, string>, scope: TranslationScope): boolean;
413
+ resolve(entryId: EntryIdOf<EntryIds> | Exclude<EntryIdInput, string>, scope: TranslationScope): ResolvedEntryId;
414
+ entryIds(scope?: Partial<TranslationScope>): string[];
415
+ query(options?: EntryQuery): MessageRecord[];
416
+ untranslated(options?: Omit<EntryQuery, "status" | "target">): MessageRecord[];
417
+ byStatus(status: StatusTag, options?: Omit<EntryQuery, "status">): MessageRecord[];
418
+ statusCounts(options?: Omit<EntryQuery, "status">): StatusCounts;
419
+ namespaces(): string[];
420
+ clans(namespace?: string): string[];
421
+ groups(scope?: Partial<TranslationScope>): string[];
422
+ locales(): string[];
423
+ files(options?: FileOptions): CliffFile[];
424
+ toCliff(options?: FileOptions): string;
425
+ validate(): ValidationIssue[];
426
+ diagnostics(): readonly I18nDiagnostic[];
427
+ clearDiagnostics(): void;
428
+ format(message: string, params?: Params, options?: {
429
+ locale?: string;
430
+ currency?: string;
431
+ timeZone?: string;
432
+ }): string;
433
+ formatToParts(message: string, params?: Params, options?: {
434
+ locale?: string;
435
+ currency?: string;
436
+ timeZone?: string;
437
+ }): MessagePart[];
438
+ }
439
+ interface I18nRuntime {
440
+ resolve(entryId: EntryIdInput, scope: TranslationScope): ResolvedEntryId;
441
+ recordFor(canonical: string, locale: string): MessageRecord | undefined;
442
+ format(message: string, params: Params, options: {
443
+ locale: string;
444
+ currency?: string;
445
+ timeZone?: string;
446
+ }): string;
447
+ formatToParts(message: string, params: Params, options: {
448
+ locale: string;
449
+ currency?: string;
450
+ timeZone?: string;
451
+ }): MessagePart[];
452
+ diagnose(diagnostic: I18nDiagnostic): void;
453
+ getSourceLanguage(): string;
454
+ getLocale(): string;
455
+ getCatalog(): Catalog;
456
+ readonly defaultParams: Params;
457
+ readonly missing: MissingBehavior;
458
+ readonly requireEmotion: boolean | readonly TypeTag[];
459
+ readonly enforceMaxWidth: WidthPolicy;
460
+ }
461
+
462
+ export { type AddOptions as A, type ResolvedEntryId as B, Catalog as C, type DiagnosticSeverity as D, EMOTION as E, type FileOptions as F, STATUS_ORDER as G, type ScopedI18n as H, type I18nOptions as I, type StatusCounts as J, type StatusTag as K, TYPE as L, type MessageBuilder as M, type TranslatedDraft as N, type TranslationScope as O, type Params as P, type TypeTag as Q, type RenderMethod as R, STATUS as S, type TFunction as T, type VariantTag as U, VARIANT as V, type WidthPolicy as W, assertCatalogParts as X, assertScope as Y, joinCanonical as Z, resolveEntryId as _, type I18n as a, type IcuRuntime as b, type AddResult as c, type CatalogOptions as d, type CliffFile as e, type CliffResource as f, type CommitOptions as g, type EmotionTag as h, type EntryIdCatalogContext as i, type EntryIdInput as j, type EntryIdOf as k, type EntryQuery as l, type I18nDiagnostic as m, type I18nRuntime as n, type IcuAnalysis as o, type IcuDialect as p, type IcuError as q, type IcuFormatOptions as r, type IcuFormatResult as s, type IcuPartsResult as t, type MessageMetadata as u, type MessagePart as v, type MessageRecord as w, type MessageState as x, type MissingBehavior as y, type RenderPartsMethod as z };
@@ -0,0 +1,135 @@
1
+ import { p as IcuDialect, o as IcuAnalysis, b as IcuRuntime, n as I18nRuntime, O as TranslationScope, j as EntryIdInput, P as Params, Q as TypeTag, h as EmotionTag, K as StatusTag, v as MessagePart, u as MessageMetadata, g as CommitOptions, T as TFunction, U as VariantTag } from './types-CtbwKSot.js';
2
+ import { CliffEntry } from '@cliff-format/core';
3
+
4
+ declare function detectDialect(message: string): IcuDialect;
5
+ declare function argumentNames(message: string, dialect: IcuDialect): string[];
6
+ declare function analyzePlain(message: string, dialect: IcuDialect, errors?: IcuAnalysis["errors"]): IcuAnalysis;
7
+
8
+ declare function createLiteIcu(): IcuRuntime;
9
+
10
+ declare class MessageBuilderImpl {
11
+ private readonly i18n;
12
+ private readonly scope;
13
+ private readonly entryIdInput;
14
+ private sourceText;
15
+ private sourceParams;
16
+ private targetText;
17
+ private targetParams;
18
+ private extraParams;
19
+ private typeTag;
20
+ private inheritType;
21
+ private emotionTags;
22
+ private statusTag;
23
+ private contextText;
24
+ private maxWidthCells;
25
+ private referencePaths;
26
+ private reviewerName;
27
+ private extensionMap;
28
+ private localeOverride;
29
+ constructor(i18n: I18nRuntime, scope: TranslationScope, entryIdInput: EntryIdInput);
30
+ source(text: string, params?: Params): MessageBuilderImpl;
31
+ type(tag: TypeTag): MessageBuilderImpl;
32
+ typeFromGroup(): MessageBuilderImpl;
33
+ emotion(...tags: readonly (EmotionTag | readonly EmotionTag[])[]): MessageBuilderImpl;
34
+ context(text: string): MessageBuilderImpl;
35
+ maxWidth(cells: number): MessageBuilderImpl;
36
+ reference(...paths: string[]): MessageBuilderImpl;
37
+ reviewer(name: string): MessageBuilderImpl;
38
+ extension(name: string, value: string): MessageBuilderImpl;
39
+ target(text: string, params?: Params): MessageBuilderImpl;
40
+ status(tag: StatusTag): MessageBuilderImpl;
41
+ locale(tag: string): MessageBuilderImpl;
42
+ params(params: Params): MessageBuilderImpl;
43
+ count(value: number): MessageBuilderImpl;
44
+ private activeLocale;
45
+ private resolved;
46
+ private recordFor;
47
+ private mergedParams;
48
+ private diagnose;
49
+ private requireEffectiveType;
50
+ private ensureAuthoringMetadata;
51
+ private groupEmotion;
52
+ private requireEmotionIfConfigured;
53
+ private createDraft;
54
+ private checkWidth;
55
+ private renderRecord;
56
+ private expectationDiagnostics;
57
+ private missing;
58
+ render(params?: Params): string;
59
+ renderToParts(params?: Params): MessagePart[];
60
+ meta(): MessageMetadata;
61
+ entry(): CliffEntry | undefined;
62
+ commit(options?: CommitOptions): MessageBuilderImpl;
63
+ private applyOverwrite;
64
+ private validateDocument;
65
+ width(params?: Params): number;
66
+ fits(params?: Params): boolean;
67
+ toString(): string;
68
+ }
69
+ declare function createT<EntryIds extends string = string>(i18n: I18nRuntime, scope: TranslationScope): TFunction<EntryIds>;
70
+
71
+ declare class CliffI18nError extends Error {
72
+ constructor(message: string, options?: {
73
+ cause?: unknown;
74
+ });
75
+ }
76
+ declare class CliffScopeError extends CliffI18nError {
77
+ readonly scope: Partial<TranslationScope>;
78
+ constructor(message: string, scope?: Partial<TranslationScope>);
79
+ }
80
+ declare class CliffScopeMismatchError extends CliffScopeError {
81
+ readonly entryId: string;
82
+ constructor(entryId: string, scope: TranslationScope, expected: string);
83
+ }
84
+ declare class CliffMissingEntryError extends CliffI18nError {
85
+ readonly entryId: string;
86
+ readonly locale: string;
87
+ constructor(entryId: string, locale: string);
88
+ }
89
+ declare class CliffAmbiguousEntryError extends CliffI18nError {
90
+ readonly entryId: string;
91
+ readonly candidates: readonly string[];
92
+ constructor(entryId: string, candidates: readonly string[]);
93
+ }
94
+ declare class CliffDuplicateEntryError extends CliffI18nError {
95
+ readonly entryId: string;
96
+ readonly locale: string;
97
+ constructor(entryId: string, locale: string);
98
+ }
99
+ declare class CliffMissingMetadataError extends CliffI18nError {
100
+ readonly entryId: string;
101
+ readonly fields: readonly string[];
102
+ constructor(entryId: string, fields: readonly string[], detail?: string);
103
+ }
104
+ declare class CliffIcuError extends CliffI18nError {
105
+ readonly messageText: string;
106
+ constructor(messageText: string, detail: string);
107
+ }
108
+
109
+ declare const STATUS_TRANSITIONS: Record<StatusTag, readonly StatusTag[]>;
110
+ declare function statusOf(entry: CliffEntry): StatusTag;
111
+ declare function canTransitionStatus(from: StatusTag, to: StatusTag): boolean;
112
+ interface StatusContext {
113
+ source?: string;
114
+ target?: string;
115
+ explicit?: StatusTag;
116
+ }
117
+ /**
118
+ * Return the status a write should leave on an entry.
119
+ * An explicit status wins. Otherwise a missing target is initial, and a changed
120
+ * source or reworked reviewed/final target returns to translated.
121
+ */
122
+ declare function reconcileEntryStatus(entry: CliffEntry, previous?: StatusContext): StatusTag;
123
+ declare function nextStatuses(status: StatusTag): readonly StatusTag[];
124
+ declare function statusOrder(): readonly StatusTag[];
125
+
126
+ declare function isTypeTag(value: string): value is TypeTag;
127
+ declare function isEmotionTag(value: string): value is EmotionTag;
128
+ declare function isStatusTag(value: string): value is StatusTag;
129
+ declare function isVariantTag(value: string): value is VariantTag;
130
+ declare function assertTypeTag(value: string): TypeTag;
131
+ declare function assertEmotionTag(value: string): EmotionTag;
132
+ declare function assertStatusTag(value: string): StatusTag;
133
+ declare function assertVariantTag(value: string): VariantTag;
134
+
135
+ export { CliffAmbiguousEntryError as C, MessageBuilderImpl as M, STATUS_TRANSITIONS as S, CliffDuplicateEntryError as a, CliffI18nError as b, CliffIcuError as c, CliffMissingEntryError as d, CliffMissingMetadataError as e, CliffScopeError as f, CliffScopeMismatchError as g, type StatusContext as h, analyzePlain as i, argumentNames as j, assertEmotionTag as k, assertStatusTag as l, assertTypeTag as m, assertVariantTag as n, canTransitionStatus as o, createLiteIcu as p, createT as q, detectDialect as r, isEmotionTag as s, isStatusTag as t, isTypeTag as u, isVariantTag as v, nextStatuses as w, reconcileEntryStatus as x, statusOf as y, statusOrder as z };