@lingo.dev/_spec 0.26.5 → 0.27.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.
@@ -79,6 +79,12 @@
79
79
  ]
80
80
  },
81
81
  "default": []
82
+ },
83
+ "injectLocale": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ }
82
88
  }
83
89
  },
84
90
  "additionalProperties": false
@@ -114,6 +120,68 @@
114
120
  "$schema": {
115
121
  "type": "string",
116
122
  "default": "https://lingo.dev/schema/i18n.json"
123
+ },
124
+ "provider": {
125
+ "anyOf": [
126
+ {
127
+ "type": "object",
128
+ "properties": {
129
+ "id": {
130
+ "type": "string",
131
+ "const": "lingo"
132
+ },
133
+ "model": {
134
+ "type": "string",
135
+ "const": "best"
136
+ },
137
+ "prompt": {
138
+ "type": "string"
139
+ },
140
+ "baseUrl": {
141
+ "type": "string"
142
+ }
143
+ },
144
+ "required": [
145
+ "id",
146
+ "model",
147
+ "prompt"
148
+ ],
149
+ "additionalProperties": false
150
+ },
151
+ {
152
+ "type": "object",
153
+ "properties": {
154
+ "id": {
155
+ "type": "string",
156
+ "enum": [
157
+ "openai",
158
+ "anthropic"
159
+ ]
160
+ },
161
+ "model": {
162
+ "type": "string"
163
+ },
164
+ "prompt": {
165
+ "$ref": "#/properties/provider/anyOf/0/properties/prompt"
166
+ },
167
+ "baseUrl": {
168
+ "$ref": "#/properties/provider/anyOf/0/properties/baseUrl"
169
+ }
170
+ },
171
+ "required": [
172
+ "id",
173
+ "model",
174
+ "prompt"
175
+ ],
176
+ "additionalProperties": false
177
+ }
178
+ ],
179
+ "default": {
180
+ "id": "lingo",
181
+ "model": "best",
182
+ "baseUrl": "https://engine.lingo.dev",
183
+ "prompt": ""
184
+ }
117
185
  }
118
186
  },
119
187
  "required": [
package/build/index.cjs CHANGED
@@ -149,6 +149,8 @@ var localeMap = {
149
149
  bg: ["bg-BG"],
150
150
  // Czech (Czech Republic)
151
151
  cs: ["cs-CZ"],
152
+ // Welsh (Wales)
153
+ cy: ["cy-GB"],
152
154
  // Dutch
153
155
  nl: [
154
156
  "nl-NL",
@@ -466,7 +468,8 @@ var configV1_3Definition = extendConfigDefinition(configV1_2Definition, {
466
468
  bucketTypeSchema,
467
469
  _zod2.default.object({
468
470
  include: _zod2.default.array(_zod2.default.union([_zod2.default.string(), bucketItemSchema])).default([]),
469
- exclude: _zod2.default.array(_zod2.default.union([_zod2.default.string(), bucketItemSchema])).default([]).optional()
471
+ exclude: _zod2.default.array(_zod2.default.union([_zod2.default.string(), bucketItemSchema])).default([]).optional(),
472
+ injectLocale: _zod2.default.array(_zod2.default.string()).optional()
470
473
  })
471
474
  ).default({})
472
475
  }),
@@ -495,7 +498,40 @@ var configV1_4Definition = extendConfigDefinition(configV1_3Definition, {
495
498
  $schema: configSchema
496
499
  })
497
500
  });
