Mark up playlist/ShareModal for translations (#74061)

* added Internationalization to share modal

* ordered  chronologically

* changed markup keys

* fixed import in grafana ui component

* pseudo locale file updated

* Removed redundant close-tooltip
This commit is contained in:
Aditi Patel 2023-09-04 03:33:59 -05:00 committed by GitHub
parent 47a756d524
commit cad4fca8aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { SelectableValue, UrlQueryMap, urlUtil } from '@grafana/data'; import { SelectableValue, UrlQueryMap, urlUtil } from '@grafana/data';
import { Checkbox, ClipboardButton, Field, FieldSet, Input, Modal, RadioButtonGroup } from '@grafana/ui'; import { Checkbox, ClipboardButton, Field, FieldSet, Input, Modal, RadioButtonGroup } from '@grafana/ui';
import { t, Trans } from 'app/core/internationalization';
import { buildBaseUrl } from 'app/features/dashboard/components/ShareModal/utils'; import { buildBaseUrl } from 'app/features/dashboard/components/ShareModal/utils';
import { PlaylistMode } from './types'; import { PlaylistMode } from './types';
@ -16,9 +17,9 @@ export const ShareModal = ({ playlistUid, onDismiss }: Props) => {
const [autoFit, setAutofit] = useState(false); const [autoFit, setAutofit] = useState(false);
const modes: Array<SelectableValue<PlaylistMode>> = [ const modes: Array<SelectableValue<PlaylistMode>> = [
{ label: 'Normal', value: false }, { label: t('share-playlist.mode-normal', 'Normal'), value: false },
{ label: 'TV', value: 'tv' }, { label: t('share-playlist.mode-tv', 'TV'), value: 'tv' },
{ label: 'Kiosk', value: true }, { label: t('share-playlist.mode-kiosk', 'Kiosk'), value: true },
]; ];
const params: UrlQueryMap = {}; const params: UrlQueryMap = {};
@ -32,29 +33,29 @@ export const ShareModal = ({ playlistUid, onDismiss }: Props) => {
const shareUrl = urlUtil.renderUrl(`${buildBaseUrl()}/play/${playlistUid}`, params); const shareUrl = urlUtil.renderUrl(`${buildBaseUrl()}/play/${playlistUid}`, params);
return ( return (
<Modal isOpen={true} title="Share playlist" onDismiss={onDismiss}> <Modal isOpen={true} title={t('share-playlist.title', 'Share playlist')} onDismiss={onDismiss}>
<FieldSet> <FieldSet>
<Field label="Mode"> <Field label={t('share-playlist.mode', 'Mode')}>
<RadioButtonGroup value={mode} options={modes} onChange={setMode} /> <RadioButtonGroup value={mode} options={modes} onChange={setMode} />
</Field> </Field>
<Field> <Field>
<Checkbox <Checkbox
label="Autofit" label={t('share-playlist.checkbox-label', 'Autofit')}
description="Panel heights will be adjusted to fit screen size" description={t('share-playlist.checkbox-description', 'Panel heights will be adjusted to fit screen size')}
name="autofix" name="autofix"
value={autoFit} value={autoFit}
onChange={(e) => setAutofit(e.currentTarget.checked)} onChange={(e) => setAutofit(e.currentTarget.checked)}
/> />
</Field> </Field>
<Field label="Link URL"> <Field label={t('share-playlist.link-url-label', 'Link URL')}>
<Input <Input
id="link-url-input" id="link-url-input"
value={shareUrl} value={shareUrl}
readOnly readOnly
addonAfter={ addonAfter={
<ClipboardButton icon="copy" variant="primary" getText={() => shareUrl}> <ClipboardButton icon="copy" variant="primary" getText={() => shareUrl}>
Copy <Trans i18nKey="share-playlist.copy-link-button">Copy</Trans>
</ClipboardButton> </ClipboardButton>
} }
/> />

View File

@ -745,6 +745,17 @@
"copy-button": "In Zwischenablage kopieren" "copy-button": "In Zwischenablage kopieren"
} }
}, },
"share-playlist": {
"checkbox-description": "",
"checkbox-label": "",
"copy-link-button": "",
"link-url-label": "",
"mode": "",
"mode-kiosk": "",
"mode-normal": "",
"mode-tv": "",
"title": ""
},
"shared": { "shared": {
"preferences": { "preferences": {
"theme": { "theme": {

View File

@ -745,6 +745,17 @@
"copy-button": "Copy to Clipboard" "copy-button": "Copy to Clipboard"
} }
}, },
"share-playlist": {
"checkbox-description": "Panel heights will be adjusted to fit screen size",
"checkbox-label": "Autofit",
"copy-link-button": "Copy",
"link-url-label": "Link URL",
"mode": "Mode",
"mode-kiosk": "Kiosk",
"mode-normal": "Normal",
"mode-tv": "TV",
"title": "Share playlist"
},
"shared": { "shared": {
"preferences": { "preferences": {
"theme": { "theme": {

View File

@ -750,6 +750,17 @@
"copy-button": "Copiar al portapapeles" "copy-button": "Copiar al portapapeles"
} }
}, },
"share-playlist": {
"checkbox-description": "",
"checkbox-label": "",
"copy-link-button": "",
"link-url-label": "",
"mode": "",
"mode-kiosk": "",
"mode-normal": "",
"mode-tv": "",
"title": ""
},
"shared": { "shared": {
"preferences": { "preferences": {
"theme": { "theme": {

View File

@ -750,6 +750,17 @@
"copy-button": "Copier dans le presse-papiers" "copy-button": "Copier dans le presse-papiers"
} }
}, },
"share-playlist": {
"checkbox-description": "",
"checkbox-label": "",
"copy-link-button": "",
"link-url-label": "",
"mode": "",
"mode-kiosk": "",
"mode-normal": "",
"mode-tv": "",
"title": ""
},
"shared": { "shared": {
"preferences": { "preferences": {
"theme": { "theme": {

View File

@ -745,6 +745,17 @@
"copy-button": "Cőpy ŧő Cľįpþőäřđ" "copy-button": "Cőpy ŧő Cľįpþőäřđ"
} }
}, },
"share-playlist": {
"checkbox-description": "Päʼnęľ ĥęįģĥŧş ŵįľľ þę äđĵūşŧęđ ŧő ƒįŧ şčřęęʼn şįžę",
"checkbox-label": "Åūŧőƒįŧ",
"copy-link-button": "Cőpy",
"link-url-label": "Ŀįʼnĸ ŮŖĿ",
"mode": "Mőđę",
"mode-kiosk": "Ķįőşĸ",
"mode-normal": "Ńőřmäľ",
"mode-tv": "ŦV",
"title": "Ŝĥäřę pľäyľįşŧ"
},
"shared": { "shared": {
"preferences": { "preferences": {
"theme": { "theme": {

View File

@ -740,6 +740,17 @@
"copy-button": "复制到剪贴板" "copy-button": "复制到剪贴板"
} }
}, },
"share-playlist": {
"checkbox-description": "",
"checkbox-label": "",
"copy-link-button": "",
"link-url-label": "",
"mode": "",
"mode-kiosk": "",
"mode-normal": "",
"mode-tv": "",
"title": ""
},
"shared": { "shared": {
"preferences": { "preferences": {
"theme": { "theme": {