Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i18n] Translations for Monitoring: Cluster and Alerts #24736

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8308ce8
Translations for Cluster and Alerts
maryia-lapata Oct 29, 2018
d6ab54d
Translations for cluster and alerts
maryia-lapata Oct 30, 2018
9f1f062
Translations for cluster and alerts
maryia-lapata Oct 30, 2018
e1a5af0
Fix typos
maryia-lapata Oct 30, 2018
61234ad
Update id
maryia-lapata Oct 30, 2018
3e52b44
Update Notification snapshot
maryia-lapata Oct 30, 2018
7816e55
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Oct 30, 2018
f0daf7c
Translate lastEvent label
maryia-lapata Oct 31, 2018
4f0cdad
Merge branch 'master' into feature/translations/monitoring-cluste
maryia-lapata Oct 31, 2018
0ce9481
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Oct 31, 2018
b087246
Revert changes for untranslated label.
maryia-lapata Oct 31, 2018
17c3a75
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 1, 2018
399d5b4
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 1, 2018
6daeca2
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 2, 2018
0551f1e
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 2, 2018
ded0602
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 5, 2018
1eabd5e
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 7, 2018
f0e6e7b
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 8, 2018
b564634
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 8, 2018
f736832
Merge branch 'master' into feature/translations/monitoring-cluster
maryia-lapata Nov 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/core/public/notifications/toasts/toasts_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';

import { Toast } from '@elastic/eui';
import { I18nProvider } from '@kbn/i18n/react';
import { GlobalToastList } from './global_toast_list';
import { ToastsStartContract } from './toasts_start_contract';