498
- var LATEST_CONFIG_DEFINITION = configV1_4Definition;
501
+ var commonProviderSchema = _zod2.default.object({
502
+ id: _zod2.default.string(),
503
+ model: _zod2.default.string(),
504
+ prompt: _zod2.default.string(),
505
+ baseUrl: _zod2.default.string().optional()
506
+ });
507
+ var providerSchema = _zod2.default.union([
508
+ commonProviderSchema.extend({
509
+ id: _zod2.default.literal("lingo"),
510
+ model: _zod2.default.literal("best")
511
+ }),
512
+ commonProviderSchema.extend({
513
+ id: _zod2.default.enum(["openai", "anthropic"])
514
+ })
515
+ ]);
516
+ var configV1_5Definition = extendConfigDefinition(configV1_4Definition, {
517
+ createSchema: (baseSchema) => baseSchema.extend({
518
+ provider: providerSchema.default({
519
+ id: "lingo",
520
+ model: "best",
521
+ baseUrl: "https://engine.lingo.dev",
522
+ prompt: ""
523
+ }).optional()
524
+ }),
525
+ createDefaultValue: (baseDefaultValue) => ({
526
+ ...baseDefaultValue,
527
+ version: 1.5
528
+ }),
529
+ createUpgrader: (oldConfig) => ({
530
+ ...oldConfig,
531
+ version: 1.5
532
+ })
533
+ });
534
+ var LATEST_CONFIG_DEFINITION = configV1_5Definition;
499
535
  function parseI18nConfig(rawConfig) {
500
536
  try {
501
537
  const result = LATEST_CONFIG_DEFINITION.parse(rawConfig);
@@ -529,4 +565,5 @@ var defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
529
565
 
530
566
 
531
567
 
532
- exports.LATEST_CONFIG_DEFINITION = LATEST_CONFIG_DEFINITION; exports.bucketItemSchema = bucketItemSchema; exports.bucketTypeSchema = bucketTypeSchema; exports.bucketTypes = bucketTypes; exports.configV0Definition = configV0Definition; exports.configV1Definition = configV1Definition; exports.configV1_1Definition = configV1_1Definition; exports.configV1_2Definition = configV1_2Definition; exports.configV1_3Definition = configV1_3Definition; exports.configV1_4Definition = configV1_4Definition; exports.defaultConfig = defaultConfig; exports.getLocaleCodeDelimiter = getLocaleCodeDelimiter; exports.localeCodeSchema = localeCodeSchema; exports.localeCodes = localeCodes; exports.localeCodesFull = localeCodesFull; exports.localeCodesFullExplicitRegion = localeCodesFullExplicitRegion; exports.localeCodesFullUnderscore = localeCodesFullUnderscore; exports.localeCodesShort = localeCodesShort; exports.localeSchema = localeSchema; exports.normalizeLocale = normalizeLocale; exports.parseI18nConfig = parseI18nConfig; exports.resolveLocaleCode = resolveLocaleCode; exports.resolveOverriddenLocale = resolveOverriddenLocale;
568
+
569
+ exports.LATEST_CONFIG_DEFINITION = LATEST_CONFIG_DEFINITION; exports.bucketItemSchema = bucketItemSchema; exports.bucketTypeSchema = bucketTypeSchema; exports.bucketTypes = bucketTypes; exports.configV0Definition = configV0Definition; exports.configV1Definition = configV1Definition; exports.configV1_1Definition = configV1_1Definition; exports.configV1_2Definition = configV1_2Definition; exports.configV1_3Definition = configV1_3Definition; exports.configV1_4Definition = configV1_4Definition; exports.configV1_5Definition = configV1_5Definition; exports.defaultConfig = defaultConfig; exports.getLocaleCodeDelimiter = getLocaleCodeDelimiter; exports.localeCodeSchema = localeCodeSchema; exports.localeCodes = localeCodes; exports.localeCodesFull = localeCodesFull; exports.localeCodesFullExplicitRegion = localeCodesFullExplicitRegion; exports.localeCodesFullUnderscore = localeCodesFullUnderscore; exports.localeCodesShort = localeCodesShort; exports.localeSchema = localeSchema; exports.normalizeLocale = normalizeLocale; exports.parseI18nConfig = parseI18nConfig; exports.resolveLocaleCode = resolveLocaleCode; exports.resolveOverriddenLocale = resolveOverriddenLocale;
package/build/index.d.cts CHANGED
@@ -32,6 +32,7 @@ declare const localeMap: {
32
32
  readonly ar: readonly ["ar-EG", "ar-SA", "ar-AE", "ar-MA"];
33
33
  readonly bg: readonly ["bg-BG"];
34
34
  readonly cs: readonly ["cs-CZ"];
35
+ readonly cy: readonly ["cy-GB"];
35
36
  readonly nl: readonly ["nl-NL", "nl-BE"];
36
37
  readonly pl: readonly ["pl-PL"];
37
38
  readonly id: readonly ["id-ID"];
@@ -289,6 +290,7 @@ declare const configV1_3Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
289
290
  path: string;
290
291
  delimiter?: "-" | "_" | null | undefined;
291
292
  }>]>, "many">>>;
293
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
292
294
  }, "strip", Z.ZodTypeAny, {
293
295
  include: (string | {
294
296
  path: string;
@@ -298,6 +300,7 @@ declare const configV1_3Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
298
300
  path: string;
299
301
  delimiter?: "-" | "_" | null | undefined;
300
302
  })[] | undefined;
303
+ injectLocale?: string[] | undefined;
301
304
  }, {
302
305
  exclude?: (string | {
303
306
  path: string;
@@ -307,6 +310,7 @@ declare const configV1_3Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
307
310
  path: string;
308
311
  delimiter?: "-" | "_" | null | undefined;
309
312
  })[] | undefined;
313
+ injectLocale?: string[] | undefined;
310
314
  }>>>;
311
315
  }>, Z.ZodRawShape>;
312
316
  declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
@@ -371,6 +375,7 @@ declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
371
375
  path: string;
372
376
  delimiter?: "-" | "_" | null | undefined;
373
377
  }>]>, "many">>>;
