@lokalise/polyglot-sdk 21.0.2 → 22.1.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.
Files changed (47) hide show
  1. package/dist/index.d.ts +11 -10
  2. package/dist/index.js +9 -8
  3. package/dist/index.js.map +1 -1
  4. package/dist/sdk/PolyglotClient.js.map +1 -1
  5. package/dist/sdk/schemas/common/asyncRequestSchemas.d.ts +4 -14
  6. package/dist/sdk/schemas/common/asyncRequestSchemas.js +1 -2
  7. package/dist/sdk/schemas/common/asyncRequestSchemas.js.map +1 -1
  8. package/dist/sdk/schemas/common/commonSchemas.d.ts +19 -68
  9. package/dist/sdk/schemas/common/commonSchemas.js +6 -9
  10. package/dist/sdk/schemas/common/commonSchemas.js.map +1 -1
  11. package/dist/sdk/schemas/common/errorSchemas.d.ts +6 -51
  12. package/dist/sdk/schemas/common/errorSchemas.js +1 -1
  13. package/dist/sdk/schemas/common/errorSchemas.js.map +1 -1
  14. package/dist/sdk/schemas/common/pluralFormSchemas.d.ts +28 -0
  15. package/dist/sdk/schemas/common/pluralFormSchemas.js +48 -0
  16. package/dist/sdk/schemas/common/pluralFormSchemas.js.map +1 -0
  17. package/dist/sdk/schemas/common/translationContextSchemas.d.ts +142 -438
  18. package/dist/sdk/schemas/common/translationContextSchemas.js +4 -3
  19. package/dist/sdk/schemas/common/translationContextSchemas.js.map +1 -1
  20. package/dist/sdk/schemas/lqa/commonSchemas.d.ts +62 -264
  21. package/dist/sdk/schemas/lqa/commonSchemas.js +12 -3
  22. package/dist/sdk/schemas/lqa/commonSchemas.js.map +1 -1
  23. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.d.ts +133 -817
  24. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js +7 -4
  25. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js.map +1 -1
  26. package/dist/sdk/schemas/lqa/lqaSyncSchemas.d.ts +106 -685
  27. package/dist/sdk/schemas/lqa/lqaSyncSchemas.js +5 -2
  28. package/dist/sdk/schemas/lqa/lqaSyncSchemas.js.map +1 -1
  29. package/dist/sdk/schemas/translation/generateVariants.d.ts +67 -524
  30. package/dist/sdk/schemas/translation/generateVariants.js +16 -6
  31. package/dist/sdk/schemas/translation/generateVariants.js.map +1 -1
  32. package/dist/sdk/schemas/translation/rewriteTextSchemas.d.ts +245 -1512
  33. package/dist/sdk/schemas/translation/rewriteTextSchemas.js +22 -4
  34. package/dist/sdk/schemas/translation/rewriteTextSchemas.js.map +1 -1
  35. package/dist/sdk/schemas/translation/sharedSchemas.d.ts +114 -451
  36. package/dist/sdk/schemas/translation/sharedSchemas.js +27 -25
  37. package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -1
  38. package/dist/sdk/schemas/translation/translateAsyncSchemas.d.ts +179 -2123
  39. package/dist/sdk/schemas/translation/translateAsyncSchemas.js +18 -6
  40. package/dist/sdk/schemas/translation/translateAsyncSchemas.js.map +1 -1
  41. package/dist/sdk/schemas/translation/translateSyncSchemas.d.ts +142 -1680
  42. package/dist/sdk/schemas/translation/translateSyncSchemas.js +19 -6
  43. package/dist/sdk/schemas/translation/translateSyncSchemas.js.map +1 -1
  44. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.d.ts +87 -1079
  45. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js +4 -4
  46. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js.map +1 -1
  47. package/package.json +9 -11
