diff --git a/themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/signingin-page/SigningInPage.tsx b/themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/signingin-page/SigningInPage.tsx index 43034c11da..45dce9be54 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/signingin-page/SigningInPage.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/resources/app/content/signingin-page/SigningInPage.tsx @@ -258,7 +258,9 @@ class SigningInPage extends React.Component - + + {credContainer.helptext && } + , ]}/> diff --git a/themes/src/main/resources/theme/keycloak-preview/account/resources/app/widgets/Msg.tsx b/themes/src/main/resources/theme/keycloak-preview/account/resources/app/widgets/Msg.tsx index 25738bde91..327e4130af 100644 --- a/themes/src/main/resources/theme/keycloak-preview/account/resources/app/widgets/Msg.tsx +++ b/themes/src/main/resources/theme/keycloak-preview/account/resources/app/widgets/Msg.tsx @@ -19,7 +19,7 @@ import * as React from 'react'; declare const l18nMsg: {[key: string]: string}; export interface MsgProps { - readonly msgKey: string | undefined; + readonly msgKey: string; readonly params?: string[]; } @@ -30,14 +30,24 @@ export class Msg extends React.Component { } public render(): React.ReactNode { + if (this.props.children) { + return Msg.localizeWithChildren(this.props.msgKey, this.props.children); + } return ( {Msg.localize(this.props.msgKey, this.props.params)} ); } + + private static localizeWithChildren(msgKey: string, children: React.ReactNode): React.ReactNode { + const message: string = l18nMsg[this.processKey(msgKey)]; + const parts = message.split(/\{\{param_\d*}}/); + const count = React.Children.count(children); + return React.Children.map(children, (child, i) => + [parts[i], child, count === i + 1 ? parts[count] : ''] + ); + } - public static localize(msgKey: string | undefined, params?: string[]): string { - if (msgKey === undefined) return ''; - + public static localize(msgKey: string, params?: string[]): string { let message: string = l18nMsg[this.processKey(msgKey)]; if (message === undefined) message = msgKey; @@ -47,7 +57,7 @@ export class Msg extends React.Component { message = message.replace('{{param_'+ index + '}}', value); }) } - + return unescape(message); }