diff --git a/.i18nrc.json b/.i18nrc.json index aa6d953a257c11..f7152c485ca581 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -10,6 +10,7 @@ "interpreter": "src/legacy/core_plugins/interpreter", "kbn": "src/legacy/core_plugins/kibana", "kbnDocViews": "src/legacy/core_plugins/kbn_doc_views", + "embeddableApi": "src/legacy/core_plugins/embeddable_api", "kbnVislibVisTypes": "src/legacy/core_plugins/kbn_vislib_vis_types", "markdownVis": "src/legacy/core_plugins/markdown_vis", "metricVis": "src/legacy/core_plugins/metric_vis", @@ -25,6 +26,7 @@ "xpack.apm": "x-pack/plugins/apm", "xpack.beatsManagement": "x-pack/plugins/beats_management", "xpack.canvas": "x-pack/plugins/canvas", + "xpack.code": "x-pack/plugins/code", "xpack.crossClusterReplication": "x-pack/plugins/cross_cluster_replication", "xpack.dashboardMode": "x-pack/plugins/dashboard_mode", "xpack.graph": "x-pack/plugins/graph", diff --git a/src/dev/i18n/extract_default_translations.js b/src/dev/i18n/extract_default_translations.js index 9a992d7406ef47..a449d19bc6e873 100644 --- a/src/dev/i18n/extract_default_translations.js +++ b/src/dev/i18n/extract_default_translations.js @@ -62,11 +62,20 @@ See .i18nrc.json for the list of supported namespaces.`) } } -export async function extractMessagesFromPathToMap(inputPath, targetMap, config, reporter) { +export async function matchEntriesWithExctractors(inputPath, options = {}) { + const { + additionalIgnore = [], + mark = false, + absolute = false, + } = options; + const ignore = ['**/node_modules/**', '**/__tests__/**', '**/*.test.{js,jsx,ts,tsx}', '**/*.d.ts'].concat(additionalIgnore); + const entries = await globAsync('*.{js,jsx,pug,ts,tsx,html}', { cwd: inputPath, matchBase: true, - ignore: ['**/node_modules/**', '**/__tests__/**', '**/*.test.{js,jsx,ts,tsx}', '**/*.d.ts'], + ignore, + mark, + absolute, }); const { htmlEntries, codeEntries, pugEntries } = entries.reduce( @@ -86,37 +95,43 @@ export async function extractMessagesFromPathToMap(inputPath, targetMap, config, { htmlEntries: [], codeEntries: [], pugEntries: [] } ); - await Promise.all( - [ - [htmlEntries, extractHtmlMessages], - [codeEntries, extractCodeMessages], - [pugEntries, extractPugMessages], - ].map(async ([entries, extractFunction]) => { - const files = await Promise.all( - filterEntries(entries, config.exclude).map(async entry => { - return { - name: entry, - content: await readFileAsync(entry), - }; - }) - ); - - for (const { name, content } of files) { - const reporterWithContext = reporter.withContext({ name }); - - try { - for (const [id, value] of extractFunction(content, reporterWithContext)) { - validateMessageNamespace(id, name, config.paths, reporterWithContext); - addMessageToMap(targetMap, id, value, reporterWithContext); - } - } catch (error) { - if (!isFailError(error)) { - throw error; - } + return [ + [htmlEntries, extractHtmlMessages], + [codeEntries, extractCodeMessages], + [pugEntries, extractPugMessages], + ]; +} - reporterWithContext.report(error); +export async function extractMessagesFromPathToMap(inputPath, targetMap, config, reporter) { + const categorizedEntries = await matchEntriesWithExctractors(inputPath); + return Promise.all( + categorizedEntries + .map(async ([entries, extractFunction]) => { + const files = await Promise.all( + filterEntries(entries, config.exclude).map(async entry => { + return { + name: entry, + content: await readFileAsync(entry), + }; + }) + ); + + for (const { name, content } of files) { + const reporterWithContext = reporter.withContext({ name }); + + try { + for (const [id, value] of extractFunction(content, reporterWithContext)) { + validateMessageNamespace(id, name, config.paths, reporterWithContext); + addMessageToMap(targetMap, id, value, reporterWithContext); + } + } catch (error) { + if (!isFailError(error)) { + throw error; + } + + reporterWithContext.report(error); + } } - } - }) + }) ); } diff --git a/src/dev/i18n/index.ts b/src/dev/i18n/index.ts index 604d7bab72c926..8f3e5955097399 100644 --- a/src/dev/i18n/index.ts +++ b/src/dev/i18n/index.ts @@ -20,6 +20,8 @@ // @ts-ignore export { extractMessagesFromPathToMap } from './extract_default_translations'; // @ts-ignore +export { matchEntriesWithExctractors } from './extract_default_translations'; +// @ts-ignore export { writeFileAsync, readFileAsync, normalizePath, ErrorReporter } from './utils'; export { serializeToJson, serializeToJson5 } from './serializers'; export { I18nConfig, filterConfigPaths, mergeConfigs } from './config'; diff --git a/src/dev/i18n/integrate_locale_files.ts b/src/dev/i18n/integrate_locale_files.ts index b090eedce443d0..7ed5e788be2985 100644 --- a/src/dev/i18n/integrate_locale_files.ts +++ b/src/dev/i18n/integrate_locale_files.ts @@ -37,7 +37,7 @@ import { createFailError } from '../run'; import { I18nConfig } from './config'; import { serializeToJson } from './serializers'; -interface IntegrateOptions { +export interface IntegrateOptions { sourceFileName: string; targetFileName?: string; dryRun: boolean; diff --git a/src/dev/i18n/tasks/check_compatibility.ts b/src/dev/i18n/tasks/check_compatibility.ts new file mode 100644 index 00000000000000..3c5f8c23466a47 --- /dev/null +++ b/src/dev/i18n/tasks/check_compatibility.ts @@ -0,0 +1,48 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ToolingLog } from '@kbn/dev-utils'; +import { integrateLocaleFiles, I18nConfig } from '..'; + +export interface I18nFlags { + fix: boolean; + ignoreIncompatible: boolean; + ignoreUnused: boolean; + ignoreMissing: boolean; +} + +export function checkCompatibility(config: I18nConfig, flags: I18nFlags, log: ToolingLog) { + const { fix, ignoreIncompatible, ignoreUnused, ignoreMissing } = flags; + return config.translations.map(translationsPath => ({ + task: async ({ messages }: { messages: Map }) => { + // If `fix` is set we should try apply all possible fixes and override translations file. + await integrateLocaleFiles(messages, { + dryRun: !fix, + ignoreIncompatible: fix || ignoreIncompatible, + ignoreUnused: fix || ignoreUnused, + ignoreMissing: fix || ignoreMissing, + sourceFileName: translationsPath, + targetFileName: fix ? translationsPath : undefined, + config, + log, + }); + }, + title: `Compatibility check with ${translationsPath}`, + })); +} diff --git a/src/dev/i18n/tasks/extract_default_translations.ts b/src/dev/i18n/tasks/extract_default_translations.ts index 02e45350e249a9..92bf9663e975ed 100644 --- a/src/dev/i18n/tasks/extract_default_translations.ts +++ b/src/dev/i18n/tasks/extract_default_translations.ts @@ -18,19 +18,18 @@ */ import chalk from 'chalk'; -import Listr from 'listr'; - import { ErrorReporter, extractMessagesFromPathToMap, filterConfigPaths, I18nConfig } from '..'; import { createFailError } from '../../run'; -export async function extractDefaultMessages({ +export function extractDefaultMessages({ path, config, }: { path?: string | string[]; config: I18nConfig; }) { - const filteredPaths = filterConfigPaths(Array.isArray(path) ? path : [path || './'], config); + const inputPaths = Array.isArray(path) ? path : [path || './']; + const filteredPaths = filterConfigPaths(inputPaths, config) as string[]; if (filteredPaths.length === 0) { throw createFailError( `${chalk.white.bgRed( @@ -39,36 +38,22 @@ export async function extractDefaultMessages({ ); } - const reporter = new ErrorReporter(); - - const list = new Listr( - filteredPaths.map(filteredPath => ({ - task: async (messages: Map) => { - const initialErrorsNumber = reporter.errors.length; - - // Return result if no new errors were reported for this path. - const result = await extractMessagesFromPathToMap(filteredPath, messages, config, reporter); - if (reporter.errors.length === initialErrorsNumber) { - return result; - } - - // Throw an empty error to make Listr mark the task as failed without any message. - throw new Error(''); - }, - title: filteredPath, - })), - { - exitOnError: false, - } - ); - - try { - return await list.run(new Map()); - } catch (error) { - if (error.name === 'ListrError' && reporter.errors.length) { - throw createFailError(reporter.errors.join('\n\n')); - } - - throw error; - } + return filteredPaths.map(filteredPath => ({ + task: async (context: { + messages: Map; + reporter: ErrorReporter; + }) => { + const { messages, reporter } = context; + const initialErrorsNumber = reporter.errors.length; + + // Return result if no new errors were reported for this path. + const result = await extractMessagesFromPathToMap(filteredPath, messages, config, reporter); + if (reporter.errors.length === initialErrorsNumber) { + return result; + } + + throw reporter; + }, + title: filteredPath, + })); } diff --git a/src/dev/i18n/tasks/extract_untracked_translations.ts b/src/dev/i18n/tasks/extract_untracked_translations.ts new file mode 100644 index 00000000000000..cf83f02b76d82d --- /dev/null +++ b/src/dev/i18n/tasks/extract_untracked_translations.ts @@ -0,0 +1,109 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + I18nConfig, + matchEntriesWithExctractors, + normalizePath, + readFileAsync, + ErrorReporter, +} from '..'; +import { createFailError } from '../../run'; + +function filterEntries(entries: string[], exclude: string[]) { + return entries.filter((entry: string) => + exclude.every((excludedPath: string) => !normalizePath(entry).startsWith(excludedPath)) + ); +} + +export async function extractUntrackedMessagesTask({ + path, + config, + reporter, +}: { + path?: string | string[]; + config: I18nConfig; + reporter: any; +}) { + const inputPaths = Array.isArray(path) ? path : [path || './']; + const availablePaths = Object.values(config.paths); + const ignore = availablePaths.concat([ + '**/build/**', + '**/webpackShims/**', + '**/__fixtures__/**', + '**/packages/kbn-i18n/**', + '**/packages/kbn-plugin-generator/sao_template/**', + '**/packages/kbn-ui-framework/generator-kui/**', + '**/target/**', + '**/test/**', + '**/scripts/**', + '**/src/dev/**', + '**/target/**', + '**/dist/**', + ]); + for (const inputPath of inputPaths) { + const categorizedEntries = await matchEntriesWithExctractors(inputPath, { + additionalIgnore: ignore, + mark: true, + absolute: true, + }); + + for (const [entries, extractFunction] of categorizedEntries) { + const files = await Promise.all( + filterEntries(entries, config.exclude) + .filter(entry => { + const normalizedEntry = normalizePath(entry); + return !availablePaths.some( + availablePath => + normalizedEntry.startsWith(`${normalizePath(availablePath)}/`) || + normalizePath(availablePath) === normalizedEntry + ); + }) + .map(async (entry: any) => ({ + name: entry, + content: await readFileAsync(entry), + })) + ); + + for (const { name, content } of files) { + const reporterWithContext = reporter.withContext({ name }); + for (const [id] of extractFunction(content, reporterWithContext)) { + const errorMessage = `Untracked file contains i18n label (${id}).`; + reporterWithContext.report(createFailError(errorMessage)); + } + } + } + } +} + +export function extractUntrackedMessages(srcPaths: string[], config: I18nConfig) { + return srcPaths.map(srcPath => ({ + title: `Checking untracked messages in ${srcPath}`, + task: async (context: { reporter: ErrorReporter }) => { + const { reporter } = context; + const initialErrorsNumber = reporter.errors.length; + const result = await extractUntrackedMessagesTask({ path: srcPath, config, reporter }); + if (reporter.errors.length === initialErrorsNumber) { + return result; + } + + throw reporter; + }, + })); +} diff --git a/src/dev/i18n/tasks/index.ts b/src/dev/i18n/tasks/index.ts index 00b3466d59276f..bd33baa989e0fd 100644 --- a/src/dev/i18n/tasks/index.ts +++ b/src/dev/i18n/tasks/index.ts @@ -18,3 +18,5 @@ */ export { extractDefaultMessages } from './extract_default_translations'; +export { extractUntrackedMessages } from './extract_untracked_translations'; +export { checkCompatibility } from './check_compatibility'; diff --git a/src/dev/run_i18n_check.ts b/src/dev/run_i18n_check.ts index cb8fc0ca7902b7..aad5da08df4add 100644 --- a/src/dev/run_i18n_check.ts +++ b/src/dev/run_i18n_check.ts @@ -20,8 +20,8 @@ import chalk from 'chalk'; import Listr from 'listr'; -import { integrateLocaleFiles, mergeConfigs } from './i18n'; -import { extractDefaultMessages } from './i18n/tasks'; +import { ErrorReporter, mergeConfigs } from './i18n'; +import { extractDefaultMessages, extractUntrackedMessages, checkCompatibility } from './i18n/tasks'; import { createFailError, run } from './run'; run( @@ -60,48 +60,58 @@ run( } const config = await mergeConfigs(includeConfig); - const defaultMessages = await extractDefaultMessages({ path, config }); + const srcPaths = Array().concat(path || ['./src', './packages', './x-pack']); if (config.translations.length === 0) { return; } const list = new Listr( - config.translations.map(translationsPath => ({ - task: async () => { - // If `--fix` is set we should try apply all possible fixes and override translations file. - await integrateLocaleFiles(defaultMessages, { - sourceFileName: translationsPath, - targetFileName: fix ? translationsPath : undefined, - dryRun: !fix, - ignoreIncompatible: fix || !!ignoreIncompatible, - ignoreUnused: fix || !!ignoreUnused, - ignoreMissing: fix || !!ignoreMissing, - config, - log, - }); + [ + { + title: 'Checking For Untracked Messages', + task: () => new Listr(extractUntrackedMessages(srcPaths, config), { exitOnError: true }), }, - title: `Compatibility check with ${translationsPath}`, - })), + { + title: 'Validating Default Messages', + task: () => + new Listr(extractDefaultMessages({ path: srcPaths, config }), { exitOnError: true }), + }, + { + title: 'Compatibility Checks', + task: () => + new Listr( + checkCompatibility( + config, + { + ignoreIncompatible: !!ignoreIncompatible, + ignoreUnused: !!ignoreUnused, + ignoreMissing: !!ignoreMissing, + fix, + }, + log + ), + { exitOnError: true } + ), + }, + ], { - concurrent: true, - exitOnError: false, + concurrent: false, + exitOnError: true, } ); try { - await list.run(); + const reporter = new ErrorReporter(); + const messages: Map = new Map(); + await list.run({ messages, reporter }); } catch (error) { process.exitCode = 1; - - if (!error.errors) { + if (error instanceof ErrorReporter) { + error.errors.forEach((e: string | Error) => log.error(e)); + } else { log.error('Unhandled exception!'); log.error(error); - process.exit(); - } - - for (const e of error.errors) { - log.error(e); } } }, diff --git a/src/dev/run_i18n_extract.ts b/src/dev/run_i18n_extract.ts index 6670e81949609a..63f7429ec420ef 100644 --- a/src/dev/run_i18n_extract.ts +++ b/src/dev/run_i18n_extract.ts @@ -18,9 +18,16 @@ */ import chalk from 'chalk'; +import Listr from 'listr'; import { resolve } from 'path'; -import { mergeConfigs, serializeToJson, serializeToJson5, writeFileAsync } from './i18n'; +import { + ErrorReporter, + mergeConfigs, + serializeToJson, + serializeToJson5, + writeFileAsync, +} from './i18n'; import { extractDefaultMessages } from './i18n/tasks'; import { createFailError, run } from './run'; @@ -32,6 +39,7 @@ run( 'output-format': outputFormat, 'include-config': includeConfig, }, + log, }) => { if (!outputDir || typeof outputDir !== 'string') { throw createFailError( @@ -46,18 +54,42 @@ run( } const config = await mergeConfigs(includeConfig); - const defaultMessages = await extractDefaultMessages({ path, config }); - // Messages shouldn't be written to a file if output is not supplied. - if (!outputDir || !defaultMessages.size) { - return; - } + const list = new Listr([ + { + title: 'Extracting Default Messages', + task: () => new Listr(extractDefaultMessages({ path, config }), { exitOnError: true }), + }, + { + title: 'Writing to file', + enabled: ctx => outputDir && ctx.messages.size, + task: async ctx => { + const sortedMessages = [...ctx.messages].sort(([key1], [key2]) => + key1.localeCompare(key2) + ); + await writeFileAsync( + resolve(outputDir, 'en.json'), + outputFormat === 'json5' + ? serializeToJson5(sortedMessages) + : serializeToJson(sortedMessages) + ); + }, + }, + ]); - const sortedMessages = [...defaultMessages].sort(([key1], [key2]) => key1.localeCompare(key2)); - await writeFileAsync( - resolve(outputDir, 'en.json'), - outputFormat === 'json5' ? serializeToJson5(sortedMessages) : serializeToJson(sortedMessages) - ); + try { + const reporter = new ErrorReporter(); + const messages: Map = new Map(); + await list.run({ messages, reporter }); + } catch (error) { + process.exitCode = 1; + if (error instanceof ErrorReporter) { + error.errors.forEach((e: string | Error) => log.error(e)); + } else { + log.error('Unhandled exception!'); + log.error(error); + } + } }, { flags: { diff --git a/src/dev/run_i18n_integrate.ts b/src/dev/run_i18n_integrate.ts index e5cf21fb88ba3c..b80dd8deac274a 100644 --- a/src/dev/run_i18n_integrate.ts +++ b/src/dev/run_i18n_integrate.ts @@ -18,8 +18,9 @@ */ import chalk from 'chalk'; +import Listr from 'listr'; -import { integrateLocaleFiles, mergeConfigs } from './i18n'; +import { ErrorReporter, integrateLocaleFiles, mergeConfigs } from './i18n'; import { extractDefaultMessages } from './i18n/tasks'; import { createFailError, run } from './run'; @@ -75,18 +76,41 @@ run( } const config = await mergeConfigs(includeConfig); - const defaultMessages = await extractDefaultMessages({ path, config }); + const list = new Listr([ + { + title: 'Extracting Default Messages', + task: () => new Listr(extractDefaultMessages({ path, config }), { exitOnError: true }), + }, + { + title: 'Intregrating Locale File', + task: async ({ messages }) => { + await integrateLocaleFiles(messages, { + sourceFileName: source, + targetFileName: target, + dryRun, + ignoreIncompatible, + ignoreUnused, + ignoreMissing, + config, + log, + }); + }, + }, + ]); - await integrateLocaleFiles(defaultMessages, { - sourceFileName: source, - targetFileName: target, - dryRun, - ignoreIncompatible, - ignoreUnused, - ignoreMissing, - config, - log, - }); + try { + const reporter = new ErrorReporter(); + const messages: Map = new Map(); + await list.run({ messages, reporter }); + } catch (error) { + process.exitCode = 1; + if (error instanceof ErrorReporter) { + error.errors.forEach((e: string | Error) => log.error(e)); + } else { + log.error('Unhandled exception!'); + log.error(error); + } + } }, { flags: { diff --git a/src/legacy/core_plugins/embeddable_api/public/context_menu_actions/build_eui_context_menu_panels.ts b/src/legacy/core_plugins/embeddable_api/public/context_menu_actions/build_eui_context_menu_panels.ts index 5187b929373dec..a22d22615cf95a 100644 --- a/src/legacy/core_plugins/embeddable_api/public/context_menu_actions/build_eui_context_menu_panels.ts +++ b/src/legacy/core_plugins/embeddable_api/public/context_menu_actions/build_eui_context_menu_panels.ts @@ -42,7 +42,7 @@ export async function buildContextMenuForActions({ return { id: 'mainMenu', - title: i18n.translate('embeddableAPI.actionPanel.title', { + title: i18n.translate('embeddableApi.actionPanel.title', { defaultMessage: 'Options', }), items: menuItems, diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_action.tsx index 859194cc6f673a..5f0571f3d140c9 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_action.tsx @@ -35,7 +35,7 @@ export class AddPanelAction extends Action { } public getDisplayName() { - return i18n.translate('kbn.embeddable.panel.addPanel.displayName', { + return i18n.translate('embeddableApi.addPanel.displayName', { defaultMessage: 'Add panel', }); } diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx index 6477378aa2bc51..48e127fb063e82 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx @@ -63,7 +63,7 @@ export class AddPanelFlyout extends React.Component { this.lastToast = toastNotifications.addSuccess({ title: i18n.translate( - 'kbn.embeddables.addPanel.savedObjectAddedToContainerSuccessMessageTitle', + 'embeddableApi.addPanel.savedObjectAddedToContainerSuccessMessageTitle', { defaultMessage: '{savedObjectName} was added', values: { @@ -103,7 +103,7 @@ export class AddPanelFlyout extends React.Component { inputDisplay: ( @@ -119,7 +119,7 @@ export class AddPanelFlyout extends React.Component { inputDisplay: ( {

- +

@@ -159,7 +159,7 @@ export class AddPanelFlyout extends React.Component { > } showFilter={true} - noItemsMessage={i18n.translate('kbn.embeddables.addPanel.noMatchingObjectsMessage', { + noItemsMessage={i18n.translate('embeddableApi.addPanel.noMatchingObjectsMessage', { defaultMessage: 'No matching objects found.', })} /> diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_action.tsx index 8673ab8b6f14b2..d208b941ee57c0 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_action.tsx @@ -40,7 +40,7 @@ export class CustomizePanelTitleAction extends Action { } public getDisplayName() { - return i18n.translate('kbn.embeddables.panel.customizePanel.displayName', { + return i18n.translate('embeddableApi.customizePanel.action.displayName', { defaultMessage: 'Customize panel', }); } diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx index 91de837fabc180..8bbc7b2f2c6e5f 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx @@ -97,7 +97,7 @@ export class CustomizePanelModalUi extends Component label={ } onChange={this.onHideTitleToggle} @@ -105,7 +105,7 @@ export class CustomizePanelModalUi extends Component @@ -119,7 +119,7 @@ export class CustomizePanelModalUi extends Component value={this.state.title || ''} onChange={e => this.updateTitle(e.target.value)} aria-label={this.props.intl.formatMessage({ - id: 'kbn.embeddable.panel.optionsMenuForm.panelTitleInputAriaLabel', + id: 'embeddableApi.customizePanel.modal.optionsMenuForm.panelTitleInputAriaLabel', defaultMessage: 'Enter a custom title for your panel', })} append={ @@ -129,7 +129,7 @@ export class CustomizePanelModalUi extends Component disabled={this.state.hideTitle} > @@ -142,11 +142,17 @@ export class CustomizePanelModalUi extends Component onClick={() => this.props.updateTitle(this.props.embeddable.getOutput().title)} > {' '} - + - + diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx index c4b9f9ff9a40ae..aa7a0b9dd781f5 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx @@ -46,7 +46,7 @@ function CustomizeTitleFormUi({
@@ -58,7 +58,7 @@ function CustomizeTitleFormUi({ value={title} onChange={onInputChange} aria-label={intl.formatMessage({ - id: 'kbn.dashboard.panel.optionsMenuForm.panelTitleInputAriaLabel', + id: 'embeddableApi.customizeTitle.optionsMenuForm.panelTitleInputAriaLabel', defaultMessage: 'Changes to this input are applied immediately. Press enter to exit.', })} /> @@ -66,7 +66,7 @@ function CustomizeTitleFormUi({ diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/edit_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/edit_panel_action.tsx index 4e7a0a63edf33a..e64a793295b353 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/edit_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/edit_panel_action.tsx @@ -40,7 +40,7 @@ export class EditPanelAction extends Action { if (!factory) { throw new EmbeddableFactoryNotFoundError(embeddable.type); } - return i18n.translate('kbn.dashboard.panel.editPanel.displayName', { + return i18n.translate('embeddableApi.panel.editPanel.displayName', { defaultMessage: 'Edit {value}', values: { value: factory.getDisplayName(), diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/inspect_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/inspect_panel_action.tsx index 3656bdc3f83a61..2346dd76a69ce5 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/inspect_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/inspect_panel_action.tsx @@ -34,7 +34,7 @@ export class InspectPanelAction extends Action { } public getDisplayName() { - return i18n.translate('kbn.embeddable.panel.inspectPanel.displayName', { + return i18n.translate('embeddableApi.panel.inspectPanel.displayName', { defaultMessage: 'Inspect', }); } diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/remove_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/remove_panel_action.tsx index 62fc04436abdad..04dcb3d132ec0e 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/remove_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_actions/remove_panel_action.tsx @@ -44,7 +44,7 @@ export class RemovePanelAction extends Action { } public getDisplayName() { - return i18n.translate('kbn.embeddable.panel.removePanel.displayName', { + return i18n.translate('embeddableApi.panel.removePanel.displayName', { defaultMessage: 'Delete from dashboard', }); } diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_header.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_header.tsx index bea899fd633358..3d6f82b94693db 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_header.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_header.tsx @@ -70,7 +70,7 @@ function PanelHeaderUi({ title={title} aria-label={intl.formatMessage( { - id: 'kbn.dashboard.panel.dashboardPanelAriaLabel', + id: 'embeddableApi.panel.dashboardPanelAriaLabel', defaultMessage: 'Dashboard panel: {title}', }, { diff --git a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_options_menu.tsx b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_options_menu.tsx index 351e007357e5af..dfffd0b5043286 100644 --- a/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_options_menu.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/panel/panel_header/panel_options_menu.tsx @@ -84,7 +84,7 @@ class PanelOptionsMenuUi extends React.Component color="text" className="embPanel__optionsMenuButton" aria-label={intl.formatMessage({ - id: 'kbn.dashboard.panel.optionsMenu.panelOptionsButtonAriaLabel', + id: 'embeddableApi.panel.optionsMenu.panelOptionsButtonAriaLabel', defaultMessage: 'Panel options', })} data-test-subj="embeddablePanelToggleMenuIcon" diff --git a/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx b/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx index 22c0364a1eb20c..87fb7b1169f249 100644 --- a/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx @@ -35,7 +35,7 @@ export class ContactCardEmbeddableFactory extends EmbeddableFactory