@@ -1,464 +1,168 @@
1
- import z from 'zod';
2
- declare const STRUCTURED_STYLE_GUIDE_SCHEMA: z.ZodEffects<z.ZodObject<{
3
- targetAudience: z.ZodOptional<z.ZodEnum<["general", "technical", "non-technical"]>>;
4
- toneOfVoice: z.ZodOptional<z.ZodEnum<["friendly", "empowering", "informative", "supportive", "elegant"]>>;
5
- levelOfFormality: z.ZodOptional<z.ZodEnum<["informal", "formal", "neutral"]>>;
6
- generalRule: z.ZodOptional<z.ZodEnum<["active-voice", "passive-voice"]>>;
7
- }, "strip", z.ZodTypeAny, {
8
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
9
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
10
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
11
- generalRule?: "active-voice" | "passive-voice" | undefined;
12
- }, {
13
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
14
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
15
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
16
- generalRule?: "active-voice" | "passive-voice" | undefined;
17
- }>, {
18
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
19
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
20
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
21
- generalRule?: "active-voice" | "passive-voice" | undefined;
22
- }, {
23
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
24
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
25
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
26
- generalRule?: "active-voice" | "passive-voice" | undefined;
27
- }>;
1
+ import z from 'zod/v4';
2
+ declare const STRUCTURED_STYLE_GUIDE_SCHEMA: z.ZodObject<{
3
+ targetAudience: z.ZodOptional<z.ZodEnum<{
4
+ general: "general";
5
+ technical: "technical";
6
+ "non-technical": "non-technical";
7
+ }>>;
8
+ toneOfVoice: z.ZodOptional<z.ZodEnum<{
9
+ friendly: "friendly";
10
+ empowering: "empowering";
11
+ informative: "informative";
12
+ supportive: "supportive";
13
+ elegant: "elegant";
14
+ }>>;
15
+ levelOfFormality: z.ZodOptional<z.ZodEnum<{
16
+ informal: "informal";
17
+ formal: "formal";
18
+ neutral: "neutral";
19
+ }>>;
20
+ generalRule: z.ZodOptional<z.ZodEnum<{
21
+ "active-voice": "active-voice";
22
+ "passive-voice": "passive-voice";
23
+ }>>;
24
+ }, z.core.$strip>;
28
25
  export type StructuredStyleGuide = z.infer<typeof STRUCTURED_STYLE_GUIDE_SCHEMA>;
29
26
  declare const FREEFORM_STYLE_GUIDE_SCHEMA: z.ZodObject<{
30
- text: z.ZodEffects<z.ZodString, string, string>;
31
- }, "strip", z.ZodTypeAny, {
32
- text: string;
33
- }, {
34
- text: string;
35
- }>;
27
+ text: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
28
+ }, z.core.$strip>;
36
29
  export type FreeformStyleGuide = z.infer<typeof FREEFORM_STYLE_GUIDE_SCHEMA>;
37
- declare const STYLE_GUIDE_SCHEMA: z.ZodUnion<[z.ZodObject<{
38
- text: z.ZodEffects<z.ZodString, string, string>;
39
- }, "strip", z.ZodTypeAny, {
40
- text: string;
41
- }, {
42
- text: string;
43
- }>, z.ZodEffects<z.ZodObject<{
44
- targetAudience: z.ZodOptional<z.ZodEnum<["general", "technical", "non-technical"]>>;
45
- toneOfVoice: z.ZodOptional<z.ZodEnum<["friendly", "empowering", "informative", "supportive", "elegant"]>>;
46
- levelOfFormality: z.ZodOptional<z.ZodEnum<["informal", "formal", "neutral"]>>;
47
- generalRule: z.ZodOptional<z.ZodEnum<["active-voice", "passive-voice"]>>;
48
- }, "strip", z.ZodTypeAny, {
49
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
50
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
51
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
52
- generalRule?: "active-voice" | "passive-voice" | undefined;
53
- }, {
54
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
55
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
56
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
57
- generalRule?: "active-voice" | "passive-voice" | undefined;
58
- }>, {
59
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
60
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
61
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
62
- generalRule?: "active-voice" | "passive-voice" | undefined;
63
- }, {
64
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
65
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
66
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
67
- generalRule?: "active-voice" | "passive-voice" | undefined;
68
- }>]>;
30
+ declare const STYLE_GUIDE_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
31
+ text: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
32
+ }, z.core.$strip>, z.ZodObject<{
33
+ targetAudience: z.ZodOptional<z.ZodEnum<{
34
+ general: "general";
35
+ technical: "technical";
36
+ "non-technical": "non-technical";
37
+ }>>;
38
+ toneOfVoice: z.ZodOptional<z.ZodEnum<{
39
+ friendly: "friendly";
40
+ empowering: "empowering";
41
+ informative: "informative";
42
+ supportive: "supportive";
43
+ elegant: "elegant";
44
+ }>>;
45
+ levelOfFormality: z.ZodOptional<z.ZodEnum<{
46
+ informal: "informal";
47
+ formal: "formal";
48
+ neutral: "neutral";
49
+ }>>;
50
+ generalRule: z.ZodOptional<z.ZodEnum<{
51
+ "active-voice": "active-voice";
52
+ "passive-voice": "passive-voice";
53
+ }>>;
54
+ }, z.core.$strip>]>;
69
55
  export type StyleGuideData = z.infer<typeof STYLE_GUIDE_SCHEMA>;