378
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
374
379
  }, "strip", Z.ZodTypeAny, {
375
380
  include: (string | {
376
381
  path: string;
@@ -380,6 +385,7 @@ declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
380
385
  path: string;
381
386
  delimiter?: "-" | "_" | null | undefined;
382
387
  })[] | undefined;
388
+ injectLocale?: string[] | undefined;
383
389
  }, {
384
390
  exclude?: (string | {
385
391
  path: string;
@@ -389,11 +395,12 @@ declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
389
395
  path: string;
390
396
  delimiter?: "-" | "_" | null | undefined;
391
397
  })[] | undefined;
398
+ injectLocale?: string[] | undefined;
392
399
  }>>>;
393
400
  }>, {
394
401
  $schema: Z.ZodDefault<Z.ZodString>;
395
402
  }>, Z.ZodRawShape>;
396
- declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
403
+ declare const configV1_5Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
397
404
  version: Z.ZodDefault<Z.ZodNumber>;
398
405
  }, {
399
406
  locale: Z.ZodObject<{
@@ -455,6 +462,7 @@ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShap
455
462
  path: string;
456
463
  delimiter?: "-" | "_" | null | undefined;
457
464
  }>]>, "many">>>;
465
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
458
466
  }, "strip", Z.ZodTypeAny, {
459
467
  include: (string | {
460
468
  path: string;
@@ -464,6 +472,7 @@ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShap
464
472
  path: string;
465
473
  delimiter?: "-" | "_" | null | undefined;
466
474
  })[] | undefined;
475
+ injectLocale?: string[] | undefined;
467
476
  }, {
468
477
  exclude?: (string | {
469
478
  path: string;
@@ -473,9 +482,171 @@ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShap
473
482
  path: string;
474
483
  delimiter?: "-" | "_" | null | undefined;
475
484
  })[] | undefined;
485
+ injectLocale?: string[] | undefined;
476
486
  }>>>;
