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

Translations for Reporting plugin #22757

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
389e495
Translate Reporting
maryia-lapata Aug 30, 2018
5c6974f
Merge branch 'master' into feature/translations/reporting
maryia-lapata Sep 3, 2018
3fc0d30
Use i18n core
maryia-lapata Sep 4, 2018
730d0c4
Translate Reporting
maryia-lapata Sep 5, 2018
6e76e77
Merge branch 'master' into feature/translations/reporting
maryia-lapata Sep 6, 2018
b8b8fb0
Translate Reporting
maryia-lapata Sep 6, 2018
4f1652b
Refactoring
maryia-lapata Sep 6, 2018
aa52270
Add reporting to i18n config
maryia-lapata Sep 7, 2018
abf7349
Fix tooltip translation
maryia-lapata Sep 10, 2018
f6092ab
Merge branch 'master' into feature/translations/reporting
maryia-lapata Sep 11, 2018
3e98293
Apply formatting for html
maryia-lapata Sep 12, 2018
eb9b0a5
Merge remote-tracking branch 'remotes/origin/master' into feature/tra…
maryia-lapata Sep 13, 2018
8b01dfa
Translate label in TS files.
maryia-lapata Sep 13, 2018
7fb96b2
Merge branch 'master' into feature/translations/reporting
maryia-lapata Sep 20, 2018
9b052de
Reduce tag number
maryia-lapata Sep 21, 2018
41e728a
Rename ids
maryia-lapata Sep 21, 2018
2d00e85
Update snapshot
maryia-lapata Sep 21, 2018
0ac7fed
Revert changes for removing span
maryia-lapata Sep 28, 2018
6e11f48
Merge branch 'master' into feature/translations/reporting
maryia-lapata Sep 28, 2018
91ffb59
Merge branch 'master' into feature/translations/reporting
maryia-lapata Oct 2, 2018
75176e8
Merge branch 'master' into feature/translations/reporting
maryia-lapata Oct 3, 2018
7aa16a8
Add types
maryia-lapata Oct 5, 2018
086a230
Merge branch 'master' into feature/translations/reporting
maryia-lapata Oct 5, 2018
ae80880
Merge branch 'master' into feature/translations/reporting
maryia-lapata Oct 22, 2018
0f13af5
Translate statuses
maryia-lapata Oct 22, 2018
b529dda
Merge branch 'master' into feature/translations/reporting
maryia-lapata Oct 23, 2018
736972b
Merge branch 'master' into feature/translations/reporting
maryia-lapata Oct 24, 2018
4712291
update translation of Reporting plugin
tibmt Oct 25, 2018
3bb3ff0
Merge branch 'master' into feature/translations/reporting
tibmt Oct 26, 2018
9c5b975
fix variable name
pavel06081991 Oct 26, 2018
ae9f396
Merge branch 'master' into feature/translations/reporting
tibmt Oct 26, 2018
063d9ea
fix constants names
pavel06081991 Oct 26, 2018
8659300
update reporting translation
tibmt Oct 26, 2018
b5ff8dd
Merge branch 'feature/translations/reporting' of github.com:maryia-la…
pavel06081991 Oct 26, 2018
434f836
Merge remote-tracking branch 'maryia/feature/translations/reporting' …
pavel06081991 Oct 26, 2018
3e4fc04
fix copyright
pavel06081991 Oct 29, 2018
f0feceb
Merge remote-tracking branch 'upstream/master' into feature/translati…
LeanidShutau Oct 30, 2018
9e6d950
Fix types/angular packages incompatibility
LeanidShutau Oct 30, 2018
8eb3831
Merge remote-tracking branch 'upstream/master' into feature/translati…
LeanidShutau Nov 1, 2018
6d002d2
Merge branch 'master' into feature/translations/reporting
pavel06081991 Nov 2, 2018
d1e3ed9
Merge branch 'master' into feature/translations/reporting
maryia-lapata Nov 2, 2018
400f252
Merge branch 'master' into feature/translations/reporting
pavel06081991 Nov 6, 2018
456ac17
Merge remote-tracking branch 'upstream/master' into feature/translati…
LeanidShutau Nov 6, 2018
cec501e
Merge branch 'master' into feature/translations/reporting
maryia-lapata Nov 13, 2018
e83852e
Update yarn.lock
maryia-lapata Nov 13, 2018
525acfb
Merge branch 'master' into feature/translations/reporting
maryia-lapata Nov 16, 2018
d3a5150
Merge branch 'master' into feature/translations/reporting
maryia-lapata Nov 23, 2018
771fdd0
Fix duplicated import
maryia-lapata Nov 23, 2018
2079139
Merge branch 'master' into feature/translations/reporting
maryia-lapata Dec 3, 2018
a6f2cf4
Fix CI
maryia-lapata Dec 3, 2018
a725450
Small adjustments
maryia-lapata Dec 3, 2018
ba061e7
Merge branch 'master' into feature/translations/reporting
maryia-lapata Dec 3, 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
3 changes: 2 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"inputControl":"src/core_plugins/input_control_vis",
"kbn": "src/core_plugins/kibana",
"statusPage": "src/core_plugins/status_page",
"xpack.idxMgmt": "x-pack/plugins/index_management"
"xpack.idxMgmt": "x-pack/plugins/index_management",
"xpack.reporting": "x-pack/plugins/reporting"
},
"exclude": [
"src/ui/ui_render/bootstrap/app_bootstrap.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { oncePerServer } from '../../../server/lib/once_per_server';
import { createTaggedLogger } from '../../../server/lib/create_tagged_logger';
import { createGenerateCsv } from './lib/generate_csv';
import { fieldFormatMapFactory } from './lib/field_format_map';
import { i18n } from '@kbn/i18n';

function executeJobFn(server) {
const { callWithRequest } = server.plugins.elasticsearch.getCluster('data');
Expand All @@ -24,9 +25,10 @@ function executeJobFn(server) {
try {
decryptedHeaders = await crypto.decrypt(serializedEncryptedHeaders);
} catch (e) {
throw new Error(
'Failed to decrypt report job data. Please ensure that xpack.reporting.encryptionKey is set and re-generate this report.'
);
throw new Error(i18n.translate('xpack.reporting.exportTypes.csv.server.executeJob.failedToDecryptErrorMessage', {
// eslint-disable-next-line max-len
defaultMessage: 'Failed to decrypt report job data. Please ensure that xpack.reporting.encryptionKey is set and re-generate this report.'
}));
}

const fakeRequest = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';

async function parseResponse(request) {
const response = await request;
if (!response._scroll_id) {
throw new Error('Expected _scroll_id in the following Elasticsearch response: ' + JSON.stringify(response));
throw new Error(i18n.translate('xpack.reporting.exportTypes.csv.server.hitIterator.expectedScrollIdErrorMessage', {
defaultMessage: 'Expected _scroll_id in the following Elasticsearch response: {response}',
values: { response: JSON.stringify(response) }
}));
}

if (!response.hits) {
throw new Error('Expected hits in the following Elasticsearch response: ' + JSON.stringify(response));
throw new Error(i18n.translate('xpack.reporting.exportTypes.csv.server.hitIterator.expectedHitsErrorMessage', {
defaultMessage: 'Expected hits in the following Elasticsearch response: {response}',
values: { response: JSON.stringify(response) }
}));
}

return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="pdf-options">
<label>
<input type="radio" ng-model="options.layoutId" value="print">
Optimize PDF for printing
<span i18n-id="xpack.reporting.exportTypes.printablePdf.options.optimizeLabel" i18n-default-message="Optimize PDF for printing"></span>
</label>
<label data-test-subj="preserveLayoutOption">
<input type="radio" ng-model="options.layoutId" value="preserve_layout">
Preserve existing layout in PDF
<span i18n-id="xpack.reporting.exportTypes.printablePdf.options.preserveLayoutLabel" i18n-default-message="Preserve existing layout in PDF"></span>
</label>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import url from 'url';
import { getAbsoluteUrlFactory } from './get_absolute_url';
import { i18n } from '@kbn/i18n';

export function compatibilityShimFactory(server) {
const getAbsoluteUrl = getAbsoluteUrlFactory(server);
Expand All @@ -24,7 +25,10 @@ export function compatibilityShimFactory(server) {
return savedObj.url;
}

throw new Error(`Unable to generate report for url ${savedObj.url}, it's not a Kibana URL`);
throw new Error(i18n.translate('xpack.reporting.exportTypes.printablePdf.server.compShim.unableToGenerateErrorMessage', {
defaultMessage: 'Unable to generate report for url {savedObjUrl}, it\'s not a Kibana URL',
values: { savedObjUrl: savedObj.url }
}));
};

return function (executeJob) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { oncePerServer } from '../../../../server/lib/once_per_server';
import { generatePdfObservableFactory } from '../lib/generate_pdf';
import { cryptoFactory } from '../../../../server/lib/crypto';
import { compatibilityShimFactory } from './compatibility_shim';
import { i18n } from '@kbn/i18n';

const KBN_SCREENSHOT_HEADER_BLACKLIST = [
'accept-encoding',
Expand Down Expand Up @@ -85,7 +86,11 @@ function executeJobFn(server) {
return compatibilityShim(function executeJob(jobToExecute, cancellationToken) {
const process$ = Rx.of(jobToExecute).pipe(
mergeMap(decryptJobHeaders),
catchError(() => Rx.throwError('Failed to decrypt report job data. Please re-generate this report.')),
catchError(() => Rx.throwError(
i18n.translate('xpack.reporting.exportTypes.printablePdf.server.executeJob.failedToDecryptErrorMessage', {
defaultMessage: 'Failed to decrypt report job data. Please re-generate this report.'
}))
),
map(omitBlacklistedHeaders),
mergeMap(getCustomLogo),
mergeMap(addForceNowQuerystring),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import _ from 'lodash';
import concat from 'concat-stream';
import Printer from 'pdfmake';
import xRegExp from 'xregexp';
import { i18n } from '@kbn/i18n';

const assetPath = path.resolve(__dirname, 'assets');

Expand Down Expand Up @@ -131,7 +132,13 @@ class PdfMaker {
}

getBuffer() {
if (!this._pdfDoc) throw new Error('Document stream has not been generated');
if (!this._pdfDoc) {
throw new Error(
i18n.translate('xpack.reporting.exportTypes.printablePdf.server.lib.pdf.bufferErrorMessage', {
defaultMessage: 'Document stream has not been generated'
})
);
}
return new Promise((resolve, reject) => {
const concatStream = concat(function (pdfBuffer) {
resolve(pdfBuffer);
Expand All @@ -144,7 +151,13 @@ class PdfMaker {
}

getStream() {
if (!this._pdfDoc) throw new Error('Document stream has not been generated');
if (!this._pdfDoc) {
throw new Error(
i18n.translate('xpack.reporting.exportTypes.printablePdf.server.lib.pdf.streamErrorMessage', {
defaultMessage: 'Document stream has not been generated'
})
);
}
this._pdfDoc.end();
return this._pdfDoc;
}
Expand Down Expand Up @@ -203,14 +216,19 @@ function getTemplate(layout, logo, title) {
image: logo || logoPath,
}, {
alignment: 'center',
text: 'Page ' + currentPage.toString() + ' of ' + pageCount,
text: i18n.translate('xpack.reporting.exportTypes.printablePdf.server.lib.pdf.pagingDescription', {
defaultMessage: 'Page {currentString} of {pageCount}',
values: { currentString: currentPage.toString(), pageCount }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentString => currentPage

}),
style: {
color: '#aaa'
},
}, ''],
[
logo ? {
text: 'Powered by Elastic',
text: i18n.translate('xpack.reporting.exportTypes.printablePdf.server.lib.pdf.logoDescription', {
defaultMessage: 'Powered by Elastic'
}),
fontSize: 10,
style: {
color: "#aaa"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import fs from 'fs';
import getPort from 'get-port';
import { promisify } from 'bluebird';
import { LevelLogger } from '../../../../server/lib/level_logger';
import { i18n } from '@kbn/i18n';

const fsp = {
readFile: promisify(fs.readFile, fs)
Expand Down Expand Up @@ -61,7 +62,9 @@ export function screenshotsObservableFactory(server) {

const waitForNotFoundError = async (browser) => {
await browser.waitForSelector(`.toast.alert.alert-danger`);
throw new Error('Reporting subject could not be loaded to take a screenshot.');
throw new Error(i18n.translate('xpack.reporting.exportTypes.printablePdf.server.lib.screenshots.subjectCouldNotBeLoadedErrorMessage', {
defaultMessage: 'Reporting subject could not be loaded to take a screenshot.'
}));
};

const getNumberOfItems = async (browser, layout) => {
Expand Down
9 changes: 7 additions & 2 deletions x-pack/plugins/reporting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { createBrowserDriverFactory, getDefaultBrowser, getDefaultChromiumSandbo
import { logConfiguration } from './log_configuration';

import { getReportingUsageCollector } from './server/usage';
import { i18n } from '@kbn/i18n';

const kbToBase64Length = (kb) => {
return Math.floor((kb * 1024 * 8) / 6);
Expand Down Expand Up @@ -47,9 +48,13 @@ export const reporting = (kibana) => {
},
uiSettingDefaults: {
[UI_SETTINGS_CUSTOM_PDF_LOGO]: {
name: 'PDF footer image',
name: i18n.translate('xpack.reporting.pdfFooterImageLabel', {
defaultMessage: 'PDF footer image'
}),
value: null,
description: `Custom image to use in the PDF's footer`,
description: i18n.translate('xpack.reporting.pdfFooterImageDescription', {
defaultMessage: 'Custom image to use in the PDF\'s footer'
}),
type: 'image',
options: {
maxSize: {
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/reporting/public/controls/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { XPackInfoProvider } from 'plugins/xpack_main/services/xpack_info';
import { NavBarExtensionsRegistryProvider } from 'ui/registry/navbar_extensions';
import { DashboardConstants } from 'plugins/kibana/dashboard/dashboard_constants';

function dashboardReportProvider(Private, $location, dashboardConfig) {
function dashboardReportProvider(Private, $location, dashboardConfig, i18n) {
const xpackInfo = Private(XPackInfoProvider);
return {
appName: 'dashboard',
key: 'reporting-dashboard',
label: 'Reporting',
label: i18n('xpack.reporting.controls.dashboard.reportingTitle', { defaultMessage: 'Reporting' }),
template: `<export-config object-type="Dashboard" enabled-export-type="printablePdf"></export-config>`,
description: 'Dashboard Report',
description: i18n('xpack.reporting.controls.dashboard.reportAriaLabel', { defaultMessage: 'Dashboard Report' }),
hideButton: () => (
dashboardConfig.getHideWriteControls()
|| $location.path() === DashboardConstants.LANDING_PAGE_PATH
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/reporting/public/controls/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import 'plugins/reporting/directives/export_config';
import { XPackInfoProvider } from 'plugins/xpack_main/services/xpack_info';
import { NavBarExtensionsRegistryProvider } from 'ui/registry/navbar_extensions';

function discoverReportProvider(Private) {
function discoverReportProvider(Private, i18n) {
const xpackInfo = Private(XPackInfoProvider);
return {
appName: 'discover',

key: 'reporting-discover',
label: 'Reporting',
label: i18n('xpack.reporting.controls.discover.reportingTitle', { defaultMessage: 'Reporting' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reportingTitle => reportingLabel

template: '<export-config object-type="Search" enabled-export-type="csv"></export-config>',
description: 'Search Report',
description: i18n('xpack.reporting.controls.discover.searchReportAriaLabel', { defaultMessage: 'Search Report' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searchReportAriaLabel => reportingDescription

hideButton: () => !xpackInfo.get('features.reporting.csv.showLinks', false),
disableButton: () => !xpackInfo.get('features.reporting.csv.enableLinks', false),
tooltip: () => xpackInfo.get('features.reporting.csv.message'),
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/reporting/public/controls/visualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import { XPackInfoProvider } from 'plugins/xpack_main/services/xpack_info';
import { NavBarExtensionsRegistryProvider } from 'ui/registry/navbar_extensions';
import { VisualizeConstants } from 'plugins/kibana/visualize/visualize_constants';

function visualizeReportProvider(Private, $location) {
function visualizeReportProvider(Private, $location, i18n) {
const xpackInfo = Private(XPackInfoProvider);
return {
appName: 'visualize',

key: 'reporting-visualize',
label: 'Reporting',
label: i18n('xpack.reporting.controls.visualize.reportingTitle', { defaultMessage: 'Reporting' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reportingTitle => reportingLabel

template: `
<export-config
object-type="Visualization"
enabled-export-type="printablePdf"
options="{ layoutId: 'preserve_layout' }"
></export-config>`,
description: 'Visualization Report',
description: i18n('xpack.reporting.controls.visualize.reportAriaLabel', { defaultMessage: 'Visualization Report' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reportAriaLabel => reportingDescription

hideButton: () => (
$location.path() === VisualizeConstants.LANDING_PAGE_PATH
|| $location.path() === VisualizeConstants.WIZARD_STEP_1_PAGE_PATH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<div ng-show="!exportConfig.isDirty()">
<div class="kuiLocalDropdownSection">
<h2 class="kuiLocalDropdownTitle">
Reporting
</h2>
<h2 class="kuiLocalDropdownTitle" i18n-id="xpack.reporting.exportConfig.reportingTitle" i18n-default-message="Reporting"></h2>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's break this line up per attribute, for consistency


<div class="input-group generate-controls">
<div class="options"></div>
Expand All @@ -11,7 +9,9 @@ <h2 class="kuiLocalDropdownTitle">
data-test-subj="generateReportButton"
ng-click="exportConfig.export()"
>
Generate {{ exportConfig.exportType.name }}
<span i18n-id="xpack.reporting.exportConfig.generateButtonLabel"
i18n-default-message="Generate {name}"
i18n-values="{ name: exportConfig.exportType.name }"></span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting and indentation looks messed up here. Should be like:

        <span
          i18n-id="xpack.reporting.exportConfig.generateButtonLabel"
          i18n-default-message="Generate {name}"
          i18n-values="{ name: exportConfig.exportType.name }"
        >
        </span>

</button>
</div>
</div>
Expand All @@ -23,16 +23,18 @@ <h2 class="kuiLocalDropdownTitle">
<label
class="kuiLocalDropdownHeader__label"
for="reportGenerationUrl"
i18n-id="xpack.reporting.exportConfig.generationUrl.label"
i18n-default-message="Generation URL"
>
Generation URL
</label>
<div class="kuiLocalDropdownHeader__actions">
<a
class="kuiLocalDropdownHeader__action"
ng-click="exportConfig.copyToClipboard('#reportGenerationUrl')"
kbn-accessible-click
i18n-id="xpack.reporting.exportConfig.generationUrl.copyLinkLabel"
i18n-default-message="Copy"
>
Copy
</a>
</div>
</div>
Expand All @@ -44,12 +46,13 @@ <h2 class="kuiLocalDropdownTitle">
type="text"
readonly
data-test-subj="reportGenerationUrl"
value="{{ exportConfig.absoluteUrl || 'Loading...' }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not need "|| 'Loading...'" anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see you moved it to another place

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But anyway I'm not sure that this is a good idea to put 'loading...' to absoluteUrl property because 'loading...' is not url and if we want to use this property somewhere else we will expect it contains url, not 'loading...'.

value="{{ exportConfig.absoluteUrl }}"
ng-click="updateUrl()"
/>
</div>
</div>

<div ng-show="exportConfig.isDirty()" data-test-subj="unsavedChangesReportingWarning">
Please save your work before generating a report.
<div ng-show="exportConfig.isDirty()" data-test-subj="unsavedChangesReportingWarning"
i18n-id="xpack.reporting.exportConfig.saveWorkDescription"
i18n-default-message="Please save your work before generating a report.">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<div
  ng-show="exportConfig.isDirty()"
  data-test-subj="unsavedChangesReportingWarning"
  i18n-id="xpack.reporting.exportConfig.saveWorkDescription"
  i18n-default-message="Please save your work before generating a report."
>
</div>

</div>
Loading