70
56
  export declare function isStructuredStyleGuide(guide: Record<string, unknown>): guide is StructuredStyleGuide;
71
- export declare const GLOSSARY_TERM_SCHEMA: z.ZodEffects<z.ZodObject<{
57
+ export declare const GLOSSARY_TERM_SCHEMA: z.ZodObject<{
72
58
  term: z.ZodString;
73
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
59
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
74
60
  translatable: z.ZodDefault<z.ZodBoolean>;
75
61
  forbidden: z.ZodDefault<z.ZodBoolean>;
76
62
  caseSensitive: z.ZodDefault<z.ZodBoolean>;
77
63
  translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
78
- locale: z.ZodEffects<z.ZodString, string, string>;
79
- translation: z.ZodEffects<z.ZodString, string, string>;
80
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
81
- }, "strip", z.ZodTypeAny, {
82
- translation: string;
83
- locale: string;
84
- description?: string | undefined;
85
- }, {
86
- translation: string;
87
- locale: string;
88
- description?: string | undefined;
89
- }>, "many">>;
90
- }, "strip", z.ZodTypeAny, {
91
- term: string;
92
- translatable: boolean;
93
- forbidden: boolean;
94
- caseSensitive: boolean;
95
- description?: string | undefined;
96
- translations?: {
97
- translation: string;
98
- locale: string;
99
- description?: string | undefined;
100
- }[] | undefined;
101
- }, {
102
- term: string;
103
- description?: string | undefined;
104
- translatable?: boolean | undefined;
105
- forbidden?: boolean | undefined;
106
- caseSensitive?: boolean | undefined;
107
- translations?: {
108
- translation: string;
109
- locale: string;
110
- description?: string | undefined;
111
- }[] | undefined;
112
- }>, {
113
- term: string;
114
- translatable: boolean;
115
- forbidden: boolean;
116
- caseSensitive: boolean;
117
- description?: string | undefined;
118
- translations?: {
119
- translation: string;
120
- locale: string;
121
- description?: string | undefined;
122
- }[] | undefined;
123
- }, {
124
- term: string;
125
- description?: string | undefined;
126
- translatable?: boolean | undefined;
127
- forbidden?: boolean | undefined;
128
- caseSensitive?: boolean | undefined;
129
- translations?: {
130
- translation: string;
131
- locale: string;
132
- description?: string | undefined;
133
- }[] | undefined;
134
- }>;
64
+ locale: z.ZodString;
65
+ translation: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
66
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
67
+ }, z.core.$strip>>>;
68
+ }, z.core.$strip>;
135
69
  export type GlossaryTerm = z.infer<typeof GLOSSARY_TERM_SCHEMA>;