477
487
  }>, {
478
488
  $schema: Z.ZodDefault<Z.ZodString>;
489
+ }>, {
490
+ provider: Z.ZodOptional<Z.ZodDefault<Z.ZodUnion<[Z.ZodObject<Z.objectUtil.extendShape<{
491
+ id: Z.ZodString;
492
+ model: Z.ZodString;
493
+ prompt: Z.ZodString;
494
+ baseUrl: Z.ZodOptional<Z.ZodString>;
495
+ }, {
496
+ id: Z.ZodLiteral<"lingo">;
497
+ model: Z.ZodLiteral<"best">;
498
+ }>, "strip", Z.ZodTypeAny, {
499
+ id: "lingo";
500
+ model: "best";
501
+ prompt: string;
502
+ baseUrl?: string | undefined;
503
+ }, {
504
+ id: "lingo";
505
+ model: "best";
506
+ prompt: string;
507
+ baseUrl?: string | undefined;
508
+ }>, Z.ZodObject<Z.objectUtil.extendShape<{
509
+ id: Z.ZodString;
510
+ model: Z.ZodString;
511
+ prompt: Z.ZodString;
512
+ baseUrl: Z.ZodOptional<Z.ZodString>;
513
+ }, {
514
+ id: Z.ZodEnum<["openai", "anthropic"]>;
515
+ }>, "strip", Z.ZodTypeAny, {
516
+ id: "openai" | "anthropic";
517
+ model: string;
518
+ prompt: string;
519
+ baseUrl?: string | undefined;
520
+ }, {
521
+ id: "openai" | "anthropic";
522
+ model: string;
523
+ prompt: string;
524
+ baseUrl?: string | undefined;
525
+ }>]>>>;
526
+ }>, Z.ZodRawShape>;
527
+ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
528
+ version: Z.ZodDefault<Z.ZodNumber>;
529
+ }, {
530
+ locale: Z.ZodObject<{
531
+ source: Z.ZodEffects<Z.ZodString, string, string>;
532
+ targets: Z.ZodArray<Z.ZodEffects<Z.ZodString, string, string>, "many">;
533
+ }, "strip", Z.ZodTypeAny, {
534
+ source: string;
535
+ targets: string[];
536
+ }, {
537
+ source: string;
538
+ targets: string[];
539
+ }>;
540
+ buckets: Z.ZodOptional<Z.ZodDefault<Z.ZodRecord<Z.ZodString, Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>>>>;
541
+ }>, {
542
+ buckets: Z.ZodDefault<Z.ZodRecord<Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>, Z.ZodObject<{
543
+ include: Z.ZodDefault<Z.ZodArray<Z.ZodString, "many">>;
544
+ exclude: Z.ZodOptional<Z.ZodDefault<Z.ZodArray<Z.ZodString, "many">>>;
545
+ }, "strip", Z.ZodTypeAny, {
546
+ include: string[];
547
+ exclude?: string[] | undefined;
548
+ }, {
549
+ exclude?: string[] | undefined;
550
+ include?: string[] | undefined;
551
+ }>>>;
552
+ }>, {
553
+ locale: Z.ZodObject<Z.objectUtil.extendShape<{
554
+ source: Z.ZodEffects<Z.ZodString, string, string>;
555
+ targets: Z.ZodArray<Z.ZodEffects<Z.ZodString, string, string>, "many">;
556
+ }, {
557
+ extraSource: Z.ZodOptional<Z.ZodEffects<Z.ZodString, string, string>>;
558
+ }>, "strip", Z.ZodTypeAny, {
559
+ source: string;
560
+ targets: string[];
561
+ extraSource?: string | undefined;
562
+ }, {
563
+ source: string;
564
+ targets: string[];
565
+ extraSource?: string | undefined;
566
+ }>;
567
+ }>, {
568
+ buckets: Z.ZodDefault<Z.ZodRecord<Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>, Z.ZodObject<{
569
+ include: Z.ZodDefault<Z.ZodArray<Z.ZodUnion<[Z.ZodString, Z.ZodObject<{
570
+ path: Z.ZodString;
571
+ delimiter: Z.ZodOptional<Z.ZodUnion<[Z.ZodLiteral<"-">, Z.ZodLiteral<"_">, Z.ZodLiteral<null>]>>;
572
+ }, "strip", Z.ZodTypeAny, {
573
+ path: string;
574
+ delimiter?: "-" | "_" | null | undefined;
575
+ }, {
576
+ path: string;
577
+ delimiter?: "-" | "_" | null | undefined;
578
+ }>]>, "many">>;
579
+ exclude: Z.ZodOptional<Z.ZodDefault<Z.ZodArray<Z.ZodUnion<[Z.ZodString, Z.ZodObject<{
580
+ path: Z.ZodString;
581
+ delimiter: Z.ZodOptional<Z.ZodUnion<[Z.ZodLiteral<"-">, Z.ZodLiteral<"_">, Z.ZodLiteral<null>]>>;
582
+ }, "strip", Z.ZodTypeAny, {
583
+ path: string;
584
+ delimiter?: "-" | "_" | null | undefined;
585
+ }, {
586
+ path: string;
587
+ delimiter?: "-" | "_" | null | undefined;
588
+ }>]>, "many">>>;
589
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
590
+ }, "strip", Z.ZodTypeAny, {
591
+ include: (string | {
592
+ path: string;
593
+ delimiter?: "-" | "_" | null | undefined;
594
+ })[];
595
+ exclude?: (string | {
596
+ path: string;
597
+ delimiter?: "-" | "_" | null | undefined;
598
+ })[] | undefined;
599
+ injectLocale?: string[] | undefined;
600
+ }, {
601
+ exclude?: (string | {
602
+ path: string;
603
+ delimiter?: "-" | "_" | null | undefined;
604
+ })[] | undefined;
605
+ include?: (string | {
606
+ path: string;
607
+ delimiter?: "-" | "_" | null | undefined;
608
+ })[] | undefined;
609
+ injectLocale?: string[] | undefined;
610
+ }>>>;
611
+ }>, {
612
+ $schema: Z.ZodDefault<Z.ZodString>;
613
+ }>, {
614
+ provider: Z.ZodOptional<Z.ZodDefault<Z.ZodUnion<[Z.ZodObject<Z.objectUtil.extendShape<{
615
+ id: Z.ZodString;
616
+ model: Z.ZodString;
617
+ prompt: Z.ZodString;
618
+ baseUrl: Z.ZodOptional<Z.ZodString>;
619
+ }, {
620
+ id: Z.ZodLiteral<"lingo">;
621
+ model: Z.ZodLiteral<"best">;
622
+ }>, "strip", Z.ZodTypeAny, {
623
+ id: "lingo";
624
+ model: "best";
625
+ prompt: string;
626
+ baseUrl?: string | undefined;
627
+ }, {
628
+ id: "lingo";
629
+ model: "best";
630
+ prompt: string;
631
+ baseUrl?: string | undefined;
632
+ }>, Z.ZodObject<Z.objectUtil.extendShape<{
633
+ id: Z.ZodString;
634
+ model: Z.ZodString;
635
+ prompt: Z.ZodString;
636
+ baseUrl: Z.ZodOptional<Z.ZodString>;
637
+ }, {
638
+ id: Z.ZodEnum<["openai", "anthropic"]>;
639
+ }>, "strip", Z.ZodTypeAny, {
640
+ id: "openai" | "anthropic";
641
+ model: string;
642
+ prompt: string;
643
+ baseUrl?: string | undefined;
644
+ }, {
645
+ id: "openai" | "anthropic";
646
+ model: string;
647
+ prompt: string;
648
+ baseUrl?: string | undefined;
649
+ }>]>>>;
479
650
  }>, Z.ZodRawShape>;
480
651
  type I18nConfig = Z.infer<(typeof LATEST_CONFIG_DEFINITION)["schema"]>;
481
652
  declare function parseI18nConfig(rawConfig: unknown): {
@@ -494,8 +665,20 @@ declare function parseI18nConfig(rawConfig: unknown): {
494
665
  path: string;
495
666
  delimiter?: "-" | "_" | null | undefined;
496
667
  })[] | undefined;
