i18next 23.1.0 → 23.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.
@@ -1 +1 @@
1
- {"type":"module","version":"23.1.0"}
1
+ {"type":"module","version":"23.2.0"}
package/index.d.ts CHANGED
@@ -75,6 +75,12 @@ export type TypeOptions = $MergeBy<
75
75
  */
76
76
  defaultNS: 'translation';
77
77
 
78
+ /**
79
+ * Fallback namespace used if translation not found in given namespace
80
+ * @default false
81
+ */
82
+ fallbackNS: false;
83
+
78
84
  /**
79
85
  * Json Format Version - V4 allows plural suffixes
80
86
  */
@@ -516,6 +522,7 @@ export interface InitOptions<T = object> extends PluginOptions<T> {
516
522
 
517
523
  /**
518
524
  * Returns an object that includes information about the used language, namespace, key and value
525
+ * @default false
519
526
  */
520
527
  returnDetails?: boolean;
521
528
 
@@ -740,6 +747,7 @@ type _KeySeparator = TypeOptions['keySeparator'];
740
747
  type _NsSeparator = TypeOptions['nsSeparator'];
741
748
  type _PluralSeparator = TypeOptions['pluralSeparator'];
742
749
  type _DefaultNamespace = TypeOptions['defaultNS'];
750
+ type _FallbackNamespace = TypeOptions['fallbackNS'];
743
751
  type _Resources = TypeOptions['resources'];
744
752
  type _JSONFormat = TypeOptions['jsonFormat'];
745
753
  type _InterpolationPrefix = TypeOptions['interpolationPrefix'];
@@ -833,9 +841,21 @@ export type ParseKeys<
833
841
  Keys extends $Dictionary = KeysByTOptions<TOpt>,
834
842
  ActualNS extends Namespace = NsByTOptions<Ns, TOpt>,
835
843
  > = $IsResourcesDefined extends true
836
- ?
837
- | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
838
- | ParseKeysByNamespaces<ActualNS, Keys>
844
+ ? _FallbackNamespace extends false
845
+ ?
846
+ | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
847
+ | ParseKeysByNamespaces<ActualNS, Keys>
848
+ : _FallbackNamespace extends Array<infer FallbackNs extends Namespace>
849
+ ?
850
+ | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
851
+ | ParseKeysByKeyPrefix<Keys[$FirstNamespace<FallbackNs>], KPrefix>
852
+ | ParseKeysByNamespaces<ActualNS, Keys>
853
+ | ParseKeysByNamespaces<FallbackNs, Keys>
854
+ :
855
+ | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
856
+ | ParseKeysByKeyPrefix<Keys[$FirstNamespace<_FallbackNamespace>], KPrefix>
857
+ | ParseKeysByNamespaces<ActualNS, Keys>
858
+ | ParseKeysByNamespaces<_FallbackNamespace, Keys>
839
859
  : string;
840
860
 
841
861
  /*********************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next",
3
- "version": "23.1.0",
3
+ "version": "23.2.0",
4
4
  "description": "i18next internationalization framework",
5
5
  "main": "./dist/cjs/i18next.js",
6
6
  "module": "./dist/esm/i18next.js",