136
70
  export declare const TRANSLATION_CONTEXT_SCHEMA: z.ZodObject<{
137
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
138
- styleGuide: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
139
- text: z.ZodEffects<z.ZodString, string, string>;
140
- }, "strip", z.ZodTypeAny, {
141
- text: string;
142
- }, {
143
- text: string;
144
- }>, z.ZodEffects<z.ZodObject<{
145
- targetAudience: z.ZodOptional<z.ZodEnum<["general", "technical", "non-technical"]>>;
146
- toneOfVoice: z.ZodOptional<z.ZodEnum<["friendly", "empowering", "informative", "supportive", "elegant"]>>;
147
- levelOfFormality: z.ZodOptional<z.ZodEnum<["informal", "formal", "neutral"]>>;
148
- generalRule: z.ZodOptional<z.ZodEnum<["active-voice", "passive-voice"]>>;
149
- }, "strip", z.ZodTypeAny, {
150
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
151
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
152
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
153
- generalRule?: "active-voice" | "passive-voice" | undefined;
154
- }, {
155
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
156
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
157
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
158
- generalRule?: "active-voice" | "passive-voice" | undefined;
159
- }>, {
160
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
161
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
162
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
163
- generalRule?: "active-voice" | "passive-voice" | undefined;
164
- }, {
165
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
166
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
167
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
168
- generalRule?: "active-voice" | "passive-voice" | undefined;
169
- }>]>>;
170
- glossary: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
71
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
72
+ styleGuide: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
73
+ text: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
74
+ }, z.core.$strip>, z.ZodObject<{
75
+ targetAudience: z.ZodOptional<z.ZodEnum<{
76
+ general: "general";
77
+ technical: "technical";
78
+ "non-technical": "non-technical";
79
+ }>>;
80
+ toneOfVoice: z.ZodOptional<z.ZodEnum<{
81
+ friendly: "friendly";
82
+ empowering: "empowering";
83
+ informative: "informative";
84
+ supportive: "supportive";
85
+ elegant: "elegant";
86
+ }>>;
87
+ levelOfFormality: z.ZodOptional<z.ZodEnum<{
88
+ informal: "informal";
89
+ formal: "formal";
90
+ neutral: "neutral";
91
+ }>>;
92
+ generalRule: z.ZodOptional<z.ZodEnum<{
93
+ "active-voice": "active-voice";
94
+ "passive-voice": "passive-voice";
95
+ }>>;
96
+ }, z.core.$strip>]>>;
97
+ glossary: z.ZodOptional<z.ZodArray<z.ZodObject<{
171
98
  term: z.ZodString;
172
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
99
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
173
100
  translatable: z.ZodDefault<z.ZodBoolean>;
174
101
  forbidden: z.ZodDefault<z.ZodBoolean>;
175
102
  caseSensitive: z.ZodDefault<z.ZodBoolean>;
176
103
  translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
177
- locale: z.ZodEffects<z.ZodString, string, string>;
178
- translation: z.ZodEffects<z.ZodString, string, string>;
179
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
180
- }, "strip", z.ZodTypeAny, {
181
- translation: string;
182
- locale: string;
183
- description?: string | undefined;
184
- }, {
185
- translation: string;
186
- locale: string;
187
- description?: string | undefined;
188
- }>, "many">>;
189
- }, "strip", z.ZodTypeAny, {
190
- term: string;
191
- translatable: boolean;
192
- forbidden: boolean;
193
- caseSensitive: boolean;
194
- description?: string | undefined;
195
- translations?: {
196
- translation: string;
197
- locale: string;
198
- description?: string | undefined;
199
- }[] | undefined;
200
- }, {
201
- term: string;
202
- description?: string | undefined;
203
- translatable?: boolean | undefined;
204
- forbidden?: boolean | undefined;
205
- caseSensitive?: boolean | undefined;
206
- translations?: {
207
- translation: string;
208
- locale: string;
209
- description?: string | undefined;
210
- }[] | undefined;
211
- }>, {
212
- term: string;
213
- translatable: boolean;
214
- forbidden: boolean;
215
- caseSensitive: boolean;
216
- description?: string | undefined;
217
- translations?: {
218
- translation: string;
219
- locale: string;
220
- description?: string | undefined;
221
- }[] | undefined;
222
- }, {
223
- term: string;
224
- description?: string | undefined;
225
- translatable?: boolean | undefined;
226
- forbidden?: boolean | undefined;
227
- caseSensitive?: boolean | undefined;
228
- translations?: {
229
- translation: string;
230
- locale: string;
231
- description?: string | undefined;
232
- }[] | undefined;
233
- }>, "many">>;
234
- targetPluralForms: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEnum<["zero", "one", "two", "few", "many", "other"]>, "atleastone">>, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined>, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined>;
104
+ locale: z.ZodString;
105
+ translation: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
106
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
107
+ }, z.core.$strip>>>;
108
+ }, z.core.$strip>>>;
109
+ targetPluralForms: z.ZodOptional<z.ZodArray<z.ZodEnum<{
110
+ readonly ZERO: "zero";
111
+ readonly ONE: "one";
112
+ readonly TWO: "two";
113
+ readonly FEW: "few";
114
+ readonly MANY: "many";
115
+ readonly OTHER: "other";
116
+ }>>>;
235
117
  translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
