Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i18n] Translate share #26802

Merged
merged 47 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c7ec189
Merge pull request #1 from elastic/master
Nox911 Sep 24, 2018
fa01b88
Merge pull request #2 from elastic/master
Nox911 Sep 27, 2018
70f6c7e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 27, 2018
68587a0
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 28, 2018
42aa7d3
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
efeaefe
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
8a054ed
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 8, 2018
b0d1660
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 16, 2018
62b6ad1
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 17, 2018
acbad4b
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 18, 2018
a850650
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 22, 2018
0a200ce
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 25, 2018
b2a8244
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 29, 2018
b4b979e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 30, 2018
d349a4f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 31, 2018
ae285b9
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 2, 2018
3051641
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 5, 2018
6231971
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 8, 2018
f86a3d4
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 9, 2018
cf813c7
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 13, 2018
1aba03f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 14, 2018
491009b
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 15, 2018
e243126
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 22, 2018
e74bd61
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 22, 2018
8bc5ffa
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 23, 2018
5787937
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 23, 2018
f17fa1e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 24, 2018
c63b0a6
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 26, 2018
ed62b5b
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 26, 2018
df4fab4
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 26, 2018
46d284a
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 27, 2018
d1fd49e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 29, 2018
ec1ad76
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 29, 2018
6ebd934
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 30, 2018
332d867
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 3, 2018
4a99411
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 3, 2018
4cdec42
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 4, 2018
5d44df7
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 4, 2018
c6e63aa
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 4, 2018
8182d1f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 4, 2018
aefb90f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 5, 2018
e4e7120
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 6, 2018
3317c82
Translate share
Dec 7, 2018
a9a6043
Merge branch 'master' of https://github.com/elastic/kibana
Dec 7, 2018
9d247e6
Merge branch 'master' of https://github.com/elastic/kibana
Dec 10, 2018
bd707af
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 11, 2018
18ebcb3
Merge branch 'master' into feature/translate-share
Nox911 Dec 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`should only render permalink panel when there are no other panels 1`] =
panels={
Array [
Object {
"content": <UrlPanelContent
"content": <InjectIntl(UrlPanelContentUI)
getUnhashableStates={[Function]}
objectType="dashboard"
/>,
Expand All @@ -26,15 +26,15 @@ exports[`should render context menu panel when there are more than one panel 1`]
panels={
Array [
Object {
"content": <UrlPanelContent
"content": <InjectIntl(UrlPanelContentUI)
getUnhashableStates={[Function]}
objectType="dashboard"
/>,
"id": 1,
"title": "Permalink",
},
Object {
"content": <UrlPanelContent
"content": <InjectIntl(UrlPanelContentUI)
getUnhashableStates={[Function]}
isEmbedded={true}
objectType="dashboard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@ exports[`render 1`] = `
describedByIds={Array []}
fullWidth={false}
hasEmptyLabelSpace={false}
helpText="Can't share as saved object until the dashboard has been saved."
label="Generate the link as"
helpText={
<FormattedMessage
defaultMessage="Can't share as saved object until the {objectType} has been saved."
id="common.ui.share.urlPanel.canNotShareAsSavedObjectHelpText"
values={
Object {
"objectType": "dashboard",
}
}
/>
}
label={
<FormattedMessage
defaultMessage="Generate the link as"
id="common.ui.share.urlPanel.generateLinkAsLabel"
values={Object {}}
/>
}
>
<EuiRadioGroup
idSelected="snapshot"
Expand All @@ -33,16 +49,30 @@ exports[`render 1`] = `
component="div"
grow={true}
>
Snapshot
<FormattedMessage
defaultMessage="Snapshot"
id="common.ui.share.urlPanel.snapshotLabel"
values={Object {}}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={false}
>
<EuiIconTip
aria-label="Info"
content="Snapshot URLs encode the current state of the dashboard in the URL itself.
Edits to the saved dashboard won't be visible via this URL."
content={
<FormattedMessage
defaultMessage="Snapshot URLs encode the current state of the {objectType} in the URL itself.
Edits to the saved {objectType} won't be visible via this URL."
id="common.ui.share.urlPanel.snapshotDescription"
values={
Object {
"objectType": "dashboard",
}
}
/>
}
position="bottom"
type="questionInCircle"
/>
Expand All @@ -66,15 +96,29 @@ exports[`render 1`] = `
component="div"
grow={true}
>
Saved object
<FormattedMessage
defaultMessage="Saved object"
id="common.ui.share.urlPanel.savedObjectLabel"
values={Object {}}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={false}
>
<EuiIconTip
aria-label="Info"
content="You can share this URL with people to let them load the most recent saved version of this dashboard."
content={
<FormattedMessage
defaultMessage="You can share this URL with people to let them load the most recent saved version of this {objectType}."
id="common.ui.share.urlPanel.savedObjectDescription"
values={
Object {
"objectType": "dashboard",
}
}
/>
}
position="bottom"
type="questionInCircle"
/>
Expand Down Expand Up @@ -106,7 +150,13 @@ exports[`render 1`] = `
<EuiSwitch
checked={false}
data-test-subj="useShortUrl"
label="Short URL"
label={
<FormattedMessage
defaultMessage="Short URL"
id="common.ui.share.urlPanel.shortUrlLabel"
values={Object {}}
/>
}
onChange={[Function]}
/>
</EuiFlexItem>
Expand All @@ -116,10 +166,16 @@ exports[`render 1`] = `
>
<EuiIconTip
aria-label="Info"
content="We recommend sharing shortened snapshot URLs for maximum compatibility.
Internet Explorer has URL length restrictions,
and some wiki and markup parsers don't do well with the full-length version of the snapshot URL,
but the short URL should work great."
content={
<FormattedMessage
defaultMessage="We recommend sharing shortened snapshot URLs for maximum compatibility.
Internet Explorer has URL length restrictions,
and some wiki and markup parsers don't do well with the full-length version of the snapshot URL,
but the short URL should work great."
id="common.ui.share.urlPanel.shortUrlHelpText"
values={Object {}}
/>
}
position="bottom"
type="questionInCircle"
/>
Expand All @@ -143,7 +199,13 @@ exports[`should enable saved object export option when objectId is provided 1`]
describedByIds={Array []}
fullWidth={false}
hasEmptyLabelSpace={false}
label="Generate the link as"
label={
<FormattedMessage
defaultMessage="Generate the link as"
id="common.ui.share.urlPanel.generateLinkAsLabel"
values={Object {}}
/>
}
>
<EuiRadioGroup
idSelected="snapshot"
Expand All @@ -166,16 +228,30 @@ exports[`should enable saved object export option when objectId is provided 1`]
component="div"
grow={true}
>
Snapshot
<FormattedMessage
defaultMessage="Snapshot"
id="common.ui.share.urlPanel.snapshotLabel"
values={Object {}}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={false}
>
<EuiIconTip
aria-label="Info"
content="Snapshot URLs encode the current state of the dashboard in the URL itself.
Edits to the saved dashboard won't be visible via this URL."
content={
<FormattedMessage
defaultMessage="Snapshot URLs encode the current state of the {objectType} in the URL itself.
Edits to the saved {objectType} won't be visible via this URL."
id="common.ui.share.urlPanel.snapshotDescription"
values={
Object {
"objectType": "dashboard",
}
}
/>
}
position="bottom"
type="questionInCircle"
/>
Expand All @@ -199,15 +275,29 @@ exports[`should enable saved object export option when objectId is provided 1`]
component="div"
grow={true}
>
Saved object
<FormattedMessage
defaultMessage="Saved object"
id="common.ui.share.urlPanel.savedObjectLabel"
values={Object {}}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={false}
>
<EuiIconTip
aria-label="Info"
content="You can share this URL with people to let them load the most recent saved version of this dashboard."
content={
<FormattedMessage
defaultMessage="You can share this URL with people to let them load the most recent saved version of this {objectType}."
id="common.ui.share.urlPanel.savedObjectDescription"
values={
Object {
"objectType": "dashboard",
}
}
/>
}
position="bottom"
type="questionInCircle"
/>
Expand Down Expand Up @@ -239,7 +329,13 @@ exports[`should enable saved object export option when objectId is provided 1`]
<EuiSwitch
checked={false}
data-test-subj="useShortUrl"
label="Short URL"
label={
<FormattedMessage
defaultMessage="Short URL"
id="common.ui.share.urlPanel.shortUrlLabel"
values={Object {}}
/>
}
onChange={[Function]}
/>
</EuiFlexItem>
Expand All @@ -249,10 +345,16 @@ exports[`should enable saved object export option when objectId is provided 1`]
>
<EuiIconTip
aria-label="Info"
content="We recommend sharing shortened snapshot URLs for maximum compatibility.
Internet Explorer has URL length restrictions,
and some wiki and markup parsers don't do well with the full-length version of the snapshot URL,
but the short URL should work great."
content={
<FormattedMessage
defaultMessage="We recommend sharing shortened snapshot URLs for maximum compatibility.
Internet Explorer has URL length restrictions,
and some wiki and markup parsers don't do well with the full-length version of the snapshot URL,
but the short URL should work great."
id="common.ui.share.urlPanel.shortUrlHelpText"
values={Object {}}
/>
}
position="bottom"
type="questionInCircle"
/>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/public/share/components/share_context_menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
jest.mock('../lib/url_shortener', () => ({}));

import React from 'react';
import { shallow } from 'enzyme';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';

import {
ShareContextMenu,
} from './share_context_menu';

test('should render context menu panel when there are more than one panel', () => {
const component = shallow(<ShareContextMenu
const component = shallowWithIntl(<ShareContextMenu.WrappedComponent
allowEmbed
objectType="dashboard"
getUnhashableStates={() => {}}
Expand All @@ -36,7 +36,7 @@ test('should render context menu panel when there are more than one panel', () =
});

test('should only render permalink panel when there are no other panels', () => {
const component = shallow(<ShareContextMenu
const component = shallowWithIntl(<ShareContextMenu.WrappedComponent
allowEmbed={false}
objectType="dashboard"
getUnhashableStates={() => {}}
Expand Down
37 changes: 31 additions & 6 deletions src/ui/public/share/components/share_context_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import './share_panel_content.less';
import { EuiContextMenuPanelDescriptor } from '@elastic/eui';
import { EuiContextMenu } from '@elastic/eui';

import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
import { ShareAction, ShareActionProvider, ShareContextMenuPanelItem } from 'ui/share/share_action';
import { UrlPanelContent } from './url_panel_content';

Expand All @@ -35,9 +36,10 @@ interface Props {
sharingData: any;
isDirty: boolean;
onClose: () => void;
intl: InjectedIntl;
}

export class ShareContextMenu extends Component<Props> {
class ShareContextMenuUI extends Component<Props> {
public render() {
const { panels, initialPanelId } = this.getPanels();
return (
Expand All @@ -52,10 +54,14 @@ export class ShareContextMenu extends Component<Props> {
private getPanels = () => {
const panels: EuiContextMenuPanelDescriptor[] = [];
const menuItems: ShareContextMenuPanelItem[] = [];
const { intl } = this.props;

const permalinkPanel = {
id: panels.length + 1,
title: 'Permalink',
title: intl.formatMessage({
id: 'common.ui.share.contextMenu.permalinkPanelTitle',
defaultMessage: 'Permalink',
}),
content: (
<UrlPanelContent
objectId={this.props.objectId}
Expand All @@ -65,7 +71,10 @@ export class ShareContextMenu extends Component<Props> {
),
};
menuItems.push({
name: 'Permalinks',
name: intl.formatMessage({
id: 'common.ui.share.contextMenu.permalinksLabel',
defaultMessage: 'Permalinks',
}),
icon: 'link',
panel: permalinkPanel.id,
sortOrder: 0,
Expand All @@ -75,7 +84,10 @@ export class ShareContextMenu extends Component<Props> {
if (this.props.allowEmbed) {
const embedPanel = {
id: panels.length + 1,
title: 'Embed Code',
title: intl.formatMessage({
id: 'common.ui.share.contextMenu.embedCodePanelTitle',
defaultMessage: 'Embed Code',
}),
content: (
<UrlPanelContent
isEmbedded
Expand All @@ -87,7 +99,10 @@ export class ShareContextMenu extends Component<Props> {
};
panels.push(embedPanel);
menuItems.push({
name: 'Embed code',
name: intl.formatMessage({
id: 'common.ui.share.contextMenu.embedCodeLabel',
defaultMessage: 'Embed code',
}),
icon: 'console',
panel: embedPanel.id,
sortOrder: 0,
Expand Down Expand Up @@ -130,7 +145,15 @@ export class ShareContextMenu extends Component<Props> {
if (menuItems.length > 1) {
const topLevelMenuPanel = {
id: panels.length + 1,
title: `Share this ${this.props.objectType}`,
title: intl.formatMessage(
{
id: 'common.ui.share.contextMenuTitle',
defaultMessage: 'Share this {objectType}',
},
{
objectType: this.props.objectType,
}
),
items: menuItems
.map(menuItem => {
menuItem['data-test-subj'] = `sharePanel-${menuItem.name.replace(' ', '')}`;
Expand Down Expand Up @@ -161,3 +184,5 @@ export class ShareContextMenu extends Component<Props> {
return { panels, initialPanelId };
};
}

export const ShareContextMenu = injectI18n(ShareContextMenuUI);
Loading