i18n: dashboard settings (#75854)

* feat: i18n dashboard settings

* run i18n extract

* rename titles and use vars

* json editor title

---------

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
Abhi Shandilya 2023-10-03 10:12:44 -04:00 committed by GitHub
parent e8a708c16e
commit 6150d1370c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 141 additions and 16 deletions

View File

@ -9,6 +9,7 @@ import { Button, ToolbarButtonRow } from '@grafana/ui';
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate'; import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate';
import { Page } from 'app/core/components/Page/Page'; import { Page } from 'app/core/components/Page/Page';
import config from 'app/core/config'; import config from 'app/core/config';
import { t } from 'app/core/internationalization';
import { contextSrv } from 'app/core/services/context_srv'; import { contextSrv } from 'app/core/services/context_srv';
import { AccessControlAction } from 'app/types'; import { AccessControlAction } from 'app/types';
import { DashboardMetaChangedEvent } from 'app/types/events'; import { DashboardMetaChangedEvent } from 'app/types/events';
@ -91,16 +92,18 @@ export function DashboardSettings({ dashboard, editview, pageNav, sectionNav }:
function getSettingsPages(dashboard: DashboardModel) { function getSettingsPages(dashboard: DashboardModel) {
const pages: SettingsPage[] = []; const pages: SettingsPage[] = [];
const generalTitle = t('dashboard-settings.general.title', 'General');
if (dashboard.meta.canEdit) { if (dashboard.meta.canEdit) {
pages.push({ pages.push({
title: 'General', title: generalTitle,
id: 'settings', id: 'settings',
icon: 'sliders-v-alt', icon: 'sliders-v-alt',
component: GeneralSettings, component: GeneralSettings,
}); });
pages.push({ pages.push({
title: 'Annotations', title: t('dashboard-settings.annotations.title', 'Annotations'),
id: 'annotations', id: 'annotations',
icon: 'comment-alt', icon: 'comment-alt',
component: AnnotationsSettings, component: AnnotationsSettings,
@ -109,7 +112,7 @@ function getSettingsPages(dashboard: DashboardModel) {
}); });
pages.push({ pages.push({
title: 'Variables', title: t('dashboard-settings.variables.title', 'Variables'),
id: 'templating', id: 'templating',
icon: 'calculator-alt', icon: 'calculator-alt',
component: VariableEditorContainer, component: VariableEditorContainer,
@ -117,7 +120,7 @@ function getSettingsPages(dashboard: DashboardModel) {
}); });
pages.push({ pages.push({
title: 'Links', title: t('dashboard-settings.links.title', 'Links'),
id: 'links', id: 'links',
icon: 'link', icon: 'link',
component: LinksSettings, component: LinksSettings,
@ -126,7 +129,7 @@ function getSettingsPages(dashboard: DashboardModel) {
if (dashboard.meta.canMakeEditable) { if (dashboard.meta.canMakeEditable) {
pages.push({ pages.push({
title: 'General', title: generalTitle,
icon: 'sliders-v-alt', icon: 'sliders-v-alt',
id: 'settings', id: 'settings',
component: MakeEditable, component: MakeEditable,
@ -135,24 +138,26 @@ function getSettingsPages(dashboard: DashboardModel) {
if (dashboard.id && dashboard.meta.canSave) { if (dashboard.id && dashboard.meta.canSave) {
pages.push({ pages.push({
title: 'Versions', title: t('dashboard-settings.versions.title', 'Versions'),
id: 'versions', id: 'versions',
icon: 'history', icon: 'history',
component: VersionsSettings, component: VersionsSettings,
}); });
} }
const permissionsTitle = t('dashboard-settings.permissions.title', 'Permissions');
if (dashboard.id && dashboard.meta.canAdmin) { if (dashboard.id && dashboard.meta.canAdmin) {
if (!config.rbacEnabled) { if (!config.rbacEnabled) {
pages.push({ pages.push({
title: 'Permissions', title: permissionsTitle,
id: 'permissions', id: 'permissions',
icon: 'lock', icon: 'lock',
component: DashboardPermissions, component: DashboardPermissions,
}); });
} else if (contextSrv.hasPermission(AccessControlAction.DashboardsPermissionsRead)) { } else if (contextSrv.hasPermission(AccessControlAction.DashboardsPermissionsRead)) {
pages.push({ pages.push({
title: 'Permissions', title: permissionsTitle,
id: 'permissions', id: 'permissions',
icon: 'lock', icon: 'lock',
component: AccessControlDashboardPermissions, component: AccessControlDashboardPermissions,
@ -161,7 +166,7 @@ function getSettingsPages(dashboard: DashboardModel) {
} }
pages.push({ pages.push({
title: 'JSON Model', title: t('dashboard-settings.json-editor.title', 'JSON Model'),
id: 'dashboard_json', id: 'dashboard_json',
icon: 'arrow', icon: 'arrow',
component: JsonEditorSettings, component: JsonEditorSettings,
@ -185,7 +190,7 @@ function getSectionNav(
location: H.Location location: H.Location
): NavModel { ): NavModel {
const main: NavModelItem = { const main: NavModelItem = {
text: 'Settings', text: t('dashboard-settings.settings.title', 'Settings'),
children: [], children: [],
icon: 'apps', icon: 'apps',
hideFromBreadcrumbs: true, hideFromBreadcrumbs: true,

View File

@ -260,6 +260,9 @@
} }
}, },
"dashboard-settings": { "dashboard-settings": {
"annotations": {
"title": ""
},
"dashboard-delete-button": "", "dashboard-delete-button": "",
"general": { "general": {
"auto-refresh-description": "", "auto-refresh-description": "",
@ -272,11 +275,22 @@
"panel-options-graph-tooltip-label": "", "panel-options-graph-tooltip-label": "",
"panel-options-label": "", "panel-options-label": "",
"tags-label": "", "tags-label": "",
"title": "",
"title-label": "" "title-label": ""
}, },
"json-editor": { "json-editor": {
"save-button": "", "save-button": "",
"subtitle": "" "subtitle": "",
"title": ""
},
"links": {
"title": ""
},
"permissions": {
"title": ""
},
"settings": {
"title": ""
}, },
"time-picker": { "time-picker": {
"hide-time-picker": "", "hide-time-picker": "",
@ -287,6 +301,12 @@
"time-options-label": "", "time-options-label": "",
"time-zone-label": "", "time-zone-label": "",
"week-start-label": "" "week-start-label": ""
},
"variables": {
"title": ""
},
"versions": {
"title": ""
} }
}, },
"data-source-picker": { "data-source-picker": {

View File

@ -260,6 +260,9 @@
} }
}, },
"dashboard-settings": { "dashboard-settings": {
"annotations": {
"title": "Annotations"
},
"dashboard-delete-button": "Delete Dashboard", "dashboard-delete-button": "Delete Dashboard",
"general": { "general": {
"auto-refresh-description": "Define the auto refresh intervals that should be available in the auto refresh list.", "auto-refresh-description": "Define the auto refresh intervals that should be available in the auto refresh list.",
@ -272,11 +275,22 @@
"panel-options-graph-tooltip-label": "Graph tooltip", "panel-options-graph-tooltip-label": "Graph tooltip",
"panel-options-label": "Panel options", "panel-options-label": "Panel options",
"tags-label": "Tags", "tags-label": "Tags",
"title": "General",
"title-label": "Title" "title-label": "Title"
}, },
"json-editor": { "json-editor": {
"save-button": "Save changes", "save-button": "Save changes",
"subtitle": "The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel settings, layout, queries, and so on." "subtitle": "The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel settings, layout, queries, and so on.",
"title": "JSON Model"
},
"links": {
"title": "Links"
},
"permissions": {
"title": "Permissions"
},
"settings": {
"title": "Settings"
}, },
"time-picker": { "time-picker": {
"hide-time-picker": "Hide time picker", "hide-time-picker": "Hide time picker",
@ -287,6 +301,12 @@
"time-options-label": "Time options", "time-options-label": "Time options",
"time-zone-label": "Time zone", "time-zone-label": "Time zone",
"week-start-label": "Week start" "week-start-label": "Week start"
},
"variables": {
"title": "Variables"
},
"versions": {
"title": "Versions"
} }
}, },
"data-source-picker": { "data-source-picker": {

View File

@ -265,6 +265,9 @@
} }
}, },
"dashboard-settings": { "dashboard-settings": {
"annotations": {
"title": ""
},
"dashboard-delete-button": "", "dashboard-delete-button": "",
"general": { "general": {
"auto-refresh-description": "", "auto-refresh-description": "",
@ -277,11 +280,22 @@
"panel-options-graph-tooltip-label": "", "panel-options-graph-tooltip-label": "",
"panel-options-label": "", "panel-options-label": "",
"tags-label": "", "tags-label": "",
"title": "",
"title-label": "" "title-label": ""
}, },
"json-editor": { "json-editor": {
"save-button": "", "save-button": "",
"subtitle": "" "subtitle": "",
"title": ""
},
"links": {
"title": ""
},
"permissions": {
"title": ""
},
"settings": {
"title": ""
}, },
"time-picker": { "time-picker": {
"hide-time-picker": "", "hide-time-picker": "",
@ -292,6 +306,12 @@
"time-options-label": "", "time-options-label": "",
"time-zone-label": "", "time-zone-label": "",
"week-start-label": "" "week-start-label": ""
},
"variables": {
"title": ""
},
"versions": {
"title": ""
} }
}, },
"data-source-picker": { "data-source-picker": {

View File

@ -265,6 +265,9 @@
} }
}, },
"dashboard-settings": { "dashboard-settings": {
"annotations": {
"title": ""
},
"dashboard-delete-button": "", "dashboard-delete-button": "",
"general": { "general": {
"auto-refresh-description": "", "auto-refresh-description": "",
@ -277,11 +280,22 @@
"panel-options-graph-tooltip-label": "", "panel-options-graph-tooltip-label": "",
"panel-options-label": "", "panel-options-label": "",
"tags-label": "", "tags-label": "",
"title": "",
"title-label": "" "title-label": ""
}, },
"json-editor": { "json-editor": {
"save-button": "", "save-button": "",
"subtitle": "" "subtitle": "",
"title": ""
},
"links": {
"title": ""
},
"permissions": {
"title": ""
},
"settings": {
"title": ""
}, },
"time-picker": { "time-picker": {
"hide-time-picker": "", "hide-time-picker": "",
@ -292,6 +306,12 @@
"time-options-label": "", "time-options-label": "",
"time-zone-label": "", "time-zone-label": "",
"week-start-label": "" "week-start-label": ""
},
"variables": {
"title": ""
},
"versions": {
"title": ""
} }
}, },
"data-source-picker": { "data-source-picker": {

View File

@ -260,6 +260,9 @@
} }
}, },
"dashboard-settings": { "dashboard-settings": {
"annotations": {
"title": "Åʼnʼnőŧäŧįőʼnş"
},
"dashboard-delete-button": "Đęľęŧę Đäşĥþőäřđ", "dashboard-delete-button": "Đęľęŧę Đäşĥþőäřđ",
"general": { "general": {
"auto-refresh-description": "Đęƒįʼnę ŧĥę äūŧő řęƒřęşĥ įʼnŧęřväľş ŧĥäŧ şĥőūľđ þę äväįľäþľę įʼn ŧĥę äūŧő řęƒřęşĥ ľįşŧ.", "auto-refresh-description": "Đęƒįʼnę ŧĥę äūŧő řęƒřęşĥ įʼnŧęřväľş ŧĥäŧ şĥőūľđ þę äväįľäþľę įʼn ŧĥę äūŧő řęƒřęşĥ ľįşŧ.",
@ -272,11 +275,22 @@
"panel-options-graph-tooltip-label": "Ğřäpĥ ŧőőľŧįp", "panel-options-graph-tooltip-label": "Ğřäpĥ ŧőőľŧįp",
"panel-options-label": "Päʼnęľ őpŧįőʼnş", "panel-options-label": "Päʼnęľ őpŧįőʼnş",
"tags-label": "Ŧäģş", "tags-label": "Ŧäģş",
"title": "Ğęʼnęřäľ",
"title-label": "Ŧįŧľę" "title-label": "Ŧįŧľę"
}, },
"json-editor": { "json-editor": {
"save-button": "Ŝävę čĥäʼnģęş", "save-button": "Ŝävę čĥäʼnģęş",
"subtitle": "Ŧĥę ĴŜØŃ mőđęľ þęľőŵ įş ŧĥę đäŧä şŧřūčŧūřę ŧĥäŧ đęƒįʼnęş ŧĥę đäşĥþőäřđ. Ŧĥįş įʼnčľūđęş đäşĥþőäřđ şęŧŧįʼnģş, päʼnęľ şęŧŧįʼnģş, ľäyőūŧ, qūęřįęş, äʼnđ şő őʼn." "subtitle": "Ŧĥę ĴŜØŃ mőđęľ þęľőŵ įş ŧĥę đäŧä şŧřūčŧūřę ŧĥäŧ đęƒįʼnęş ŧĥę đäşĥþőäřđ. Ŧĥįş įʼnčľūđęş đäşĥþőäřđ şęŧŧįʼnģş, päʼnęľ şęŧŧįʼnģş, ľäyőūŧ, qūęřįęş, äʼnđ şő őʼn.",
"title": "ĴŜØŃ Mőđęľ"
},
"links": {
"title": "Ŀįʼnĸş"
},
"permissions": {
"title": "Pęřmįşşįőʼnş"
},
"settings": {
"title": "Ŝęŧŧįʼnģş"
}, },
"time-picker": { "time-picker": {
"hide-time-picker": "Ħįđę ŧįmę pįčĸęř", "hide-time-picker": "Ħįđę ŧįmę pįčĸęř",
@ -287,6 +301,12 @@
"time-options-label": "Ŧįmę őpŧįőʼnş", "time-options-label": "Ŧįmę őpŧįőʼnş",
"time-zone-label": "Ŧįmę žőʼnę", "time-zone-label": "Ŧįmę žőʼnę",
"week-start-label": "Ŵęęĸ şŧäřŧ" "week-start-label": "Ŵęęĸ şŧäřŧ"
},
"variables": {
"title": "Väřįäþľęş"
},
"versions": {
"title": "Vęřşįőʼnş"
} }
}, },
"data-source-picker": { "data-source-picker": {

View File

@ -255,6 +255,9 @@
} }
}, },
"dashboard-settings": { "dashboard-settings": {
"annotations": {
"title": ""
},
"dashboard-delete-button": "", "dashboard-delete-button": "",
"general": { "general": {
"auto-refresh-description": "", "auto-refresh-description": "",
@ -267,11 +270,22 @@
"panel-options-graph-tooltip-label": "", "panel-options-graph-tooltip-label": "",
"panel-options-label": "", "panel-options-label": "",
"tags-label": "", "tags-label": "",
"title": "",
"title-label": "" "title-label": ""
}, },
"json-editor": { "json-editor": {
"save-button": "", "save-button": "",
"subtitle": "" "subtitle": "",
"title": ""
},
"links": {
"title": ""
},
"permissions": {
"title": ""
},
"settings": {
"title": ""
}, },
"time-picker": { "time-picker": {
"hide-time-picker": "", "hide-time-picker": "",
@ -282,6 +296,12 @@
"time-options-label": "", "time-options-label": "",
"time-zone-label": "", "time-zone-label": "",
"week-start-label": "" "week-start-label": ""
},
"variables": {
"title": ""
},
"versions": {
"title": ""
} }
}, },
"data-source-picker": { "data-source-picker": {