mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
use _t
on string literals and i18n 'warning'
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
0788826a71
commit
e33e0effa3
@ -22,13 +22,6 @@ import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
|
|||||||
import {updateCheckStatusEnum} from '../../../vector/platform/VectorBasePlatform';
|
import {updateCheckStatusEnum} from '../../../vector/platform/VectorBasePlatform';
|
||||||
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
|
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
|
||||||
|
|
||||||
const statusText = {
|
|
||||||
CHECKING: 'Checking for an update...',
|
|
||||||
ERROR: 'Error encountered (%(errorDetail)s).',
|
|
||||||
NOTAVAILABLE: 'No update available.',
|
|
||||||
DOWNLOADING: 'Downloading update...',
|
|
||||||
};
|
|
||||||
|
|
||||||
const doneStatuses = [
|
const doneStatuses = [
|
||||||
updateCheckStatusEnum.ERROR,
|
updateCheckStatusEnum.ERROR,
|
||||||
updateCheckStatusEnum.NOTAVAILABLE,
|
updateCheckStatusEnum.NOTAVAILABLE,
|
||||||
@ -42,16 +35,37 @@ export default React.createClass({
|
|||||||
detail: React.PropTypes.string,
|
detail: React.PropTypes.string,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDefaultProps: function() {
|
||||||
|
return {
|
||||||
|
detail: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getStatusText: function() {
|
||||||
|
switch(this.props.status) {
|
||||||
|
case updateCheckStatusEnum.ERROR:
|
||||||
|
return _t('Error encountered (%(errorDetail)s).', { errorDetail: this.props.detail });
|
||||||
|
case updateCheckStatusEnum.CHECKING:
|
||||||
|
return _t('Checking for an update...');
|
||||||
|
case updateCheckStatusEnum.NOTAVAILABLE:
|
||||||
|
return _t('No update available.');
|
||||||
|
case updateCheckStatusEnum.DOWNLOADING:
|
||||||
|
return _t('Downloading update...');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
,
|
||||||
|
|
||||||
hideToolbar: function() {
|
hideToolbar: function() {
|
||||||
PlatformPeg.get().stopUpdateCheck();
|
PlatformPeg.get().stopUpdateCheck();
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const message = _t(statusText[this.props.status], { errorDetail: this.props.detail || '' });
|
const message = this.getStatusText();
|
||||||
|
const warning = _t('Warning');
|
||||||
|
|
||||||
let image;
|
let image;
|
||||||
if (doneStatuses.includes(this.props.status)) {
|
if (doneStatuses.includes(this.props.status)) {
|
||||||
image = <img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="Warning"/>;
|
image = <img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt={warning}/>;
|
||||||
} else {
|
} else {
|
||||||
image = <img className="mx_MatrixToolbar_warning" src="img/spinner.gif" width="24" height="23" alt={message}/>;
|
image = <img className="mx_MatrixToolbar_warning" src="img/spinner.gif" width="24" height="23" alt={message}/>;
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,7 @@
|
|||||||
"Today": "Today",
|
"Today": "Today",
|
||||||
"Yesterday": "Yesterday",
|
"Yesterday": "Yesterday",
|
||||||
"OK": "OK",
|
"OK": "OK",
|
||||||
|
"Warning": "Warning",
|
||||||
"Checking for an update...": "Checking for an update...",
|
"Checking for an update...": "Checking for an update...",
|
||||||
"Error encountered (%(errorDetail)s).": "Error encountered (%(errorDetail)s).",
|
"Error encountered (%(errorDetail)s).": "Error encountered (%(errorDetail)s).",
|
||||||
"No update available.": "No update available.",
|
"No update available.": "No update available.",
|
||||||
|
Loading…
Reference in New Issue
Block a user