668
+ injectLocale?: string[] | undefined;
497
669
  }>>;
498
670
  $schema: string;
671
+ provider?: {
672
+ id: "lingo";
673
+ model: "best";
674
+ prompt: string;
675
+ baseUrl?: string | undefined;
676
+ } | {
677
+ id: "openai" | "anthropic";
678
+ model: string;
679
+ prompt: string;
680
+ baseUrl?: string | undefined;
681
+ } | undefined;
499
682
  };
500
683
  declare const defaultConfig: {
501
684
  version: number;
@@ -513,8 +696,20 @@ declare const defaultConfig: {
513
696
  path: string;
514
697
  delimiter?: "-" | "_" | null | undefined;
515
698
  })[] | undefined;
699
+ injectLocale?: string[] | undefined;
516
700
  }>>;
517
701
  $schema: string;
702
+ provider?: {
703
+ id: "lingo";
704
+ model: "best";
705
+ prompt: string;
706
+ baseUrl?: string | undefined;
707
+ } | {
708
+ id: "openai" | "anthropic";
709
+ model: string;
710
+ prompt: string;
711
+ baseUrl?: string | undefined;
712
+ } | undefined;
518
713
  };
519
714
 
520
- export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, type LocaleDelimiter, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, defaultConfig, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, normalizeLocale, parseI18nConfig, resolveLocaleCode, resolveOverriddenLocale };
715
+ export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, type LocaleDelimiter, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, configV1_5Definition, defaultConfig, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, normalizeLocale, parseI18nConfig, resolveLocaleCode, resolveOverriddenLocale };
package/build/index.d.ts CHANGED
@@ -32,6 +32,7 @@ declare const localeMap: {
32
32
  readonly ar: readonly ["ar-EG", "ar-SA", "ar-AE", "ar-MA"];
33
33
  readonly bg: readonly ["bg-BG"];
34
34
  readonly cs: readonly ["cs-CZ"];
35
+ readonly cy: readonly ["cy-GB"];
35
36
  readonly nl: readonly ["nl-NL", "nl-BE"];
36
37
  readonly pl: readonly ["pl-PL"];
37
38
  readonly id: readonly ["id-ID"];
@@ -289,6 +290,7 @@ declare const configV1_3Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
289
290
  path: string;
290
291
  delimiter?: "-" | "_" | null | undefined;
291
292
  }>]>, "many">>>;
293
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
292
294
  }, "strip", Z.ZodTypeAny, {
293
295
  include: (string | {
294
296
  path: string;
@@ -298,6 +300,7 @@ declare const configV1_3Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
298
300
  path: string;
299
301
  delimiter?: "-" | "_" | null | undefined;
300
302
  })[] | undefined;
303
+ injectLocale?: string[] | undefined;
301
304
  }, {
302
305
  exclude?: (string | {
303
306
  path: string;
@@ -307,6 +310,7 @@ declare const configV1_3Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
307
310
  path: string;
308
311
  delimiter?: "-" | "_" | null | undefined;
309
312
  })[] | undefined;
313
+ injectLocale?: string[] | undefined;
310
314
  }>>>;
311
315
  }>, Z.ZodRawShape>;
312
316
  declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
@@ -371,6 +375,7 @@ declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
371
375
  path: string;
372
376
  delimiter?: "-" | "_" | null | undefined;
373
377
  }>]>, "many">>>;
378
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
374
379
  }, "strip", Z.ZodTypeAny, {
375
380
  include: (string | {
376
381
  path: string;
@@ -380,6 +385,7 @@ declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
380
385
  path: string;
381
386
  delimiter?: "-" | "_" | null | undefined;
382
387
  })[] | undefined;
388
+ injectLocale?: string[] | undefined;
383
389
  }, {
384
390
  exclude?: (string | {
385
391
  path: string;
@@ -389,11 +395,12 @@ declare const configV1_4Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.
389
395
  path: string;
390
396
  delimiter?: "-" | "_" | null | undefined;
391
397
  })[] | undefined;
398
+ injectLocale?: string[] | undefined;
392
399
  }>>>;
393
400
  }>, {
394
401
  $schema: Z.ZodDefault<Z.ZodString>;
395
402
  }>, Z.ZodRawShape>;
396
- declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
403
+ declare const configV1_5Definition: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
397
404
  version: Z.ZodDefault<Z.ZodNumber>;
398
405
  }, {
399
406
  locale: Z.ZodObject<{
@@ -455,6 +462,7 @@ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShap
455
462
  path: string;
456
463
  delimiter?: "-" | "_" | null | undefined;
457
464
  }>]>, "many">>>;