236
- sourceValue: z.ZodEffects<z.ZodString, string, string>;
237
- translatedValue: z.ZodEffects<z.ZodString, string, string>;
238
- }, "strip", z.ZodTypeAny, {
239
- sourceValue: string;
240
- translatedValue: string;
241
- }, {
242
- sourceValue: string;
243
- translatedValue: string;
244
- }>, "many">>;
245
- }, "strip", z.ZodTypeAny, {
246
- translationExamples?: {
247
- sourceValue: string;
248
- translatedValue: string;
249
- }[] | undefined;
250
- description?: string | undefined;
251
- styleGuide?: {
252
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
253
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
254
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
255
- generalRule?: "active-voice" | "passive-voice" | undefined;
256
- } | {
257
- text: string;
258
- } | undefined;
259
- glossary?: {
260
- term: string;
261
- translatable: boolean;
262
- forbidden: boolean;
263
- caseSensitive: boolean;
264
- description?: string | undefined;
265
- translations?: {
266
- translation: string;
267
- locale: string;
268
- description?: string | undefined;
269
- }[] | undefined;
270
- }[] | undefined;
271
- targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
272
- }, {
273
- translationExamples?: {
274
- sourceValue: string;
275
- translatedValue: string;
276
- }[] | undefined;
277
- description?: string | undefined;
278
- styleGuide?: {
279
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
280
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
281
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
282
- generalRule?: "active-voice" | "passive-voice" | undefined;
283
- } | {
284
- text: string;
285
- } | undefined;
286
- glossary?: {
287
- term: string;
288
- description?: string | undefined;
289
- translatable?: boolean | undefined;
290
- forbidden?: boolean | undefined;
291
- caseSensitive?: boolean | undefined;
292
- translations?: {
293
- translation: string;
294
- locale: string;
295
- description?: string | undefined;
296
- }[] | undefined;
297
- }[] | undefined;
298
- targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
299
- }>;
118
+ sourceValue: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
119
+ translatedValue: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
120
+ }, z.core.$strip>>>;
121
+ }, z.core.$strip>;
300
122
  export type TranslationContext = z.infer<typeof TRANSLATION_CONTEXT_SCHEMA>;
