From 0e2626b0048e89189a6742dfbc11549ff833fc42 Mon Sep 17 00:00:00 2001 From: RoxanaAnamariaTurc <106086831+RoxanaAnamariaTurc@users.noreply.github.com> Date: Thu, 29 Jun 2023 13:43:14 +0100 Subject: [PATCH] I18n:Mark up phrases for translation on Permissions drawer (#70842) * I18n:Mark up Permissions * Mark up strings in Permissions file * I18n:Mark up phrases for on Permissions drawer * I18n:Mark up phrases for translation on Permissions page * I18n:Mark up phrases for translation on Permissions page * Made the changes based on suggestions received * restore translations * Run extract again --- .../src/components/Select/SelectBase.tsx | 5 ++-- .../AccessControl/AddPermission.tsx | 20 ++++++++++---- .../AccessControl/PermissionList.tsx | 8 +++++- .../components/AccessControl/Permissions.tsx | 21 ++++++++++----- .../components/FolderActionsButton.tsx | 2 +- public/locales/de-DE/grafana.json | 27 +++++++++++++++++++ public/locales/en-US/grafana.json | 27 +++++++++++++++++++ public/locales/es-ES/grafana.json | 27 +++++++++++++++++++ public/locales/fr-FR/grafana.json | 27 +++++++++++++++++++ public/locales/pseudo-LOCALE/grafana.json | 27 +++++++++++++++++++ public/locales/zh-Hans/grafana.json | 27 +++++++++++++++++++ 11 files changed, 202 insertions(+), 16 deletions(-) diff --git a/packages/grafana-ui/src/components/Select/SelectBase.tsx b/packages/grafana-ui/src/components/Select/SelectBase.tsx index 8a2fd262eb2..419b6ca5a92 100644 --- a/packages/grafana-ui/src/components/Select/SelectBase.tsx +++ b/packages/grafana-ui/src/components/Select/SelectBase.tsx @@ -1,3 +1,4 @@ +import { t } from 'i18next'; import React, { ComponentProps, useCallback, useEffect, useRef, useState } from 'react'; import { default as ReactSelect } from 'react-select'; import { default as ReactAsyncSelect } from 'react-select/async'; @@ -124,7 +125,7 @@ export function SelectBase({ menuPlacement = 'auto', menuPosition, menuShouldPortal = true, - noOptionsMessage = 'No options found', + noOptionsMessage = t('grafana-ui.select.no-options-label', 'No options found'), onBlur, onChange, onCloseMenu, @@ -137,7 +138,7 @@ export function SelectBase({ onFocus, openMenuOnFocus = false, options = [], - placeholder = 'Choose', + placeholder = t('grafana-ui.select.placeholder', 'Choose'), prefix, renderControl, showAllSelectedWhenOpen = true, diff --git a/public/app/core/components/AccessControl/AddPermission.tsx b/public/app/core/components/AccessControl/AddPermission.tsx index 27629fe4dce..cd08bd05025 100644 --- a/public/app/core/components/AccessControl/AddPermission.tsx +++ b/public/app/core/components/AccessControl/AddPermission.tsx @@ -5,6 +5,7 @@ import { Button, Form, Select } from '@grafana/ui'; import { CloseButton } from 'app/core/components/CloseButton/CloseButton'; import { TeamPicker } from 'app/core/components/Select/TeamPicker'; import { UserPicker } from 'app/core/components/Select/UserPicker'; +import { Trans, t } from 'app/core/internationalization'; import { OrgRole } from 'app/types/acl'; import { Assignments, PermissionTarget, SetPermission } from './types'; @@ -17,7 +18,13 @@ export interface Props { onAdd: (state: SetPermission) => void; } -export const AddPermission = ({ title = 'Add permission for', permissions, assignments, onAdd, onCancel }: Props) => { +export const AddPermission = ({ + title = t('access-control.add-permission.title', 'Add permission for'), + permissions, + assignments, + onAdd, + onCancel, +}: Props) => { const [target, setPermissionTarget] = useState(PermissionTarget.None); const [teamId, setTeamId] = useState(0); const [userId, setUserId] = useState(0); @@ -27,13 +34,16 @@ export const AddPermission = ({ title = 'Add permission for', permissions, assig const targetOptions = useMemo(() => { const options = []; if (assignments.users) { - options.push({ value: PermissionTarget.User, label: 'User' }); + options.push({ value: PermissionTarget.User, label: t('access-control.add-permission.user-label', 'User') }); } if (assignments.teams) { - options.push({ value: PermissionTarget.Team, label: 'Team' }); + options.push({ value: PermissionTarget.Team, label: t('access-control.add-permission.team-label', 'Team') }); } if (assignments.builtInRoles) { - options.push({ value: PermissionTarget.BuiltInRole, label: 'Role' }); + options.push({ + value: PermissionTarget.BuiltInRole, + label: t('access-control.add-permission.role-label', 'Role'), + }); } return options; }, [assignments]); @@ -91,7 +101,7 @@ export const AddPermission = ({ title = 'Add permission for', permissions, assig onChange={(v) => setPermission(v.value || '')} /> )} diff --git a/public/app/core/components/AccessControl/PermissionList.tsx b/public/app/core/components/AccessControl/PermissionList.tsx index 334d6857eaa..baadf95b0c7 100644 --- a/public/app/core/components/AccessControl/PermissionList.tsx +++ b/public/app/core/components/AccessControl/PermissionList.tsx @@ -1,5 +1,7 @@ import React, { useMemo } from 'react'; +import { Trans } from 'app/core/internationalization'; + import { PermissionListItem } from './PermissionListItem'; import { ResourcePermission } from './types'; @@ -42,7 +44,11 @@ export const PermissionList = ({ title, items, compareKey, permissionLevels, can {title} - Permission + + + Permission + + diff --git a/public/app/core/components/AccessControl/Permissions.tsx b/public/app/core/components/AccessControl/Permissions.tsx index 68c147d5cac..599b6bfa9bf 100644 --- a/public/app/core/components/AccessControl/Permissions.tsx +++ b/public/app/core/components/AccessControl/Permissions.tsx @@ -7,6 +7,7 @@ import { Space } from '@grafana/experimental'; import { config } from '@grafana/runtime'; import { Button, useStyles2 } from '@grafana/ui'; import { SlideDown } from 'app/core/components/Animations/SlideDown'; +import { Trans, t } from 'app/core/internationalization'; import { getBackendSrv } from 'app/core/services/backend_srv'; import { DescendantCount } from 'app/features/browse-dashboards/components/BrowseActions/DescendantCount'; @@ -39,9 +40,9 @@ export type Props = { }; export const Permissions = ({ - title = 'Permissions', - buttonLabel = 'Add a permission', - emptyLabel = 'There are no permissions', + title = t('access-control.permissions.title', 'Permissions'), + buttonLabel = t('access-control.permissions.add-label', 'Add a permission'), + emptyLabel = t('access-control.permissions.no-permissions', 'There are no permissions'), resource, resourceId, canSetPermissions, @@ -131,13 +132,19 @@ export const Permissions = ({ [items] ); + const titleRole = t('access-control.permissions.role', 'Role'); + const titleUser = t('access-control.permissions.user', 'User'); + const titleTeam = t('access-control.permissions.team', 'Team'); + return (
{canSetPermissions && ( <> {config.featureToggles.nestedFolders && resource === 'folders' && ( <> - This will change permissions for this folder and all its descendants. In total, this will affect: + + This will change permissions for this folder and all its descendants. In total, this will affect: + )}