465
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
458
466
  }, "strip", Z.ZodTypeAny, {
459
467
  include: (string | {
460
468
  path: string;
@@ -464,6 +472,7 @@ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShap
464
472
  path: string;
465
473
  delimiter?: "-" | "_" | null | undefined;
466
474
  })[] | undefined;
475
+ injectLocale?: string[] | undefined;
467
476
  }, {
468
477
  exclude?: (string | {
469
478
  path: string;
@@ -473,9 +482,171 @@ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShap
473
482
  path: string;
474
483
  delimiter?: "-" | "_" | null | undefined;
475
484
  })[] | undefined;
485
+ injectLocale?: string[] | undefined;
476
486
  }>>>;
477
487
  }>, {
478
488
  $schema: Z.ZodDefault<Z.ZodString>;
489
+ }>, {
490
+ provider: Z.ZodOptional<Z.ZodDefault<Z.ZodUnion<[Z.ZodObject<Z.objectUtil.extendShape<{
491
+ id: Z.ZodString;
492
+ model: Z.ZodString;
493
+ prompt: Z.ZodString;
494
+ baseUrl: Z.ZodOptional<Z.ZodString>;
495
+ }, {
496
+ id: Z.ZodLiteral<"lingo">;
497
+ model: Z.ZodLiteral<"best">;
498
+ }>, "strip", Z.ZodTypeAny, {
499
+ id: "lingo";
500
+ model: "best";
501
+ prompt: string;
502
+ baseUrl?: string | undefined;
503
+ }, {
504
+ id: "lingo";
505
+ model: "best";
506
+ prompt: string;
507
+ baseUrl?: string | undefined;
508
+ }>, Z.ZodObject<Z.objectUtil.extendShape<{
509
+ id: Z.ZodString;
510
+ model: Z.ZodString;
511
+ prompt: Z.ZodString;
512
+ baseUrl: Z.ZodOptional<Z.ZodString>;
513
+ }, {
514
+ id: Z.ZodEnum<["openai", "anthropic"]>;
515
+ }>, "strip", Z.ZodTypeAny, {
516
+ id: "openai" | "anthropic";
517
+ model: string;
518
+ prompt: string;
519
+ baseUrl?: string | undefined;
520
+ }, {
521
+ id: "openai" | "anthropic";
522
+ model: string;
523
+ prompt: string;
524
+ baseUrl?: string | undefined;
525
+ }>]>>>;
526
+ }>, Z.ZodRawShape>;
527
+ declare const LATEST_CONFIG_DEFINITION: ConfigDefinition<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<Z.objectUtil.extendShape<{
528
+ version: Z.ZodDefault<Z.ZodNumber>;
529
+ }, {
530
+ locale: Z.ZodObject<{
531
+ source: Z.ZodEffects<Z.ZodString, string, string>;
532
+ targets: Z.ZodArray<Z.ZodEffects<Z.ZodString, string, string>, "many">;
533
+ }, "strip", Z.ZodTypeAny, {
534
+ source: string;
535
+ targets: string[];
536
+ }, {
537
+ source: string;
538
+ targets: string[];
539
+ }>;
540
+ buckets: Z.ZodOptional<Z.ZodDefault<Z.ZodRecord<Z.ZodString, Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>>>>;
541
+ }>, {
542
+ buckets: Z.ZodDefault<Z.ZodRecord<Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>, Z.ZodObject<{
543
+ include: Z.ZodDefault<Z.ZodArray<Z.ZodString, "many">>;
544
+ exclude: Z.ZodOptional<Z.ZodDefault<Z.ZodArray<Z.ZodString, "many">>>;
545
+ }, "strip", Z.ZodTypeAny, {
546
+ include: string[];
547
+ exclude?: string[] | undefined;
548
+ }, {
549
+ exclude?: string[] | undefined;
550
+ include?: string[] | undefined;
551
+ }>>>;
552
+ }>, {
553
+ locale: Z.ZodObject<Z.objectUtil.extendShape<{
554
+ source: Z.ZodEffects<Z.ZodString, string, string>;
555
+ targets: Z.ZodArray<Z.ZodEffects<Z.ZodString, string, string>, "many">;
556
+ }, {
557
+ extraSource: Z.ZodOptional<Z.ZodEffects<Z.ZodString, string, string>>;
558
+ }>, "strip", Z.ZodTypeAny, {
559
+ source: string;
560
+ targets: string[];
561
+ extraSource?: string | undefined;
562
+ }, {
563
+ source: string;
564
+ targets: string[];
565
+ extraSource?: string | undefined;
566
+ }>;
567
+ }>, {
568
+ buckets: Z.ZodDefault<Z.ZodRecord<Z.ZodEnum<["android", "csv", "flutter", "html", "json", "markdown", "xcode-strings", "xcode-stringsdict", "xcode-xcstrings", "yaml", "yaml-root-key", "properties", "po", "xliff", "xml", "srt", "dato", "compiler", "vtt", "php", "po", "vue-json"]>, Z.ZodObject<{
569
+ include: Z.ZodDefault<Z.ZodArray<Z.ZodUnion<[Z.ZodString, Z.ZodObject<{
570
+ path: Z.ZodString;
571
+ delimiter: Z.ZodOptional<Z.ZodUnion<[Z.ZodLiteral<"-">, Z.ZodLiteral<"_">, Z.ZodLiteral<null>]>>;
572
+ }, "strip", Z.ZodTypeAny, {
573
+ path: string;
574
+ delimiter?: "-" | "_" | null | undefined;
575
+ }, {
576
+ path: string;
577
+ delimiter?: "-" | "_" | null | undefined;
578
+ }>]>, "many">>;
579
+ exclude: Z.ZodOptional<Z.ZodDefault<Z.ZodArray<Z.ZodUnion<[Z.ZodString, Z.ZodObject<{
580
+ path: Z.ZodString;
581
+ delimiter: Z.ZodOptional<Z.ZodUnion<[Z.ZodLiteral<"-">, Z.ZodLiteral<"_">, Z.ZodLiteral<null>]>>;
582
+ }, "strip", Z.ZodTypeAny, {
583
+ path: string;
584
+ delimiter?: "-" | "_" | null | undefined;
585
+ }, {
586
+ path: string;
587
+ delimiter?: "-" | "_" | null | undefined;
588
+ }>]>, "many">>>;
589
+ injectLocale: Z.ZodOptional<Z.ZodArray<Z.ZodString, "many">>;
590
+ }, "strip", Z.ZodTypeAny, {
591
+ include: (string | {
592
+ path: string;
593
+ delimiter?: "-" | "_" | null | undefined;
594
+ })[];
595
+ exclude?: (string | {
596
+ path: string;
597
+ delimiter?: "-" | "_" | null | undefined;
598
+ })[] | undefined;
599
+ injectLocale?: string[] | undefined;
600
+ }, {
601
+ exclude?: (string | {
602
+ path: string;
603
+ delimiter?: "-" | "_" | null | undefined;
604
+ })[] | undefined;
605
+ include?: (string | {
606
+ path: string;
607
+ delimiter?: "-" | "_" | null | undefined;
608
+ })[] | undefined;
609
+ injectLocale?: string[] | undefined;
610
+ }>>>;
611
+ }>, {
612
+ $schema: Z.ZodDefault<Z.ZodString>;
613
+ }>, {
614
+ provider: Z.ZodOptional<Z.ZodDefault<Z.ZodUnion<[Z.ZodObject<Z.objectUtil.extendShape<{
615
+ id: Z.ZodString;
616
+ model: Z.ZodString;
617
+ prompt: Z.ZodString;
618
+ baseUrl: Z.ZodOptional<Z.ZodString>;
619
+ }, {
620
+ id: Z.ZodLiteral<"lingo">;
621
+ model: Z.ZodLiteral<"best">;
622
+ }>, "strip", Z.ZodTypeAny, {
623
+ id: "lingo";
624
+ model: "best";
625
+ prompt: string;
626
+ baseUrl?: string | undefined;
627
+ }, {
628
+ id: "lingo";
629
+ model: "best";
630
+ prompt: string;
631
+ baseUrl?: string | undefined;
632
+ }>, Z.ZodObject<Z.objectUtil.extendShape<{
633
+ id: Z.ZodString;
634
+ model: Z.ZodString;
635
+ prompt: Z.ZodString;
636
+ baseUrl: Z.ZodOptional<Z.ZodString>;
637
+ }, {
638
+ id: Z.ZodEnum<["openai", "anthropic"]>;
639
+ }>, "strip", Z.ZodTypeAny, {
640
+ id: "openai" | "anthropic";
641
+ model: string;
642
+ prompt: string;
643
+ baseUrl?: string | undefined;
644
+ }, {
645
+ id: "openai" | "anthropic";
646
+ model: string;
647
+ prompt: string;
648
+ baseUrl?: string | undefined;
649
+ }>]>>>;
479
650
  }>, Z.ZodRawShape>;