301
- export declare const TEXT_REWRITING_CONTEXT: z.ZodObject<Omit<{
302
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
303
- styleGuide: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
304
- text: z.ZodEffects<z.ZodString, string, string>;
305
- }, "strip", z.ZodTypeAny, {
306
- text: string;
307
- }, {
308
- text: string;
309
- }>, z.ZodEffects<z.ZodObject<{
310
- targetAudience: z.ZodOptional<z.ZodEnum<["general", "technical", "non-technical"]>>;
311
- toneOfVoice: z.ZodOptional<z.ZodEnum<["friendly", "empowering", "informative", "supportive", "elegant"]>>;
312
- levelOfFormality: z.ZodOptional<z.ZodEnum<["informal", "formal", "neutral"]>>;
313
- generalRule: z.ZodOptional<z.ZodEnum<["active-voice", "passive-voice"]>>;
314
- }, "strip", z.ZodTypeAny, {
315
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
316
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
317
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
318
- generalRule?: "active-voice" | "passive-voice" | undefined;
319
- }, {
320
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
321
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
322
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
323
- generalRule?: "active-voice" | "passive-voice" | undefined;
324
- }>, {
325
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
326
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
327
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
328
- generalRule?: "active-voice" | "passive-voice" | undefined;
329
- }, {
330
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
331
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
332
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
333
- generalRule?: "active-voice" | "passive-voice" | undefined;
334
- }>]>>;
335
- glossary: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
123
+ export declare const TEXT_REWRITING_CONTEXT: z.ZodObject<{
124
+ translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
125
+ sourceValue: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
126
+ translatedValue: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
127
+ }, z.core.$strip>>>;
128
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
129
+ styleGuide: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
130
+ text: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
131
+ }, z.core.$strip>, z.ZodObject<{
132
+ targetAudience: z.ZodOptional<z.ZodEnum<{
133
+ general: "general";
134
+ technical: "technical";
135
+ "non-technical": "non-technical";
136
+ }>>;
137
+ toneOfVoice: z.ZodOptional<z.ZodEnum<{
138
+ friendly: "friendly";
139
+ empowering: "empowering";
140
+ informative: "informative";
141
+ supportive: "supportive";
142
+ elegant: "elegant";
143
+ }>>;
144
+ levelOfFormality: z.ZodOptional<z.ZodEnum<{
145
+ informal: "informal";
146
+ formal: "formal";
147
+ neutral: "neutral";
148
+ }>>;
149
+ generalRule: z.ZodOptional<z.ZodEnum<{
150
+ "active-voice": "active-voice";
151
+ "passive-voice": "passive-voice";
152
+ }>>;
153
+ }, z.core.$strip>]>>;
154
+ glossary: z.ZodOptional<z.ZodArray<z.ZodObject<{
336
155
  term: z.ZodString;
337
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
156
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
338
157
  translatable: z.ZodDefault<z.ZodBoolean>;
339
158
  forbidden: z.ZodDefault<z.ZodBoolean>;
340
159
  caseSensitive: z.ZodDefault<z.ZodBoolean>;
341
160
  translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
342
- locale: z.ZodEffects<z.ZodString, string, string>;
343
- translation: z.ZodEffects<z.ZodString, string, string>;
344
- description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
345
- }, "strip", z.ZodTypeAny, {
346
- translation: string;
347
- locale: string;
348
- description?: string | undefined;
349
- }, {
350
- translation: string;
351
- locale: string;
352
- description?: string | undefined;
353
- }>, "many">>;
354
- }, "strip", z.ZodTypeAny, {
355
- term: string;
356
- translatable: boolean;
357
- forbidden: boolean;
358
- caseSensitive: boolean;
359
- description?: string | undefined;
360
- translations?: {
361
- translation: string;
362
- locale: string;
363
- description?: string | undefined;
364
- }[] | undefined;
365
- }, {
366
- term: string;
367
- description?: string | undefined;
368
- translatable?: boolean | undefined;
369
- forbidden?: boolean | undefined;
370
- caseSensitive?: boolean | undefined;
371
- translations?: {
372
- translation: string;
373
- locale: string;
374
- description?: string | undefined;
375
- }[] | undefined;
376
- }>, {
377
- term: string;
378
- translatable: boolean;
379
- forbidden: boolean;
380
- caseSensitive: boolean;
381
- description?: string | undefined;
382
- translations?: {
383
- translation: string;
384
- locale: string;
385
- description?: string | undefined;
386
- }[] | undefined;
387
- }, {
388
- term: string;
389
- description?: string | undefined;
390
- translatable?: boolean | undefined;
391
- forbidden?: boolean | undefined;
392
- caseSensitive?: boolean | undefined;
393
- translations?: {
394
- translation: string;
395
- locale: string;
396
- description?: string | undefined;
397
- }[] | undefined;
398
- }>, "many">>;
399
- targetPluralForms: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEnum<["zero", "one", "two", "few", "many", "other"]>, "atleastone">>, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined>, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined>;
400
- translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
401
- sourceValue: z.ZodEffects<z.ZodString, string, string>;
402
- translatedValue: z.ZodEffects<z.ZodString, string, string>;
403
- }, "strip", z.ZodTypeAny, {
404
- sourceValue: string;
405
- translatedValue: string;
406
- }, {
407
- sourceValue: string;
408
- translatedValue: string;
409
- }>, "many">>;
410
- }, "targetPluralForms">, "strip", z.ZodTypeAny, {
411
- translationExamples?: {
412
- sourceValue: string;
413
- translatedValue: string;
414
- }[] | undefined;
415
- description?: string | undefined;
416
- styleGuide?: {
417
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
418
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
419
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
420
- generalRule?: "active-voice" | "passive-voice" | undefined;
421
- } | {
422
- text: string;
423
- } | undefined;
424
- glossary?: {
425
- term: string;
426
- translatable: boolean;
427
- forbidden: boolean;
428
- caseSensitive: boolean;
429
- description?: string | undefined;
430
- translations?: {
431
- translation: string;
432
- locale: string;
433
- description?: string | undefined;
434
- }[] | undefined;
435
- }[] | undefined;
436
- }, {
437
- translationExamples?: {
438
- sourceValue: string;
439
- translatedValue: string;
440
- }[] | undefined;
441
- description?: string | undefined;
442
- styleGuide?: {
443
- targetAudience?: "general" | "technical" | "non-technical" | undefined;
444
- toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
445
- levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
446
- generalRule?: "active-voice" | "passive-voice" | undefined;
447
- } | {
448
- text: string;
449
- } | undefined;
450
- glossary?: {
451
- term: string;
452
- description?: string | undefined;
453
- translatable?: boolean | undefined;
454
- forbidden?: boolean | undefined;
455
- caseSensitive?: boolean | undefined;
456
- translations?: {
457
- translation: string;
458
- locale: string;
459
- description?: string | undefined;
460
- }[] | undefined;
461
- }[] | undefined;
462
- }>;
161
+ locale: z.ZodString;
162
+ translation: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
163
+ description: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
164
+ }, z.core.$strip>>>;
165
+ }, z.core.$strip>>>;
166
+ }, z.core.$strip>;
463
167
  export type TextRewritingContext = z.infer<typeof TEXT_REWRITING_CONTEXT>;
