From 8cdc687abf96617f241407efecf8ee310a85992e Mon Sep 17 00:00:00 2001 From: Collin Fingar Date: Fri, 7 Mar 2025 11:12:07 -0500 Subject: [PATCH] i18n: Marking up Pagination and PageToolbar in Grafana-UI for translation (#101738) * Grafana-UI: Pagination + PageToolbar i18n * betterer results update for i18n fix * Linting fix w/ import order --- .betterer.results | 10 ---------- .../src/components/PageLayout/PageToolbar.tsx | 18 ++++++++++++++---- .../src/components/Pagination/Pagination.tsx | 8 ++++++-- public/locales/en-US/grafana.json | 10 ++++++++++ public/locales/pseudo-LOCALE/grafana.json | 10 ++++++++++ 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/.betterer.results b/.betterer.results index e26bf7cb08e..98094fcc972 100644 --- a/.betterer.results +++ b/.betterer.results @@ -615,16 +615,6 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"], [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"] ], - "packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx:5381": [ - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "2"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "3"] - ], - "packages/grafana-ui/src/components/Pagination/Pagination.tsx:5381": [ - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"] - ], "packages/grafana-ui/src/components/PanelChrome/PanelContext.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] diff --git a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx index fa9a77c9d12..521b059ea8e 100644 --- a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx +++ b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx @@ -7,6 +7,7 @@ import { selectors } from '@grafana/e2e-selectors'; import { useStyles2 } from '../../themes/ThemeContext'; import { getFocusStyles } from '../../themes/mixins'; import { IconName } from '../../types'; +import { t } from '../../utils/i18n'; import { Icon } from '../Icon/Icon'; import { IconButton } from '../IconButton/IconButton'; import { Link } from '../Link/Link'; @@ -82,6 +83,15 @@ export const PageToolbar = memo( ); + const goBackLabel = t('grafana-ui.page-toolbar.go-back', 'Go back (Esc)'); + const searchParentFolderLabel = t( + 'grafana-ui.page-toolbar.search-parent-folder', + 'Search dashboard in the {{parent}} folder', + { parent } + ); + const searchDashboardNameLabel = t('grafana-ui.page-toolbar.search-dashboard-name', 'Search dashboard by name'); + const searchLinksLabel = t('grafana-ui.page-toolbar.search-links', 'Search links'); + return (