diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/i18n.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/i18n.tsx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/packages/taler-wallet-webextension/src/i18n.tsx b/packages/taler-wallet-webextension/src/i18n.tsx index 83de768c4..4d5f83416 100644 --- a/packages/taler-wallet-webextension/src/i18n.tsx +++ b/packages/taler-wallet-webextension/src/i18n.tsx @@ -72,6 +72,11 @@ interface TranslateProps { * Props to give to the wrapped component. */ wrapProps?: any; + + /** + * Translated elements + */ + children: ComponentChildren; } function getTranslatedChildren( @@ -117,16 +122,14 @@ function getTranslatedChildren( * </Translate> * ``` */ -export class Translate extends Component<TranslateProps, any> { - render() { - const s = stringifyChildren(this.props.children); +export function Translate({children, wrap, wrapProps}: TranslateProps): VNode { + const s = stringifyChildren(children); const translation: string = i18nCore.jed.ngettext(s, s, 1); - const result = getTranslatedChildren(translation, this.props.children); - if (!this.props.wrap) { + const result = getTranslatedChildren(translation, children); + if (!wrap) { return <div>{result}</div>; } - return h(this.props.wrap, this.props.wrapProps, result); - } + return h(wrap, wrapProps, result); } /** |