translate InfraOps visualization component (Part 4 - server part) (#25217) (#26168)

* translate InfraOps visualization component (Part 4 - server part)

* update translation of Infra Ops vizualization component (Part 4)

* remove unnessesary translations

* change some ids

* change some ids

* change one id
This commit is contained in:
tibmt 2018-11-26 14:06:59 +03:00 committed by GitHub
parent c4fd5d341a
commit 278405b66b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

View file

@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
import { flatten } from 'lodash';
import { InfraMetric, InfraMetricData, InfraNodeType } from '../../../../common/graphql/types';
import { InfraBackendFrameworkAdapter, InfraFrameworkRequest } from '../framework';
@ -44,7 +45,14 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter {
const validNode = await checkValidNode(search, indexPattern, nodeField, options.nodeId);
if (!validNode) {
throw new Error(`${options.nodeId} does not exist.`);
throw new Error(
i18n.translate('xpack.infra.kibanaMetrics.nodeDoesNotExistErrorMessage', {
defaultMessage: '{nodeId} does not exist.',
values: {
nodeId: options.nodeId,
},
})
);
}
const requests = options.metrics.map(metricId => {
@ -59,7 +67,14 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter {
return metricIds.map((id: string) => {
const infraMetricId: InfraMetric = (InfraMetric as any)[id];
if (!infraMetricId) {
throw new Error(`${id} is not a valid InfraMetric`);
throw new Error(
i18n.translate('xpack.infra.kibanaMetrics.invalidInfraMetricErrorMessage', {
defaultMessage: '{id} is not a valid InfraMetric',
values: {
id,
},
})
);
}
const panel = result[infraMetricId];
return {

View file

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
export class InfraSources {
constructor(private readonly adapter: InfraSourcesAdapter) {}
@ -12,7 +13,14 @@ export class InfraSources {
const requestedSourceConfiguration = sourceConfigurations[sourceId];
if (!requestedSourceConfiguration) {
throw new Error(`Failed to find source '${sourceId}'`);
throw new Error(
i18n.translate('xpack.infra.infraSources.failedToFindSourceErrorMessage', {
defaultMessage: 'Failed to find source {sourceId}',
values: {
sourceId: `'${sourceId}'`,
},
})
);
}
return requestedSourceConfiguration;