react-i18next
Advanced tools
Comparing version 11.13.0 to 11.14.0
@@ -0,1 +1,6 @@ | ||
### 11.14.0 | ||
- Remove generics from Trans component to suppress warning issue [1400](https://github.com/i18next/react-i18next/pull/1400) | ||
- Add type support to plurals [1399](https://github.com/i18next/react-i18next/pull/1399) | ||
### 11.13.0 | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "react-i18next", | ||
"version": "11.13.0", | ||
"version": "11.14.0", | ||
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.", | ||
@@ -5,0 +5,0 @@ "main": "dist/commonjs/index.js", |
@@ -38,4 +38,6 @@ import i18next, { | ||
* defaultNS: 'custom'; | ||
* returnNull: false, | ||
* returnEmptyString: false, | ||
* returnNull: false; | ||
* returnEmptyString: false; | ||
* keySeparator: '.'; | ||
* jsonFormat: 'v4'; | ||
* resources: { | ||
@@ -60,2 +62,3 @@ * custom: { | ||
defaultNS: 'translation'; | ||
jsonFormat: 'v4'; | ||
resources: Resources; | ||
@@ -97,2 +100,8 @@ }, | ||
type WithOrWithoutPlural<K> = TypeOptions['jsonFormat'] extends 'v4' | ||
? K extends `${infer B}_${'zero' | 'one' | 'two' | 'few' | 'many' | 'other'}` | ||
? B | K | ||
: K | ||
: K; | ||
// Normalize single namespace | ||
@@ -106,7 +115,7 @@ type AppendKeys<K1, K2, S extends string = TypeOptions['keySeparator']> = `${K1 & string}${S}${K2 & | ||
? T[K] extends readonly any[] | ||
? AppendKeys2<K, keyof T[K]> | AppendKeys2<K, Normalize2<T[K]>> | ||
: AppendKeys<K, keyof T[K]> | AppendKeys<K, Normalize2<T[K]>> | ||
? AppendKeys2<K, WithOrWithoutPlural<keyof T[K]>> | AppendKeys2<K, Normalize2<T[K]>> | ||
: AppendKeys<K, WithOrWithoutPlural<keyof T[K]>> | AppendKeys<K, Normalize2<T[K]>> | ||
: never | ||
: never; | ||
type Normalize<T> = keyof T | Normalize2<T>; | ||
type Normalize<T> = WithOrWithoutPlural<keyof T> | Normalize2<T>; | ||
@@ -210,4 +219,4 @@ // Normalize multiple namespaces | ||
type I18nKeyType<N extends Namespace> = TFuncKey<N> extends infer A ? A : never; | ||
export interface TransProps< | ||
K extends TFuncKey<N> extends infer A ? A : never, | ||
N extends Namespace = DefaultNamespace, | ||
@@ -221,3 +230,3 @@ E extends Element = HTMLDivElement | ||
i18n?: i18n; | ||
i18nKey?: K | K[]; | ||
i18nKey?: I18nKeyType<N> | I18nKeyType<N>[]; | ||
ns?: N; | ||
@@ -229,8 +238,7 @@ parent?: string | React.ComponentType<any> | null; // used in React.createElement if not null | ||
} | ||
export function Trans< | ||
K extends TFuncKey<N> extends infer A ? A : never, | ||
N extends Namespace = DefaultNamespace, | ||
E extends Element = HTMLDivElement | ||
>(props: TransProps<K, N, E>): React.ReactElement; | ||
export function Trans<N extends Namespace = DefaultNamespace, E extends Element = HTMLDivElement>( | ||
props: TransProps<N, E>, | ||
): React.ReactElement; | ||
export function useSSR(initialI18nStore: Resource, initialLanguage: string): void; | ||
@@ -237,0 +245,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
336330
5961