Skip to content

Commit

Permalink
[Canvas] i18n for page manager, page preview, and shape preview (#46865)
Browse files Browse the repository at this point in the history
* i18n for page manager, page preview, and shape preview

* Addressing feedback

* Forgot to remove ShapePreview
  • Loading branch information
poffdeluxe committed Oct 3, 2019
1 parent 8d2bc28 commit 4a867a1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
27 changes: 27 additions & 0 deletions x-pack/legacy/plugins/canvas/i18n/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,33 @@ export const ComponentStrings = {
defaultMessage: 'Closes keyboard shortcuts reference',
}),
},
PageManager: {
getPageNumberAriaLabel: (pageNumber: number) =>
i18n.translate('xpack.canvas.pageManager.pageNumberAriaLabel', {
defaultMessage: 'Load page number {pageNumber}',
values: {
pageNumber,
},
}),
},
PagePreviewPageControls: {
getClonePageAriaLabel: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.clonePageAriaLabel', {
defaultMessage: 'Clone page',
}),
getClonePageTooltip: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.clonePageTooltip', {
defaultMessage: 'Clone',
}),
getDeletePageAriaLabel: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.deletePageAriaLabel', {
defaultMessage: 'Delete page',
}),
getDeletePageTooltip: () =>
i18n.translate('xpack.canvas.pagePreviewPageControls.deletePageTooltip', {
defaultMessage: 'Delete',
}),
},
Toolbar: {
getEditorButtonLabel: () =>
i18n.translate('xpack.canvas.toolbar.editorButtonLabel', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { ConfirmModal } from '../confirm_modal';
import { Link } from '../link';
import { PagePreview } from '../page_preview';

import { ComponentStrings } from '../../../i18n';

const { PageManager: strings } = ComponentStrings;

export class PageManager extends React.PureComponent {
static propTypes = {
isWriteable: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -154,7 +158,7 @@ export class PageManager extends React.PureComponent {
<Link
name="loadWorkpad"
params={{ id: workpadId, page: pageNumber }}
aria-label={`Load page number ${pageNumber}`}
aria-label={strings.getPageNumberAriaLabel(pageNumber)}
>
{Style.it(
workpadCSS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import React from 'react';
import PropTypes from 'prop-types';
import { EuiFlexGroup, EuiFlexItem, EuiButtonIcon, EuiToolTip } from '@elastic/eui';

import { ComponentStrings } from '../../../i18n';

const { PagePreviewPageControls: strings } = ComponentStrings;

export const PageControls = ({ pageId, onDelete, onDuplicate }) => {
const handleDuplicate = ev => {
ev.preventDefault();
Expand All @@ -26,20 +30,20 @@ export const PageControls = ({ pageId, onDelete, onDuplicate }) => {
justifyContent="spaceBetween"
>
<EuiFlexItem grow={false}>
<EuiToolTip content="Duplicate">
<EuiToolTip content={strings.getClonePageTooltip()}>
<EuiButtonIcon
iconType="document"
aria-label="Duplicate Page"
iconType="copy"
aria-label={strings.getClonePageAriaLabel()}
onClick={handleDuplicate}
/>
</EuiToolTip>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiToolTip content="Delete">
<EuiToolTip content={strings.getDeletePageTooltip()}>
<EuiButtonIcon
color="danger"
iconType="trash"
aria-label="Delete Page"
aria-label={strings.getDeletePageAriaLabel()}
onClick={handleDelete}
/>
</EuiToolTip>
Expand Down

0 comments on commit 4a867a1

Please sign in to comment.