From 88a2485cc260eb5b2976ee67f201e591c56cf771 Mon Sep 17 00:00:00 2001
From: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
Date: Tue, 4 Jun 2024 10:19:53 +0200
Subject: [PATCH] Alerting: Update translations in GrafanaEvaluationBehaviour
component (#88638)
* Update translations
* Fix key in translations
* Interpolate point char in the Trans children text
* Use interpolation correctly in Trans component
---
.betterer.results | 11 -----
.../rule-editor/GrafanaEvaluationBehavior.tsx | 46 +++++++++++++------
public/locales/en-US/grafana.json | 22 +++++++++
public/locales/pseudo-LOCALE/grafana.json | 22 +++++++++
4 files changed, 77 insertions(+), 24 deletions(-)
diff --git a/.betterer.results b/.betterer.results
index e5c01c52ec8..669d6e84e79 100644
--- a/.betterer.results
+++ b/.betterer.results
@@ -2073,17 +2073,6 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "13"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "14"]
],
- "public/app/features/alerting/unified/components/rule-editor/GrafanaEvaluationBehavior.tsx:5381": [
- [0, 0, 0, "No untranslated strings. Wrap text with ", "0"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "1"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "2"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "3"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "4"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "5"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "6"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "7"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "8"]
- ],
"public/app/features/alerting/unified/components/rule-editor/NeedHelpInfo.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"]
],
diff --git a/public/app/features/alerting/unified/components/rule-editor/GrafanaEvaluationBehavior.tsx b/public/app/features/alerting/unified/components/rule-editor/GrafanaEvaluationBehavior.tsx
index 939bd993524..93833664bb4 100644
--- a/public/app/features/alerting/unified/components/rule-editor/GrafanaEvaluationBehavior.tsx
+++ b/public/app/features/alerting/unified/components/rule-editor/GrafanaEvaluationBehavior.tsx
@@ -1,9 +1,10 @@
import { css } from '@emotion/css';
import React, { useCallback, useEffect, useState } from 'react';
-import { RegisterOptions, useFormContext, Controller } from 'react-hook-form';
+import { Controller, RegisterOptions, useFormContext } from 'react-hook-form';
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
import { Field, Icon, IconButton, Input, Label, Stack, Switch, Text, Tooltip, useStyles2 } from '@grafana/ui';
+import { Trans, t } from 'app/core/internationalization';
import { CombinedRuleGroup, CombinedRuleNamespace } from '../../../../../types/unified-alerting';
import { LogMessages, logInfo } from '../../Analytics';
@@ -46,14 +47,19 @@ const forValidationOptions = (evaluateEvery: string): RegisterOptions => ({
const millisEvery = parsePrometheusDuration(evaluateEvery);
return millisFor >= millisEvery
? true
- : 'Pending period must be greater than or equal to the evaluation interval.';
+ : t(
+ 'alert-rule-form.evaluation-behaviour-for.validation',
+ 'Pending period must be greater than or equal to the evaluation interval.'
+ );
} catch (err) {
// if we fail to parse "every", assume validation is successful, or the error messages
// will overlap in the UI
return true;
}
} catch (error) {
- return error instanceof Error ? error.message : 'Failed to parse duration';
+ return error instanceof Error
+ ? error.message
+ : t('alert-rule-form.evaluation-behaviour-for.error-parsing', 'Failed to parse duration');
}
},
});
@@ -139,7 +145,9 @@ function FolderGroupAndEvaluationInterval({
{getValues('group') && getValues('evaluateEvery') && (
- All rules in the selected group are evaluated every {evaluateEvery}.{' '}
+
+ All rules in the selected group are evaluated every {{ evaluateEvery }}.
+
{!isNewGroup && (
- Pending period
+ Pending period
}
className={styles.inlineField}
@@ -211,7 +219,9 @@ function NeedHelpInfoForConfigureNoDataError() {
return (
- Define the alert behavior when the evaluation fails or the query returns no data.
+
+ Define the alert behavior when the evaluation fails or the query returns no data.
+
- Define how the alert rule is evaluated.
+
+ Define how the alert rule is evaluated.
+
-
Evaluation groups are containers for evaluating alert and recording rules.
- An evaluation group defines an evaluation interval - how often a rule is evaluated. Alert rules within the
- same evaluation group are evaluated over the same evaluation interval.
+
+ Evaluation groups are containers for evaluating alert and recording rules.
+
- Pending period specifies how long the threshold condition must be met before the alert starts firing. This
- option helps prevent alerts from being triggered by temporary issues.
+
+ An evaluation group defines an evaluation interval - how often a rule is evaluated. Alert rules within
+ the same evaluation group are evaluated over the same evaluation interval.
+
+
+
+
+ Pending period specifies how long the threshold condition must be met before the alert starts firing.
+ This option helps prevent alerts from being triggered by temporary issues.
+