Add tOptions prop to <Trans /> in react-i18next (#25089)

This commit is contained in:
Alexander Kachkaev
2018-04-24 16:07:44 -07:00
committed by Wesley Wigham
parent b4ea50c7a9
commit ba5f8c9912
3 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for react-i18next 7.3
// Type definitions for react-i18next 7.6
// Project: https://github.com/i18next/react-i18next
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Simon Baumann <https://github.com/chnoch>
+5
View File
@@ -1,12 +1,17 @@
import * as React from "react";
import { i18n, TranslationFunction } from "i18next";
export interface TOptions {
[key: string]: any;
}
export interface TransProps {
i18nKey?: string;
count?: number;
parent?: string;
i18n?: i18n;
t?: TranslationFunction;
tOptions?: TOptions;
}
export default class Trans extends React.Component<TransProps> { }
@@ -119,6 +119,7 @@ loadNamespaces({components: [App], i18n}).then(() => {
<Trans count={5}>
<App/>
</Trans>;
<Trans i18nKey="hello" tOptions={{hello: "world", count: 42}}/>;
type Key = "view" | "nav";