mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
[Chore] Dashboard: Add i18n for creating a panel, row, library panel, and pasted panel (#66234)
* add translation keys for empty dashboard redesign * run yarn i18n:extract; rephrase one trans key because of [warning] Found translation key already mapped to a map or parent of new key already mapped to a string: dashboard.toolbar.add.visualization * reduce to 3-step locale phrase IDs * extract phrase IDs
This commit is contained in:
@@ -5,6 +5,7 @@ import tinycolor from 'tinycolor2';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { LibraryPanel } from '@grafana/schema';
|
||||
import { IconButton, useStyles2 } from '@grafana/ui';
|
||||
import { Trans } from 'app/core/internationalization';
|
||||
|
||||
import {
|
||||
LibraryPanelsSearch,
|
||||
@@ -42,7 +43,9 @@ export const AddLibraryPanelWidget = ({ panel, dashboard }: Props) => {
|
||||
<div className={styles.wrapper}>
|
||||
<div className={cx('panel-container', styles.callToAction)}>
|
||||
<div className={cx(styles.headerRow, 'grid-drag-handle')}>
|
||||
<span>Add panel from panel library</span>
|
||||
<span>
|
||||
<Trans i18nKey="library-panel.add-widget.title">Add panel from panel library</Trans>
|
||||
</span>
|
||||
<div className="flex-grow-1" />
|
||||
<IconButton aria-label="Close 'Add Panel' widget" name="times" onClick={onCancelAddPanel} />
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import React, { useState } from 'react';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { Dropdown, Button, useTheme2, Icon } from '@grafana/ui';
|
||||
import { Trans } from 'app/core/internationalization';
|
||||
import { DashboardModel } from 'app/features/dashboard/state';
|
||||
|
||||
import { AddPanelMenu } from './AddPanelMenu';
|
||||
@@ -30,7 +31,7 @@ export const AddPanelButton = ({ dashboard }: Props) => {
|
||||
className={cx(styles.button, styles.buttonIcon, styles.buttonText)}
|
||||
data-testid={selectors.components.PageToolbar.itemButton('Add panel button')}
|
||||
>
|
||||
Add
|
||||
<Trans i18nKey="dashboard.toolbar.add">Add</Trans>
|
||||
<Icon name={isMenuOpen ? 'angle-up' : 'angle-down'} size="lg" />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
|
||||
@@ -3,6 +3,7 @@ import React, { useMemo } from 'react';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { locationService, reportInteraction } from '@grafana/runtime';
|
||||
import { Menu } from '@grafana/ui';
|
||||
import { t } from 'app/core/internationalization';
|
||||
import { DashboardModel } from 'app/features/dashboard/state';
|
||||
import {
|
||||
getCopiedPanelPlugin,
|
||||
@@ -23,7 +24,7 @@ export const AddPanelMenu = ({ dashboard }: Props) => {
|
||||
<Menu>
|
||||
<Menu.Item
|
||||
key="add-visualisation"
|
||||
label="Visualization"
|
||||
label={t('dashboard.add-menu.visualization', 'Visualization')}
|
||||
testId={selectors.components.PageToolbar.itemButton('Add new visualization menu item')}
|
||||
onClick={() => {
|
||||
reportInteraction('Create new panel');
|
||||
@@ -33,7 +34,7 @@ export const AddPanelMenu = ({ dashboard }: Props) => {
|
||||
/>
|
||||
<Menu.Item
|
||||
key="add-row"
|
||||
label="Row"
|
||||
label={t('dashboard.add-menu.row', 'Row')}
|
||||
testId={selectors.components.PageToolbar.itemButton('Add new row menu item')}
|
||||
onClick={() => {
|
||||
reportInteraction('Create new row');
|
||||
@@ -42,7 +43,7 @@ export const AddPanelMenu = ({ dashboard }: Props) => {
|
||||
/>
|
||||
<Menu.Item
|
||||
key="add-panel-lib"
|
||||
label="Import from library"
|
||||
label={t('dashboard.add-menu.import', 'Import from library')}
|
||||
testId={selectors.components.PageToolbar.itemButton('Add new panel from panel library menu item')}
|
||||
onClick={() => {
|
||||
reportInteraction('Add a panel from the panel library');
|
||||
@@ -51,7 +52,7 @@ export const AddPanelMenu = ({ dashboard }: Props) => {
|
||||
/>
|
||||
<Menu.Item
|
||||
key="add-panel-clipboard"
|
||||
label="Paste panel"
|
||||
label={t('dashboard.add-menu.paste-panel', 'Paste panel')}
|
||||
testId={selectors.components.PageToolbar.itemButton('Add new panel from clipboard menu item')}
|
||||
onClick={() => {
|
||||
reportInteraction('Paste panel from clipboard');
|
||||
|
||||
Reference in New Issue
Block a user