480
651
  type I18nConfig = Z.infer<(typeof LATEST_CONFIG_DEFINITION)["schema"]>;
481
652
  declare function parseI18nConfig(rawConfig: unknown): {
@@ -494,8 +665,20 @@ declare function parseI18nConfig(rawConfig: unknown): {
494
665
  path: string;
495
666
  delimiter?: "-" | "_" | null | undefined;
496
667
  })[] | undefined;
668
+ injectLocale?: string[] | undefined;
497
669
  }>>;
498
670
  $schema: string;
671
+ provider?: {
672
+ id: "lingo";
673
+ model: "best";
674
+ prompt: string;
675
+ baseUrl?: string | undefined;
676
+ } | {
677
+ id: "openai" | "anthropic";
678
+ model: string;
679
+ prompt: string;
680
+ baseUrl?: string | undefined;
681
+ } | undefined;
499
682
  };
500
683
  declare const defaultConfig: {
501
684
  version: number;
@@ -513,8 +696,20 @@ declare const defaultConfig: {
513
696
  path: string;
514
697
  delimiter?: "-" | "_" | null | undefined;
515
698
  })[] | undefined;
699
+ injectLocale?: string[] | undefined;
516
700
  }>>;
517
701
  $schema: string;
702
+ provider?: {
703
+ id: "lingo";
704
+ model: "best";
705
+ prompt: string;
706
+ baseUrl?: string | undefined;
707
+ } | {
708
+ id: "openai" | "anthropic";
709
+ model: string;
710
+ prompt: string;
711
+ baseUrl?: string | undefined;
712
+ } | undefined;
518
713
  };
