mirror of https://github.com/vector-im/riot-web
_t for SetMxIdDialog
parent
85aa3f6f13
commit
6125395675
|
@ -21,6 +21,7 @@ import sdk from '../../../index';
|
||||||
import MatrixClientPeg from '../../../MatrixClientPeg';
|
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import KeyCode from '../../../KeyCode';
|
import KeyCode from '../../../KeyCode';
|
||||||
|
import { _t, _tJsx } from '../../../languageHandler';
|
||||||
|
|
||||||
// The amount of time to wait for further changes to the input username before
|
// The amount of time to wait for further changes to the input username before
|
||||||
// sending a request to the server
|
// sending a request to the server
|
||||||
|
@ -120,10 +121,13 @@ export default React.createClass({
|
||||||
console.error('Error whilst checking username availability: ', err);
|
console.error('Error whilst checking username availability: ', err);
|
||||||
switch (err.errcode) {
|
switch (err.errcode) {
|
||||||
case "M_USER_IN_USE":
|
case "M_USER_IN_USE":
|
||||||
newState.usernameError = 'Username not available';
|
newState.usernameError = _t('Username not available');
|
||||||
break;
|
break;
|
||||||
case "M_INVALID_USERNAME":
|
case "M_INVALID_USERNAME":
|
||||||
newState.usernameError = 'Username invalid: ' + err.message;
|
newState.usernameError = _t(
|
||||||
|
'Username invalid: %(errMessage)',
|
||||||
|
{ errMessage: err.message},
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "M_UNRECOGNIZED":
|
case "M_UNRECOGNIZED":
|
||||||
// This homeserver doesn't support username checking, assume it's
|
// This homeserver doesn't support username checking, assume it's
|
||||||
|
@ -131,10 +135,13 @@ export default React.createClass({
|
||||||
newState.usernameError = '';
|
newState.usernameError = '';
|
||||||
break;
|
break;
|
||||||
case undefined:
|
case undefined:
|
||||||
newState.usernameError = 'Something went wrong!';
|
newState.usernameError = _t('Something went wrong!');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
newState.usernameError = 'An error occurred: ' + err.message;
|
newState.usernameError = _t(
|
||||||
|
'An error occurred: %(errMessage)',
|
||||||
|
{ errMessage: err.message },
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
|
@ -218,7 +225,7 @@ export default React.createClass({
|
||||||
"success": usernameAvailable,
|
"success": usernameAvailable,
|
||||||
});
|
});
|
||||||
usernameIndicator = <div className={usernameIndicatorClasses}>
|
usernameIndicator = <div className={usernameIndicatorClasses}>
|
||||||
{ usernameAvailable ? 'Username available' : this.state.usernameError }
|
{ usernameAvailable ? _t('Username available') : this.state.usernameError }
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,15 +257,25 @@ export default React.createClass({
|
||||||
</div>
|
</div>
|
||||||
{ usernameIndicator }
|
{ usernameIndicator }
|
||||||
<p>
|
<p>
|
||||||
This will be your account name on
|
{ _tJsx(
|
||||||
the {this.props.homeserverUrl} homeserver,
|
'This will be your account name on the <span></span> ' +
|
||||||
or you can pick a
|
'homeserver, or you can pick a <a>different server</a>.',
|
||||||
<a href="#" onClick={this.props.onDifferentServerClicked}>
|
[
|
||||||
different server
|
/<span><\/span>/,
|
||||||
</a>.
|
/<a>(.*?)<\/a>/,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
(sub) => <span>{this.props.homeserverUrl}</span>,
|
||||||
|
(sub) => <a href="#" onClick={this.props.onDifferentServerClicked}>{sub}</a>,
|
||||||
|
],
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
If you already have a Matrix account you can <a href="#" onClick={this.props.onLoginClick}>log in</a> instead.
|
{ _tJsx(
|
||||||
|
'If you already have a Matrix account you can <a>log in</a> instead.',
|
||||||
|
/<a>(.*?)<\/a>/,
|
||||||
|
[(sub) => <a href="#" onClick={this.props.onLoginClick}>{sub}</a>],
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
{ auth }
|
{ auth }
|
||||||
{ authErrorIndicator }
|
{ authErrorIndicator }
|
||||||
|
@ -266,7 +283,7 @@ export default React.createClass({
|
||||||
<div className="mx_Dialog_buttons">
|
<div className="mx_Dialog_buttons">
|
||||||
<input className="mx_Dialog_primary"
|
<input className="mx_Dialog_primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
value="Continue"
|
value={_t("Continue")}
|
||||||
onClick={this.onSubmit}
|
onClick={this.onSubmit}
|
||||||
disabled={!canContinue}
|
disabled={!canContinue}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue