Skip to content

Commit

Permalink
internationalization for cases toast messages && plural for anomaly c…
Browse files Browse the repository at this point in the history
…hart
  • Loading branch information
rbrtj committed Dec 19, 2024
1 parent 4c193b7 commit 7f408c6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
14 changes: 11 additions & 3 deletions x-pack/platform/plugins/shared/aiops/public/cases/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';

/**
* Titles for the cases toast messages
*/
export const TITLES = {
CHANGE_POINT_DETECTION: 'Change point detection',
LOG_RATE_ANALYSIS: 'Log rate analysis',
PATTERN_ANALYSIS: 'Log pattern analysis',
CHANGE_POINT_DETECTION: i18n.translate('xpack.aiops.cases.changePointDetectionTitle', {
defaultMessage: 'Change point chart',
}),
LOG_RATE_ANALYSIS: i18n.translate('xpack.aiops.cases.logRateAnalysisTitle', {
defaultMessage: 'Log rate analysis',
}),
PATTERN_ANALYSIS: i18n.translate('xpack.aiops.cases.logPatternAnalysisTitle', {
defaultMessage: 'Log pattern analysis',
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const useCasesModal = <EmbeddableType extends MlEmbeddableTypes>(
],
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[embeddableType]

[embeddableType, selectCaseModal]
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const AnomalyContextMenu: FC<AnomalyContextMenuProps> = ({

const openCasesModal = useCasesModal(
ANOMALY_EXPLORER_CHARTS_EMBEDDABLE_TYPE,
TITLES.ANOMALY_CHARTS
TITLES.ANOMALY_CHARTS(maxSeriesToPlot)
);

const canEditDashboards = capabilities.dashboard?.createNew ?? false;
Expand Down
18 changes: 15 additions & 3 deletions x-pack/platform/plugins/shared/ml/public/cases/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';

/**
* Titles for the cases toast messages
*/
export const TITLES = {
ANOMALY_TIMELINE: 'Anomaly timeline',
ANOMALY_CHARTS: 'Anomaly charts',
SINGLE_METRIC_VIEWER: 'Single metric viewer',
ANOMALY_TIMELINE: i18n.translate('xpack.ml.cases.anomalyTimelineTitle', {
defaultMessage: 'Anomaly timeline',
}),
ANOMALY_CHARTS: (chartsCount: number) =>
i18n.translate('xpack.ml.cases.anomalyChartsTitle', {
defaultMessage: 'Anomaly {chartsCount, plural, one {chart} other {charts}}',
values: {
chartsCount,
},
}),
SINGLE_METRIC_VIEWER: i18n.translate('xpack.ml.cases.singleMetricViewerTitle', {
defaultMessage: 'Single metric viewer',
}),
};

0 comments on commit 7f408c6

Please sign in to comment.