[i18n] Translate missing labels in Dev Tools and Management (#26965)
* Translate missings labels in dev tools and management * Fix issues * Add translation for k7Breadcrumbs
This commit is contained in:
parent
603aeef58e
commit
bd0f734155
|
@ -33,19 +33,25 @@ uiRoutes
|
|||
});
|
||||
|
||||
uiRoutes.defaults(/^\/dev_tools(\/|$)/, {
|
||||
k7Breadcrumbs: () => [
|
||||
k7Breadcrumbs: (i18n) => [
|
||||
{
|
||||
text: 'Dev Tools',
|
||||
text: i18n('kbn.devTools.k7BreadcrumbsDevToolsLabel', {
|
||||
defaultMessage: 'Dev Tools'
|
||||
}),
|
||||
href: '#/dev_tools'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
FeatureCatalogueRegistryProvider.register(() => {
|
||||
FeatureCatalogueRegistryProvider.register(i18n => {
|
||||
return {
|
||||
id: 'console',
|
||||
title: 'Console',
|
||||
description: 'Skip cURL and use this JSON interface to work with your data directly.',
|
||||
title: i18n('kbn.devTools.consoleTitle', {
|
||||
defaultMessage: 'Console'
|
||||
}),
|
||||
description: i18n('kbn.devTools.consoleDescription', {
|
||||
defaultMessage: 'Skip cURL and use this JSON interface to work with your data directly.'
|
||||
}),
|
||||
icon: 'consoleApp',
|
||||
path: '/app/kibana#/dev_tools/console',
|
||||
showOnHomePage: true,
|
||||
|
|
|
@ -86,11 +86,15 @@ uiModules
|
|||
};
|
||||
});
|
||||
|
||||
FeatureCatalogueRegistryProvider.register(() => {
|
||||
FeatureCatalogueRegistryProvider.register(i18n => {
|
||||
return {
|
||||
id: 'management',
|
||||
title: 'Management',
|
||||
description: 'Your center console for managing the Elastic Stack.',
|
||||
title: i18n('kbn.management.managementLabel', {
|
||||
defaultMessage: 'Management',
|
||||
}),
|
||||
description: i18n('kbn.management.managementDescription', {
|
||||
defaultMessage: 'Your center console for managing the Elastic Stack.',
|
||||
}),
|
||||
icon: 'managementApp',
|
||||
path: '/app/kibana#/management',
|
||||
showOnHomePage: false,
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
import React from 'react';
|
||||
import { Header } from '../header';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
|
||||
|
||||
describe('Header', () => {
|
||||
it('should render normally', () => {
|
||||
const component = shallow(
|
||||
<Header
|
||||
const component = shallowWithIntl(
|
||||
<Header.WrappedComponent
|
||||
isIncludingSystemIndices={true}
|
||||
onChangeIncludingSystemIndices={() => {}}
|
||||
/>
|
||||
|
@ -34,8 +34,8 @@ describe('Header', () => {
|
|||
});
|
||||
|
||||
it('should render without including system indices', () => {
|
||||
const component = shallow(
|
||||
<Header
|
||||
const component = shallowWithIntl(
|
||||
<Header.WrappedComponent
|
||||
isIncludingSystemIndices={false}
|
||||
onChangeIncludingSystemIndices={() => {}}
|
||||
/>
|
||||
|
@ -45,8 +45,8 @@ describe('Header', () => {
|
|||
});
|
||||
|
||||
it('should render a different name, prompt, and beta tag if provided', () => {
|
||||
const component = shallow(
|
||||
<Header
|
||||
const component = shallowWithIntl(
|
||||
<Header.WrappedComponent
|
||||
isIncludingSystemIndices={false}
|
||||
onChangeIncludingSystemIndices={() => {}}
|
||||
prompt={<div>Test prompt</div>}
|
||||
|
|
|
@ -30,15 +30,16 @@ import {
|
|||
EuiSwitch,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
|
||||
|
||||
export const Header = ({
|
||||
const HeaderUi = ({
|
||||
prompt,
|
||||
indexPatternName,
|
||||
showSystemIndices,
|
||||
isIncludingSystemIndices,
|
||||
onChangeIncludingSystemIndices,
|
||||
isBeta,
|
||||
intl
|
||||
}) => (
|
||||
<div>
|
||||
<EuiTitle>
|
||||
|
@ -53,7 +54,12 @@ export const Header = ({
|
|||
{ isBeta ? (
|
||||
<Fragment>
|
||||
{' '}
|
||||
<EuiBetaBadge label="Beta" />
|
||||
<EuiBetaBadge
|
||||
label={intl.formatMessage({
|
||||
id: 'kbn.management.createIndexPattern.betaLabel',
|
||||
defaultMessage: 'Beta'
|
||||
})}
|
||||
/>
|
||||
</Fragment>
|
||||
) : null }
|
||||
</h1>
|
||||
|
@ -98,3 +104,5 @@ export const Header = ({
|
|||
<EuiSpacer size="m"/>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const Header = injectI18n(HeaderUi);
|
||||
|
|
|
@ -31,7 +31,7 @@ exports[`LoadingIndices should render normally 1`] = `
|
|||
component="span"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Looking for matching indices..."
|
||||
defaultMessage="Looking for matching indices…"
|
||||
id="kbn.management.createIndexPattern.step.loadingHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
|
@ -51,7 +51,7 @@ exports[`LoadingIndices should render normally 1`] = `
|
|||
component="span"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Just a sec..."
|
||||
defaultMessage="Just a sec…"
|
||||
id="kbn.management.createIndexPattern.step.loadingLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
|
|
|
@ -44,7 +44,7 @@ export const LoadingIndices = ({ ...rest }) => (
|
|||
<EuiTextColor color="subdued">
|
||||
<FormattedMessage
|
||||
id="kbn.management.createIndexPattern.step.loadingHeader"
|
||||
defaultMessage="Looking for matching indices..."
|
||||
defaultMessage="Looking for matching indices…"
|
||||
/>
|
||||
</EuiTextColor>
|
||||
</EuiText>
|
||||
|
@ -53,7 +53,7 @@ export const LoadingIndices = ({ ...rest }) => (
|
|||
<EuiTextColor color="subdued">
|
||||
<FormattedMessage
|
||||
id="kbn.management.createIndexPattern.step.loadingLabel"
|
||||
defaultMessage="Just a sec..."
|
||||
defaultMessage="Just a sec…"
|
||||
/>
|
||||
</EuiTextColor>
|
||||
</EuiText>
|
||||
|
|
|
@ -46,7 +46,7 @@ exports[`StepTimeField should render a loading state when creating the index pat
|
|||
size="m"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Creating index pattern..."
|
||||
defaultMessage="Creating index pattern…"
|
||||
id="kbn.management.createIndexPattern.stepTime.creatingLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
|
|
|
@ -68,7 +68,7 @@ exports[`TimeField should render a loading state 1`] = `
|
|||
options={
|
||||
Array [
|
||||
Object {
|
||||
"text": "Loading...",
|
||||
"text": "Loading…",
|
||||
"value": "",
|
||||
},
|
||||
]
|
||||
|
|
|
@ -100,7 +100,7 @@ export const TimeFieldComponent = ({
|
|||
{
|
||||
text: intl.formatMessage({
|
||||
id: 'kbn.management.createIndexPattern.stepTime.field.loadingDropDown',
|
||||
defaultMessage: 'Loading...'
|
||||
defaultMessage: 'Loading…'
|
||||
}),
|
||||
value: ''
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ export class StepTimeFieldComponent extends Component {
|
|||
<EuiText>
|
||||
<FormattedMessage
|
||||
id="kbn.management.createIndexPattern.stepTime.creatingLabel"
|
||||
defaultMessage="Creating index pattern..."
|
||||
defaultMessage="Creating index pattern…"
|
||||
/>
|
||||
</EuiText>
|
||||
</EuiFlexItem>
|
||||
|
|
|
@ -33,6 +33,8 @@ import {
|
|||
rgbToHex,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export class CreateButton extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -64,7 +66,12 @@ export class CreateButton extends Component {
|
|||
renderBetaBadge = () => {
|
||||
const color = rgbToHex(euiColorAccent);
|
||||
return (
|
||||
<EuiBadge color={color}>Beta</EuiBadge>
|
||||
<EuiBadge color={color}>
|
||||
<FormattedMessage
|
||||
id="kbn.management.indexPatternList.createButton.betaLabel"
|
||||
defaultMessage="Beta"
|
||||
/>
|
||||
</EuiBadge>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import { getIndexBreadcrumbs } from './breadcrumbs';
|
|||
|
||||
const REACT_OBJECTS_TABLE_DOM_ELEMENT_ID = 'reactSavedObjectsTable';
|
||||
|
||||
function updateObjectsTable($scope, $injector) {
|
||||
function updateObjectsTable($scope, $injector, i18n) {
|
||||
const Private = $injector.get('Private');
|
||||
const indexPatterns = $injector.get('indexPatterns');
|
||||
const $http = $injector.get('$http');
|
||||
|
@ -70,7 +70,10 @@ function updateObjectsTable($scope, $injector) {
|
|||
}
|
||||
const serviceName = typeToServiceName(type);
|
||||
if (!serviceName) {
|
||||
toastNotifications.addWarning(`Unknown saved object type: ${type}`);
|
||||
toastNotifications.addWarning(i18n('kbn.management.objects.unknownSavedObjectTypeNotificationMessage', {
|
||||
defaultMessage: 'Unknown saved object type: {type}',
|
||||
values: { type }
|
||||
}));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -106,8 +109,8 @@ uiModules.get('apps/management')
|
|||
return {
|
||||
restrict: 'E',
|
||||
controllerAs: 'managementObjectsController',
|
||||
controller: function ($scope, $injector) {
|
||||
updateObjectsTable($scope, $injector);
|
||||
controller: function ($scope, $injector, i18n) {
|
||||
updateObjectsTable($scope, $injector, i18n);
|
||||
$scope.$on('$destroy', destroyObjectsTable);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -164,7 +164,7 @@ class ObjectsTableUI extends Component {
|
|||
}
|
||||
|
||||
debouncedFetch = debounce(async () => {
|
||||
const { savedObjectsClient } = this.props;
|
||||
const { intl, savedObjectsClient } = this.props;
|
||||
const { activeQuery: query, page, perPage } = this.state;
|
||||
const { queryText, visibleTypes } = parseQuery(query);
|
||||
const findOptions = {
|
||||
|
@ -191,7 +191,10 @@ class ObjectsTableUI extends Component {
|
|||
});
|
||||
}
|
||||
toastNotifications.addDanger({
|
||||
title: `Unable find saved objects`,
|
||||
title: intl.formatMessage({
|
||||
id: 'kbn.management.objects.objectsTable.unableFindSavedObjectsNotificationMessage',
|
||||
defaultMessage: 'Unable find saved objects'
|
||||
}),
|
||||
text: `${error}`,
|
||||
});
|
||||
return;
|
||||
|
|
|
@ -470,7 +470,13 @@ exports[`Field for boolean setting should render as read only with help text if
|
|||
checked={false}
|
||||
data-test-subj="advancedSetting-editField-boolean:test:setting"
|
||||
disabled={true}
|
||||
label="Off"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Off"
|
||||
id="kbn.management.settings.field.offLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
/>
|
||||
|
@ -552,7 +558,13 @@ exports[`Field for boolean setting should render custom setting icon if it is cu
|
|||
checked={true}
|
||||
data-test-subj="advancedSetting-editField-boolean:test:setting"
|
||||
disabled={false}
|
||||
label="On"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="On"
|
||||
id="kbn.management.settings.field.onLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
/>
|
||||
|
@ -623,7 +635,13 @@ exports[`Field for boolean setting should render default value if there is no us
|
|||
checked={true}
|
||||
data-test-subj="advancedSetting-editField-boolean:test:setting"
|
||||
disabled={false}
|
||||
label="On"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="On"
|
||||
id="kbn.management.settings.field.onLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
/>
|
||||
|
@ -736,7 +754,13 @@ exports[`Field for boolean setting should render user value if there is user val
|
|||
checked={false}
|
||||
data-test-subj="advancedSetting-editField-boolean:test:setting"
|
||||
disabled={false}
|
||||
label="Off"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Off"
|
||||
id="kbn.management.settings.field.offLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
/>
|
||||
|
|
|
@ -354,7 +354,17 @@ class FieldUI extends PureComponent {
|
|||
case 'boolean':
|
||||
return (
|
||||
<EuiSwitch
|
||||
label={!!unsavedValue ? 'On' : 'Off'}
|
||||
label={!!unsavedValue ? (
|
||||
<FormattedMessage
|
||||
id="kbn.management.settings.field.onLabel"
|
||||
defaultMessage="On"
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="kbn.management.settings.field.offLabel"
|
||||
defaultMessage="Off"
|
||||
/>
|
||||
)}
|
||||
checked={!!unsavedValue}
|
||||
onChange={this.onFieldChange}
|
||||
disabled={loading || isOverridden}
|
||||
|
|
|
@ -85,11 +85,15 @@ management.getSection('kibana').register('settings', {
|
|||
url: '#/management/kibana/settings'
|
||||
});
|
||||
|
||||
FeatureCatalogueRegistryProvider.register(() => {
|
||||
FeatureCatalogueRegistryProvider.register(i18n => {
|
||||
return {
|
||||
id: 'advanced_settings',
|
||||
title: 'Advanced Settings',
|
||||
description: 'Directly edit settings that control behavior in Kibana.',
|
||||
title: i18n('kbn.management.settings.advancedSettingsLabel', {
|
||||
defaultMessage: 'Advanced Settings',
|
||||
}),
|
||||
description: i18n('kbn.management.settings.advancedSettingsDescription', {
|
||||
defaultMessage: 'Directly edit settings that control behavior in Kibana.',
|
||||
}),
|
||||
icon: 'advancedSettingsApp',
|
||||
path: '/app/kibana#/management/kibana/settings',
|
||||
showOnHomePage: false,
|
||||
|
|
Loading…
Reference in a new issue