519
714
 
520
- export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, type LocaleDelimiter, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, defaultConfig, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, normalizeLocale, parseI18nConfig, resolveLocaleCode, resolveOverriddenLocale };
715
+ export { type BucketItem, type I18nConfig, LATEST_CONFIG_DEFINITION, type LocaleCode, type LocaleCodeFull, type LocaleCodeShort, type LocaleDelimiter, bucketItemSchema, bucketTypeSchema, bucketTypes, configV0Definition, configV1Definition, configV1_1Definition, configV1_2Definition, configV1_3Definition, configV1_4Definition, configV1_5Definition, defaultConfig, getLocaleCodeDelimiter, localeCodeSchema, localeCodes, localeCodesFull, localeCodesFullExplicitRegion, localeCodesFullUnderscore, localeCodesShort, localeSchema, normalizeLocale, parseI18nConfig, resolveLocaleCode, resolveOverriddenLocale };
package/build/index.mjs CHANGED
@@ -149,6 +149,8 @@ var localeMap = {
149
149
  bg: ["bg-BG"],
150
150
  // Czech (Czech Republic)
151
151
  cs: ["cs-CZ"],
152
+ // Welsh (Wales)
153
+ cy: ["cy-GB"],
152
154
  // Dutch
153
155
  nl: [
154
156
  "nl-NL",
@@ -466,7 +468,8 @@ var configV1_3Definition = extendConfigDefinition(configV1_2Definition, {
466
468
  bucketTypeSchema,
467
469
  Z3.object({
468
470
  include: Z3.array(Z3.union([Z3.string(), bucketItemSchema])).default([]),
469
- exclude: Z3.array(Z3.union([Z3.string(), bucketItemSchema])).default([]).optional()
471
+ exclude: Z3.array(Z3.union([Z3.string(), bucketItemSchema])).default([]).optional(),
472
+ injectLocale: Z3.array(Z3.string()).optional()
470
473
  })
471
474
  ).default({})
472
475
  }),
@@ -495,7 +498,40 @@ var configV1_4Definition = extendConfigDefinition(configV1_3Definition, {
495
498
  $schema: configSchema
496
499
  })
497
500
  });
498
- var LATEST_CONFIG_DEFINITION = configV1_4Definition;
501
+ var commonProviderSchema = Z3.object({
502
+ id: Z3.string(),
503
+ model: Z3.string(),
504
+ prompt: Z3.string(),
505
+ baseUrl: Z3.string().optional()
506
+ });
507
+ var providerSchema = Z3.union([
508
+ commonProviderSchema.extend({
509
+ id: Z3.literal("lingo"),
510
+ model: Z3.literal("best")
511
+ }),
512
+ commonProviderSchema.extend({
513
+ id: Z3.enum(["openai", "anthropic"])
514
+ })
515
+ ]);
516
+ var configV1_5Definition = extendConfigDefinition(configV1_4Definition, {
517
+ createSchema: (baseSchema) => baseSchema.extend({
518
+ provider: providerSchema.default({
519
+ id: "lingo",
520
+ model: "best",
521
+ baseUrl: "https://engine.lingo.dev",
522
+ prompt: ""
523
+ }).optional()
524
+ }),
525
+ createDefaultValue: (baseDefaultValue) => ({
526
+ ...baseDefaultValue,
527
+ version: 1.5
528
+ }),
529
+ createUpgrader: (oldConfig) => ({
530
+ ...oldConfig,
531
+ version: 1.5
532
+ })
533
+ });
534
+ var LATEST_CONFIG_DEFINITION = configV1_5Definition;
499
535
  function parseI18nConfig(rawConfig) {
500
536
  try {
501
537
  const result = LATEST_CONFIG_DEFINITION.parse(rawConfig);
@@ -516,6 +552,7 @@ export {
516
552
  configV1_2Definition,
517
553
  configV1_3Definition,
518
554
  configV1_4Definition,
555
+ configV1_5Definition,
519
556
  defaultConfig,
520
557
  getLocaleCodeDelimiter,
521
558
  localeCodeSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingo.dev/_spec",
3
- "version": "0.26.5",
3
+ "version": "0.27.0",
4
4
  "description": "Lingo.dev open specification",
5
5
  "private": false,
6
6
  "publishConfig": {