@i18n-micro/types 1.1.6 → 1.1.7

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/dist/index.d.ts CHANGED
@@ -28,6 +28,29 @@ export type TranslationKey = keyof DefineLocaleMessage extends never ? string :
28
28
  * ```
29
29
  */
30
30
  export type ScopedKey<Scope extends string> = Extract<TranslationKey, `${Scope}.${string}`>;
31
+ /**
32
+ * Locale configuration object.
33
+ *
34
+ * Supports arbitrary custom properties via the index signature `[key: string]: unknown`.
35
+ * To get full TypeScript support for your custom properties, use module augmentation:
36
+ *
37
+ * ```typescript
38
+ * // app/i18n.d.ts (or any .d.ts file included in your tsconfig)
39
+ * declare module '@i18n-micro/types' {
40
+ * interface Locale {
41
+ * flag?: string
42
+ * currency?: string
43
+ * }
44
+ * }
45
+ * ```
46
+ *
47
+ * Then access them with full typing:
48
+ * ```typescript
49
+ * const locales = $getLocales()
50
+ * locales[0].flag // string | undefined (typed!)
51
+ * locales[0].currency // string | undefined (typed!)
52
+ * ```
53
+ */
31
54
  export interface Locale {
32
55
  /** BCP-47 locale code (e.g. `'en'`, `'de-DE'`, `'zh-Hans'`). Used in URLs and as file/key identifier. */
33
56
  code: LocaleCode;
@@ -352,6 +375,17 @@ export interface ModuleOptions {
352
375
  * @default 0
353
376
  */
354
377
  cacheTtl?: number;
378
+ /**
379
+ * Value used for cache-busting translation requests (`?v=...`).
380
+ *
381
+ * When not provided, the module falls back to `Date.now()` (non-deterministic).
382
+ * For reproducible/rolling deployments, set this to a stable value
383
+ * (e.g. a git SHA or build number).
384
+ *
385
+ * @example
386
+ * i18n: { dateBuild: 'e3b0c442' }
387
+ */
388
+ dateBuild?: string | number;
355
389
  /**
356
390
  * Bucket for experimental/unstable options.
357
391
  * Contents may change or be removed without notice between minor versions.
@@ -363,8 +397,8 @@ export interface ModuleOptions {
363
397
  * Includes resolved values and build-time metadata.
364
398
  */
365
399
  export interface ModuleOptionsExtend extends ModuleOptions {
366
- /** Unix timestamp (ms) of the last build. Used for cache-busting translation requests. */
367
- dateBuild: number;
400
+ /** Value used for cache-busting translation requests (`?v=...`). */
401
+ dateBuild: string | number;
368
402
  /** Whether the Nuxt app uses hash-based routing (`router.options.hashMode`). */
369
403
  hashMode: boolean;
370
404
  /** Whether the current build is a static site generation (SSG / `nuxi generate`). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-micro/types",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "",
5
5
  "repository": "s00d/nuxt-i18n-micro",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -33,6 +33,29 @@ export type TranslationKey = keyof DefineLocaleMessage extends never ? string :
33
33
  */
34
34
  export type ScopedKey<Scope extends string> = Extract<TranslationKey, `${Scope}.${string}`>
35
35
 
36
+ /**
37
+ * Locale configuration object.
38
+ *
39
+ * Supports arbitrary custom properties via the index signature `[key: string]: unknown`.
40
+ * To get full TypeScript support for your custom properties, use module augmentation:
41
+ *
42
+ * ```typescript
43
+ * // app/i18n.d.ts (or any .d.ts file included in your tsconfig)
44
+ * declare module '@i18n-micro/types' {
45
+ * interface Locale {
46
+ * flag?: string
47
+ * currency?: string
48
+ * }
49
+ * }
50
+ * ```
51
+ *
52
+ * Then access them with full typing:
53
+ * ```typescript
54
+ * const locales = $getLocales()
55
+ * locales[0].flag // string | undefined (typed!)
56
+ * locales[0].currency // string | undefined (typed!)
57
+ * ```
58
+ */
36
59
  export interface Locale {
37
60
  /** BCP-47 locale code (e.g. `'en'`, `'de-DE'`, `'zh-Hans'`). Used in URLs and as file/key identifier. */
38
61
  code: LocaleCode
@@ -402,6 +425,18 @@ export interface ModuleOptions {
402
425
  */
403
426
  cacheTtl?: number
404
427
 
428
+ /**
429
+ * Value used for cache-busting translation requests (`?v=...`).
430
+ *
431
+ * When not provided, the module falls back to `Date.now()` (non-deterministic).
432
+ * For reproducible/rolling deployments, set this to a stable value
433
+ * (e.g. a git SHA or build number).
434
+ *
435
+ * @example
436
+ * i18n: { dateBuild: 'e3b0c442' }
437
+ */
438
+ dateBuild?: string | number
439
+
405
440
  /**
406
441
  * Bucket for experimental/unstable options.
407
442
  * Contents may change or be removed without notice between minor versions.
@@ -414,8 +449,8 @@ export interface ModuleOptions {
414
449
  * Includes resolved values and build-time metadata.
415
450
  */
416
451
  export interface ModuleOptionsExtend extends ModuleOptions {
417
- /** Unix timestamp (ms) of the last build. Used for cache-busting translation requests. */
418
- dateBuild: number
452
+ /** Value used for cache-busting translation requests (`?v=...`). */
453
+ dateBuild: string | number
419
454
  /** Whether the Nuxt app uses hash-based routing (`router.options.hashMode`). */
420
455
  hashMode: boolean
421
456
  /** Whether the current build is a static site generation (SSG / `nuxi generate`). */