464
168
  export {};
@@ -1,7 +1,8 @@
1
- import z from 'zod';
1
+ import z from 'zod/v4';
2
2
  import { removeUnicodeNullCharacters } from "../../helpers/removeUnicodeNullCharacters.js";
3
3
  import { CONTENT_UNIT_DESCRIPTION_MAX_LENGTH } from "../translation/sharedSchemas.js";
4
4
  import { LOCALE_SCHEMA, TRANSLATION_EXAMPLES_SCHEMA } from "./commonSchemas.js";
5
+ import { CLDRPluralForm } from "./pluralFormSchemas.js";
5
6
  // ------------------------------------------
6
7
  // Style guide
7
8
  // ------------------------------------------
@@ -89,11 +90,11 @@ export const TRANSLATION_CONTEXT_SCHEMA = z
89
90
  styleGuide: STYLE_GUIDE_SCHEMA.optional(),
90
91
  glossary: z.array(GLOSSARY_TERM_SCHEMA).describe('List of glossary terms').optional(),
91
92
  targetPluralForms: z
92
- .array(z.enum(['zero', 'one', 'two', 'few', 'many', 'other']))
93
+ .array(z.enum(CLDRPluralForm))
93
94
  .nonempty()
94
95
  .optional()
95
96
  .refine((forms) => !forms || forms.length === new Set(forms).size, 'Plural forms must be unique')
96
- .refine((forms) => !forms || forms.includes('other'), 'The `other` form must be included')
97
+ .refine((forms) => !forms || forms.includes(CLDRPluralForm.OTHER), 'The `other` form must be included')
97
98
  .describe('A set of plural forms to be used in the target language. Make sure to always include `other` form'),
98
99
  translationExamples: TRANSLATION_EXAMPLES_SCHEMA.describe('This field is deprecated, please use "translationExamples" at the "segment" level instead. When defined, the translation will attempt to follow the provided sourceValue and translatedValue translation example'),
99
100
  })