Expand All @@ -35,10 +36,12 @@ export class ToastsService {
const toasts = new ToastsStartContract();

render(
<GlobalToastList
dismissToast={(toast: Toast) => toasts.remove(toast)}
toasts$={toasts.get$()}
/>,
<I18nProvider>
<GlobalToastList
dismissToast={(toast: Toast) => toasts.remove(toast)}
toasts$={toasts.get$()}
/>
</I18nProvider>,
this.params.targetDomElement
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function ApmPanelUi(props) {
<EuiLink
onClick={goToApm}
aria-label={props.intl.formatMessage({
id: 'xpack.monitoring.cluster.overview.apmPanel.apmOverviewLinkAriaLabel', defaultMessage: 'APM Overview' })}
id: 'xpack.monitoring.cluster.overview.apmPanel.overviewLinkAriaLabel', defaultMessage: 'APM Overview' })}
data-test-subj="apmOverview"
>
<FormattedMessage
Expand All @@ -69,7 +69,7 @@ function ApmPanelUi(props) {
</EuiDescriptionListDescription>
<EuiDescriptionListTitle>
<FormattedMessage
id="xpack.monitoring.cluster.overview.apmPanel.lastEventsLabel"
id="xpack.monitoring.cluster.overview.apmPanel.lastEventLabel"
defaultMessage="Last Event"
/>
</EuiDescriptionListTitle>
Expand All @@ -86,13 +86,13 @@ function ApmPanelUi(props) {
<EuiLink
onClick={goToInstances}
aria-label={props.intl.formatMessage({
id: 'xpack.monitoring.cluster.overview.apmPanel.apmInstancesLinkAriaLabel',
id: 'xpack.monitoring.cluster.overview.apmPanel.instancesTotalLinkAriaLabel',
defaultMessage: 'Apm Instances: {apmsTotal}' },
{ apmsTotal: props.apms.total })}
data-test-subj="apmListing"
>
<FormattedMessage
id="xpack.monitoring.cluster.overview.apmPanel.apmServersLinkLabel"
id="xpack.monitoring.cluster.overview.apmPanel.serversTotalLinkLabel"
defaultMessage="APM Servers: {apmsTotal}"
values={{ apmsTotal: (<span data-test-subj="apmsTotal">{props.apms.total}</span>) }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function BeatsPanelUi(props) {
<EuiLink
onClick={goToBeats}
aria-label={props.intl.formatMessage({
id: 'xpack.monitoring.cluster.overview.beatsPanel.beatsLinkAriaLabel', defaultMessage: 'Beats Overview' })}
id: 'xpack.monitoring.cluster.overview.beatsPanel.overviewLinkAriaLabel', defaultMessage: 'Beats Overview' })}
data-test-subj="beatsOverview"
>
<FormattedMessage
Expand Down Expand Up @@ -100,13 +100,13 @@ function BeatsPanelUi(props) {
<EuiLink
onClick={goToInstances}
aria-label={props.intl.formatMessage({
id: 'xpack.monitoring.cluster.overview.beatsPanel.beatsInstancesLinkAriaLabel',
id: 'xpack.monitoring.cluster.overview.beatsPanel.instancesTotalLinkAriaLabel',
defaultMessage: 'Beats Instances: {beatsTotal}' },
{ beatsTotal: props.beats.total })}
data-test-subj="beatsListing"
>
<FormattedMessage
id="xpack.monitoring.cluster.overview.beatsPanel.bytesSentLinkLabel"
id="xpack.monitoring.cluster.overview.beatsPanel.beatsTotalLinkLabel"
defaultMessage="Beats: {beatsTotal}"
values={{ beatsTotal: (<span data-test-subj="beatsTotal">{props.beats.total}</span>) }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function ElasticsearchPanelUi(props) {
return [
<EuiDescriptionListTitle key="mlJobsListTitle">
<FormattedMessage
id="xpack.monitoring.cluster.overview.esPanel.jobLabel"
defaultMessage="Job"
id="xpack.monitoring.cluster.overview.esPanel.jobsLabel"
defaultMessage="Jobs"
/>
</EuiDescriptionListTitle>,
<EuiDescriptionListDescription key="mlJobsCount" data-test-subj="esMlJobs">{ props.ml.jobs }</EuiDescriptionListDescription>
Expand Down Expand Up @@ -137,7 +137,7 @@ function ElasticsearchPanelUi(props) {
onClick={goToNodes}
>
<FormattedMessage
id="xpack.monitoring.cluster.overview.esPanel.nodesLinkLabel"
id="xpack.monitoring.cluster.overview.esPanel.nodesTotalLinkLabel"
defaultMessage="Nodes: {nodesTotal}"
values={{ nodesTotal: formatNumber(get(nodes, 'count.total'), 'int_commas') }}
/>
Expand All @@ -161,7 +161,8 @@ function ElasticsearchPanelUi(props) {
<EuiDescriptionListTitle>
<FormattedMessage
id="xpack.monitoring.cluster.overview.esPanel.jvmHeapLabel"
defaultMessage="JVM Heap"
defaultMessage="{javaVirtualMachine} Heap"
values={{ javaVirtualMachine: 'JVM' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So JVM is not something translated, but I see Elasticsearch not used like this, does that mean Elasticsearch will be translated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. There is also Kibana translation glossary (https://docs.google.com/document/d/1e-lHAPAtxodP8U4gbwA3lw8FyhhW7M303--77nMpe8w/edit) that contains terms that will remain untranslated.
Mostly we put in values such technical labels like property names url.body.query.

/>
</EuiDescriptionListTitle>
<EuiDescriptionListDescription data-test-subj="esJvmHeap">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function HealthStatusIndicator(props) {
return (
<EuiHealth color={statusColor} data-test-subj="statusIcon">
<FormattedMessage
id="xpack.monitoring.cluster.overview.healthDescription"
id="xpack.monitoring.cluster.overview.healthStatusDescription"
defaultMessage="Health is {status}"
values={{ status: props.status }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function KibanaPanelUi(props) {
</EuiDescriptionListTitle>
<EuiDescriptionListDescription data-test-subj="kbnMaxResponseTime">
<FormattedMessage
id="xpack.monitoring.cluster.overview.kibanaPanel.maxResponseTimeText"
id="xpack.monitoring.cluster.overview.kibanaPanel.maxResponseTimeDescription"
defaultMessage="{maxTime} ms"
values={{ maxTime: props.response_time_max }}
/>
Expand All @@ -95,7 +95,7 @@ function KibanaPanelUi(props) {
data-test-subj="kbnInstances"
aria-label={props.intl.formatMessage({
id: 'xpack.monitoring.cluster.overview.kibanaPanel.instancesCountLinkAriaLabel',
defaultMessage: 'Instances: {instancesCount}' },
defaultMessage: 'Kibana Instances: {instancesCount}' },
{ instancesCount: props.count })}
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export function LicenseText({ license, showLicenseExpiration }) {
return (
<EuiLink href="#/license">
<FormattedMessage
id="xpack.monitoring.cluster.overview.license.typeLinkText"
defaultMessage="{licenseType} license{willExpireOn}"
id="xpack.monitoring.cluster.overview.licenseText.toLicensePageLinkLabel"
defaultMessage="{licenseType} license {willExpireOn}"
values={{
licenseType: capitalize(license.type),
willExpireOn: license.expiry_date_in_millis === undefined ? '' : (
<FormattedMessage
id="xpack.monitoring.cluster.overview.license.willExpireOnDateText"
defaultMessage=" will expire on {expiryDate}"
id="xpack.monitoring.cluster.overview.licenseText.expireDateText"
defaultMessage="will expire on {expiryDate}"
values={{ expiryDate: formatDateLocal(license.expiry_date_in_millis) }}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ function LogstashPanelUi(props) {
<EuiDescriptionListTitle>
<FormattedMessage
id="xpack.monitoring.cluster.overview.logstashPanel.jvmHeapLabel"
defaultMessage="JVM Heap"
defaultMessage="{javaVirtualMachine} Heap"
values={{ javaVirtualMachine: 'JVM' }}
/>
</EuiDescriptionListTitle>
<EuiDescriptionListDescription data-test-subj="lsJvmHeap">
Expand Down Expand Up @@ -148,7 +149,7 @@ function LogstashPanelUi(props) {
<span className="kuiIcon fa-flask betaIcon" />
</Tooltip>
<FormattedMessage
id="xpack.monitoring.cluster.overview.logstashPanel.pipelinesLinkLabel"
id="xpack.monitoring.cluster.overview.logstashPanel.pipelinesCountLinkLabel"
defaultMessage="Pipelines: {pipelineCount}"
values={{ pipelineCount: (<span data-test-subj="number_of_logstash_pipelines">{ props.pipeline_count }</span>) }}
/>
Expand Down
112 changes: 86 additions & 26 deletions x-pack/plugins/monitoring/public/directives/alerts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,65 @@ import { FormattedAlert } from 'plugins/monitoring/components/alerts/formatted_a
import { mapSeverity } from 'plugins/monitoring/components/alerts/map_severity';
import { formatTimestampToDuration } from '../../../common/format_timestamp_to_duration';
import { formatDateTimeLocal } from '../../../common/formatting';
import { i18n } from '@kbn/i18n';
import { injectI18n, I18nProvider, FormattedMessage } from '@kbn/i18n/react';

const linkToCategories = {
'elasticsearch/nodes': 'Elasticsearch Nodes',
'elasticsearch/indices': 'Elasticsearch Indices',
'kibana/instances': 'Kibana Instances',
'logstash/instances': 'Logstash Nodes',
'elasticsearch/nodes': i18n.translate('xpack.monitoring.alerts.esNodesCategoryLabel', {
defaultMessage: 'Elasticsearch Nodes',
}),
'elasticsearch/indices': i18n.translate('xpack.monitoring.alerts.esIndicesCategoryLabel', {
defaultMessage: 'Elasticsearch Indices',
}),
'kibana/instances': i18n.translate('xpack.monitoring.alerts.kibanaInstancesCategoryLabel', {
defaultMessage: 'Kibana Instances',
}),
'logstash/instances': i18n.translate('xpack.monitoring.alerts.logstashNodesCategoryLabel', {
defaultMessage: 'Logstash Nodes',
}),
};
const filterFields = [ 'message', 'severity_group', 'prefix', 'suffix', 'metadata.link', 'since', 'timestamp', 'update_timestamp' ];
const columns = [
{ title: 'Status', sortKey: 'metadata.severity', sortOrder: SORT_DESCENDING },
{ title: 'Resolved', sortKey: 'resolved_timestamp' },
{ title: 'Message', sortKey: 'message' },
{ title: 'Category', sortKey: 'metadata.link' },
{ title: 'Last Checked', sortKey: 'update_timestamp' },
{ title: 'Triggered', sortKey: 'timestamp' },
{
title: i18n.translate('xpack.monitoring.alerts.statusColumnTitle', {
defaultMessage: 'Status',
}),
sortKey: 'metadata.severity',
sortOrder: SORT_DESCENDING
},
{
title: i18n.translate('xpack.monitoring.alerts.resolvedColumnTitle', {
defaultMessage: 'Resolved',
}),
sortKey: 'resolved_timestamp'
},
{
title: i18n.translate('xpack.monitoring.alerts.messageColumnTitle', {
defaultMessage: 'Message',
}),
sortKey: 'message'
},
{
title: i18n.translate('xpack.monitoring.alerts.categoryColumnTitle', {
defaultMessage: 'Category',
}),
sortKey: 'metadata.link'
},
{
title: i18n.translate('xpack.monitoring.alerts.lastCheckedColumnTitle', {
defaultMessage: 'Last Checked',
}),
sortKey: 'update_timestamp'
},
{
title: i18n.translate('xpack.monitoring.alerts.triggeredColumnTitle', {
defaultMessage: 'Triggered',
}),
sortKey: 'timestamp'
},
];
const alertRowFactory = (scope, kbnUrl) => {
return props => {
return injectI18n(props => {
const changeUrl = target => {
scope.$evalAsync(() => {
kbnUrl.changePath(target);
Expand All @@ -43,13 +84,24 @@ const alertRowFactory = (scope, kbnUrl) => {
const severityIcon = mapSeverity(props.metadata.severity);
const resolution = {
icon: null,
text: 'Not Resolved'
text: props.intl.formatMessage({ id: 'xpack.monitoring.alerts.notResolvedDescription',
defaultMessage: 'Not Resolved',
})
};

if (props.resolved_timestamp) {
resolution.text = `${formatTimestampToDuration(props.resolved_timestamp, CALCULATE_DURATION_SINCE)} ago`;
resolution.text = props.intl.formatMessage({ id: 'xpack.monitoring.alerts.resolvedAgoDescription',
defaultMessage: '{duraction} ago',
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
}, { duraction: formatTimestampToDuration(props.resolved_timestamp, CALCULATE_DURATION_SINCE) }
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
);
} else {
resolution.icon = <EuiIcon type="alert" size="m" aria-label="Not Resolved" />;
resolution.icon = (
<EuiIcon
type="alert"
size="m"
aria-label={props.intl.formatMessage({ id: 'xpack.monitoring.alerts.notResolvedAriaLabel', defaultMessage: 'Not Resolved', })}
/>
);
}

return (
Expand All @@ -74,36 +126,44 @@ const alertRowFactory = (scope, kbnUrl) => {
/>
</KuiTableRowCell>
<KuiTableRowCell tabIndex="0">
{ linkToCategories[props.metadata.link] ? linkToCategories[props.metadata.link] : 'General' }
{ linkToCategories[props.metadata.link] ? linkToCategories[props.metadata.link] :
props.intl.formatMessage({ id: 'xpack.monitoring.alerts.generalCategoryDescription', defaultMessage: 'General', }) }
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
</KuiTableRowCell>
<KuiTableRowCell tabIndex="0">
{ formatDateTimeLocal(props.update_timestamp) }
</KuiTableRowCell>
<KuiTableRowCell tabIndex="0">
{ formatTimestampToDuration(props.timestamp, CALCULATE_DURATION_SINCE) } ago
<FormattedMessage
id="xpack.monitoring.alerts.trigeredAgoDescription"
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
defaultMessage="{duraction} ago"
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
values={{ duraction: formatTimestampToDuration(props.timestamp, CALCULATE_DURATION_SINCE) }}
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
/>
</KuiTableRowCell>
</KuiTableRow>
);
};
});
};

const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringClusterAlertsListing', kbnUrl => {
uiModule.directive('monitoringClusterAlertsListing', (kbnUrl, i18n) => {
return {
restrict: 'E',
scope: { alerts: '=' },
link(scope, $el) {
const filterAlertsPlaceholder = i18n('xpack.monitoring.alerts.filterAlertsPlaceholder', { defaultMessage: 'Filter Alerts…' });

scope.$watch('alerts', (alerts = []) => {
const alertsTable = (
<MonitoringTable
className="alertsTable"
rows={alerts}
placeholder="Filter Alerts..."
filterFields={filterFields}
columns={columns}
rowComponent={alertRowFactory(scope, kbnUrl)}
/>
<I18nProvider>
<MonitoringTable
className="alertsTable"
rows={alerts}
placeholder={filterAlertsPlaceholder}
filterFields={filterFields}
columns={columns}
rowComponent={alertRowFactory(scope, kbnUrl)}
/>
</I18nProvider>
);
render(alertsTable, $el[0]);
});
Expand Down
Loading