[i18n] Translate server/status (#26806)

* Translate server -> status

* Fix issues
This commit is contained in:
Nox911 2018-12-14 19:34:50 +03:00 committed by GitHub
parent 2118402b2b
commit a1b9179daa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 9 deletions

View file

@ -18,11 +18,14 @@
*/
import _ from 'lodash';
import { i18n } from '@kbn/i18n';
export const all = [
export const getAll = () => [
{
id: 'red',
title: 'Red',
title: i18n.translate('server.status.redTitle', {
defaultMessage: 'Red'
}),
icon: 'danger',
uiColor: 'danger',
severity: 1000,
@ -32,7 +35,9 @@ export const all = [
},
{
id: 'uninitialized',
title: 'Uninitialized',
title: i18n.translate('server.status.uninitializedTitle', {
defaultMessage: 'Uninitialized'
}),
icon: 'spinner',
uiColor: 'default',
severity: 900,
@ -42,7 +47,9 @@ export const all = [
},
{
id: 'yellow',
title: 'Yellow',
title: i18n.translate('server.status.yellowTitle', {
defaultMessage: 'Yellow'
}),
icon: 'warning',
uiColor: 'warning',
severity: 800,
@ -54,7 +61,9 @@ export const all = [
},
{
id: 'green',
title: 'Green',
title: i18n.translate('server.status.greenTitle', {
defaultMessage: 'Green'
}),
icon: 'success',
uiColor: 'secondary',
severity: 0,
@ -64,7 +73,9 @@ export const all = [
},
{
id: 'disabled',
title: 'Disabled',
title: i18n.translate('server.status.disabledTitle', {
defaultMessage: 'Disabled'
}),
severity: -1,
icon: 'toggle-off',
uiColor: 'default',
@ -74,7 +85,7 @@ export const all = [
}
];
export const allById = _.indexBy(exports.all, 'id');
export const getAllById = () => _.indexBy(exports.getAll(), 'id');
export const defaults = {
icon: 'question',
@ -82,5 +93,5 @@ export const defaults = {
};
export function get(id) {
return exports.allById[id] || _.defaults({ id: id }, exports.defaults);
return exports.getAllById()[id] || _.defaults({ id: id }, exports.defaults);
}

View file

@ -80,7 +80,7 @@ export default class Status extends EventEmitter {
}
}
states.all.forEach(function (state) {
states.getAll().forEach(function (state) {
Status.prototype[state.id] = function (message) {
if (this.state === 'disabled') return;