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

[ML] Localize ml components ( part 1 ) #27957

Merged
merged 97 commits into from
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 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
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
71fb60d
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 12, 2018
4d95475
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 13, 2018
62e824d
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 13, 2018
4463796
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
876e358
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
231a859
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
2af5dc9
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
8a24575
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
aa0b988
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
1bd465e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
9c43f68
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 14, 2018
45ea012
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 17, 2018
b20b0be
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 19, 2018
279bfed
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 19, 2018
d4f3e72
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 19, 2018
917da91
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 21, 2018
6beb6fe
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 26, 2018
4b22727
feature(ml): localize components
Bamieh Dec 26, 2018
a1bcdb5
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Dec 28, 2018
850ee93
fix xpack.i18n localization strings
Bamieh Jan 1, 2019
f4c8246
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 2, 2019
28c57ae
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 3, 2019
4b5e283
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 3, 2019
72991df
Merge branch 'master' of github.com:elastic/kibana into localize-ml-c…
Bamieh Jan 3, 2019
38b6a15
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 3, 2019
5f5ee45
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 3, 2019
f905f69
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 3, 2019
f1b48ce
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 4, 2019
e0d4ace
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 4, 2019
4eaa66e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 4, 2019
fbc9ba5
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 4, 2019
accf399
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 8, 2019
a4ebe6d
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 9, 2019
18c7b48
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 9, 2019
75b985c
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 9, 2019
c738a16
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 9, 2019
b81bc62
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 10, 2019
8bb5062
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 11, 2019
86c3cfa
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 11, 2019
fc3cbb5
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 14, 2019
1479425
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 14, 2019
face179
Resolve review comments
Nox911 Jan 14, 2019
a8431f8
Merge branch 'master' into localize-ml-components
Nox911 Jan 14, 2019
2659fe0
Add I18nProvider
Nox911 Jan 14, 2019
0304fc1
Fix adding label to angular scope
Nox911 Jan 14, 2019
b9868f0
Fix case of word
Nox911 Jan 15, 2019
787f623
Update test snapshots.
maryia-lapata Jan 15, 2019
29cfa20
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 15, 2019
88a1688
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 15, 2019
d30fa9e
Resolve review comments
Nox911 Jan 15, 2019
a5dc747
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Jan 16, 2019
d622079
Merge branch 'master' into localize-ml-components
Nox911 Jan 16, 2019
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 @@ -6,15 +6,15 @@
ng-click="ok()"
ng-disabled="(saveLock === true)"
class="kuiButton kuiButton--primary"
aria-label="OK">
aria-label="{{ ::'xpack.ml.confirmModal.okButtonAriaLabel' | i18n: {defaultMessage: 'Ok'} }}">
{{okLabel}}
</button>
<button
ng-hide="hideCancel"
ng-click="cancel()"
ng-disabled="(saveLock === true)"
class="kuiButton kuiButton--primary"
aria-label="Cancel">
aria-label="{{ ::'xpack.ml.confirmModal.cancelButtonAriaLabel' | i18n: {defaultMessage: 'Cancel'} }}">
{{cancelLabel}}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@
import { uiModules } from 'ui/modules';
const module = uiModules.get('apps/ml');

module.controller('MlConfirmModal', function ($scope, $modalInstance, params) {
module.controller('MlConfirmModal', function ($scope, $modalInstance, params, i18n) {

$scope.okFunc = params.ok;
$scope.cancelFunc = params.cancel;

$scope.message = params.message || '';
$scope.title = params.title || '';

$scope.okLabel = params.okLabel || 'OK';
$scope.cancelLabel = params.cancelLabel || 'Cancel';
$scope.okLabel = params.okLabel || i18n('xpack.ml.confirmModal.okButtonLabel', {
defaultMessage: 'OK',
});

$scope.cancelLabel = params.cancelLabel || i18n('xpack.ml.confirmModal.cancelButtonLabel', {
defaultMessage: 'Cancel',
});

$scope.hideCancel = params.hideCancel || false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import { EuiText, EuiToolTip } from '@elastic/eui';

import { FieldTypeIcon } from '../field_type_icon';
import { i18n } from '@kbn/i18n';

export function FieldTitleBar({ card }) {
// don't render and fail gracefully if card prop isn't set
Expand All @@ -26,7 +27,9 @@ export function FieldTitleBar({ card }) {
classNames.push(card.type);
}

const fieldName = card.fieldName || 'document count';
const fieldName = card.fieldName || i18n.translate('xpack.ml.fieldTitleBar.documentCountLabel', {
defaultMessage: 'document count'
});

return (
<EuiText className={classNames.join(' ')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { mount } from 'enzyme';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import React from 'react';

import { FieldTitleBar } from './field_title_bar';
Expand All @@ -27,7 +27,7 @@ describe('FieldTitleBar', () => {
test(`card prop is an empty object`, () => {
const props = { card: {} };

const wrapper = mount(<FieldTitleBar {...props} />);
const wrapper = mountWithIntl(<FieldTitleBar {...props} />);

const fieldName = wrapper.find({ className: 'field-name' }).text();
expect(fieldName).toEqual('document count');
Expand All @@ -40,7 +40,7 @@ describe('FieldTitleBar', () => {
const testFieldName = 'foo';
const props = { card: { fieldName: testFieldName, isUnsupportedType: true } };

const wrapper = mount(<FieldTitleBar {...props} />);
const wrapper = mountWithIntl(<FieldTitleBar {...props} />);

const fieldName = wrapper.find({ className: 'field-name' }).text();
expect(fieldName).toEqual(testFieldName);
Expand All @@ -54,7 +54,7 @@ describe('FieldTitleBar', () => {
const testType = 'bar';
const props = { card: { fieldName: testFieldName, type: testType } };

const wrapper = mount(<FieldTitleBar {...props} />);
const wrapper = mountWithIntl(<FieldTitleBar {...props} />);

const fieldName = wrapper.find({ className: 'field-name' }).text();
expect(fieldName).toEqual(testFieldName);
Expand All @@ -65,7 +65,7 @@ describe('FieldTitleBar', () => {

test(`tooltip hovering`, () => {
const props = { card: { fieldName: 'foo', type: 'bar' } };
const wrapper = mount(<FieldTitleBar {...props} />);
const wrapper = mountWithIntl(<FieldTitleBar {...props} />);
const container = wrapper.find({ className: 'field-name' });

expect(wrapper.find('EuiToolTip').children()).toHaveLength(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import ReactDOM from 'react-dom';

import { FieldTitleBar } from './field_title_bar';
import { I18nProvider } from '@kbn/i18n/react';

import { uiModules } from 'ui/modules';
const module = uiModules.get('apps/ml');
Expand All @@ -32,7 +33,9 @@ module.directive('mlFieldTitleBar', function () {
};

ReactDOM.render(
React.createElement(FieldTitleBar, props),
<I18nProvider>
{React.createElement(FieldTitleBar, props)}
</I18nProvider>,
element[0]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,68 @@ import { EuiToolTip } from '@elastic/eui';
// don't use something like plugins/ml/../common
// because it won't work with the jest tests
import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';

export function FieldTypeIcon({ tooltipEnabled = false, type }) {
export const FieldTypeIcon = injectI18n(function FieldTypeIcon({ tooltipEnabled = false, type, intl }) {
let ariaLabel = '';
let iconClass = '';
let iconChar = '';

switch (type) {
case ML_JOB_FIELD_TYPES.BOOLEAN:
ariaLabel = 'boolean type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.booleanTypeAriaLabel',
defaultMessage: 'boolean type'
});
iconClass = 'fa-adjust';
break;
case ML_JOB_FIELD_TYPES.DATE:
ariaLabel = 'date type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.dateTypeAriaLabel',
defaultMessage: 'date type'
});
iconClass = 'fa-clock-o';
break;
case ML_JOB_FIELD_TYPES.NUMBER:
ariaLabel = 'number type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.numberTypeAriaLabel',
defaultMessage: 'number type'
});
iconChar = '#';
break;
case ML_JOB_FIELD_TYPES.GEO_POINT:
ariaLabel = 'geo_point type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.geoPointTypeAriaLabel',
defaultMessage: '{geoPointParam} type'
}, { geoPointParam: 'geo_point' });
Copy link
Contributor

Choose a reason for hiding this comment

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

@Bamieh, hello, could you please confirm that "geo point" string should not be translated? Otherwise, could you clarify why it is passed in as a parameter?

iconClass = 'fa-globe';
break;
case ML_JOB_FIELD_TYPES.KEYWORD:
ariaLabel = 'keyword type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.keywordTypeAriaLabel',
defaultMessage: 'keyword type'
});
iconChar = 't';
break;
case ML_JOB_FIELD_TYPES.TEXT:
ariaLabel = 'text type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.textTypeAriaLabel',
defaultMessage: 'text type'
});
iconClass = 'fa-file-text-o';
break;
case ML_JOB_FIELD_TYPES.IP:
ariaLabel = 'IP type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.ipTypeAriaLabel',
defaultMessage: 'IP type'
});
iconClass = 'fa-laptop';
break;
case ML_JOB_FIELD_TYPES.UNKNOWN:
ariaLabel = 'Unknown type';
ariaLabel = intl.formatMessage({
id: 'xpack.ml.fieldTypeIcon.unknownTypeAriaLabel',
defaultMessage: 'Unknown type'
});
iconChar = '?';
break;
default:
Expand All @@ -73,15 +98,22 @@ export function FieldTypeIcon({ tooltipEnabled = false, type }) {
// to support having another component directly inside the tooltip anchor
// see https://github.com/elastic/eui/issues/839
return (
<EuiToolTip position="left" content={`${type} type`}>
<EuiToolTip
position="left"
content={<FormattedMessage
id="xpack.ml.fieldTypeIcon.fieldTypeTooltip"
defaultMessage="{type} type"
values={{ type }}
/>}
>
<FieldTypeIconContainer {...containerProps} />
</EuiToolTip>
);
}

return <FieldTypeIconContainer {...containerProps} />;
}
FieldTypeIcon.propTypes = {
});
FieldTypeIcon.WrappedComponent.propTypes = {
tooltipEnabled: PropTypes.bool,
type: PropTypes.string
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

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

import { FieldTypeIcon } from './field_type_icon';
Expand All @@ -13,22 +13,22 @@ import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types';
describe('FieldTypeIcon', () => {

test(`don't render component when type is undefined`, () => {
const wrapper = shallow(<FieldTypeIcon />);
const wrapper = shallowWithIntl(<FieldTypeIcon.WrappedComponent />);
expect(wrapper.isEmptyRender()).toBeTruthy();
});

test(`don't render component when type doesn't match a field type`, () => {
const wrapper = shallow(<FieldTypeIcon type="foo" />);
const wrapper = shallowWithIntl(<FieldTypeIcon.WrappedComponent type="foo" />);
expect(wrapper.isEmptyRender()).toBeTruthy();
});

test(`render component when type matches a field type`, () => {
const wrapper = shallow(<FieldTypeIcon type={ML_JOB_FIELD_TYPES.KEYWORD} />);
const wrapper = shallowWithIntl(<FieldTypeIcon.WrappedComponent type={ML_JOB_FIELD_TYPES.KEYWORD} />);
expect(wrapper).toMatchSnapshot();
});

test(`render with tooltip and test hovering`, () => {
const wrapper = mount(<FieldTypeIcon type={ML_JOB_FIELD_TYPES.KEYWORD} tooltipEnabled={true} />);
const wrapper = mountWithIntl(<FieldTypeIcon.WrappedComponent type={ML_JOB_FIELD_TYPES.KEYWORD} tooltipEnabled={true} />);
const container = wrapper.find({ className: 'field-type-icon-container' });

expect(wrapper.find('EuiToolTip').children()).toHaveLength(1);
Expand All @@ -41,7 +41,7 @@ describe('FieldTypeIcon', () => {
});

test(`update component`, () => {
const wrapper = shallow(<FieldTypeIcon />);
const wrapper = shallowWithIntl(<FieldTypeIcon.WrappedComponent />);
expect(wrapper.isEmptyRender()).toBeTruthy();
wrapper.setProps({ type: ML_JOB_FIELD_TYPES.IP });
expect(wrapper).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import ReactDOM from 'react-dom';

import { FieldTypeIcon } from './field_type_icon.js';
import { I18nProvider } from '@kbn/i18n/react';

import { uiModules } from 'ui/modules';
const module = uiModules.get('apps/ml');
Expand All @@ -34,7 +35,9 @@ module.directive('mlFieldTypeIcon', function () {
};

ReactDOM.render(
React.createElement(FieldTypeIcon, props),
<I18nProvider>
{React.createElement(FieldTypeIcon, props)}
</I18nProvider>,
element[0]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<input
class="form-control ml-filter-input-left-icon"
type="text"
aria-label="{{placeholder}}"
aria-label="{{ariaLabel}}"
placeholder="{{placeholder}}"
ng-model="filter"
ng-change="filterChanged()" />
Expand All @@ -11,7 +11,10 @@
<i class='fa fa-spinner fa-spin'></i>
</div>
<div ng-show="filterIcon===0">
<a aria-label="Clear filter" ng-click="clearFilter()">
<a
aria-label="{{ ::'xpack.ml.formFilterInput.clearFilterAriaLabel' | i18n: {defaultMessage: 'Clear filter'} }}"
ng-click="clearFilter()"
>
<i class="fa fa-times-circle"></i>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import angular from 'angular';
import { uiModules } from 'ui/modules';
const module = uiModules.get('apps/ml');

module.directive('mlFormFilterInput', function () {
module.directive('mlFormFilterInput', function (i18n) {
return {
scope: {
placeholder: '@?',
Expand All @@ -25,7 +25,15 @@ module.directive('mlFormFilterInput', function () {
replace: false,
template,
link(scope) {
scope.placeholder = angular.isDefined(scope.placeholder) ? scope.placeholder : 'Filter';
const placeholderIsDefined = angular.isDefined(scope.placeholder);

scope.placeholder = placeholderIsDefined
? scope.placeholder
: i18n('xpack.ml.formFilterInput.filterPlaceholder', { defaultMessage: 'Filter' });

scope.ariaLabel = placeholderIsDefined
? scope.placeholder
: i18n('xpack.ml.formFilterInput.filterAriaLabel', { defaultMessage: 'Filter' });
}
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
type="button"
ng-disabled="disabled"
class="euiButton euiButton--primary euiButton--small euiButton--fill">
<span class="euiButton__content">
Use full {{indexPattern.title}} data
</span>
<span
class="euiButton__content"
i18n-id="xpack.ml.fullTimeRangeSelector.useFullDataButtonLabel"
i18n-default-message="Use full {indexPatternTitle} data"
i18n-values="{ indexPatternTitle: indexPattern.title }"
></span>
</button>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
EuiTitle,
EuiToolTip
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { abbreviateWholeNumber } from 'plugins/ml/formatters/abbreviate_whole_number';
import { getSeverity } from 'plugins/ml/../common/util/anomaly_utils';
Expand All @@ -28,8 +29,20 @@ import { getSeverity } from 'plugins/ml/../common/util/anomaly_utils';
function getTooltipContent(maxScoreLabel, totalScoreLabel) {
return (
<React.Fragment>
<p>Maximum anomaly score: {maxScoreLabel}</p>
<p>Total anomaly score: {totalScoreLabel}</p>
<p>
<FormattedMessage
id="xpack.ml.influencersList.maxAnomalyScoreTooltipDescription"
defaultMessage="Maximum anomaly score: {maxScoreLabel}"
values={{ maxScoreLabel }}
/>
</p>
<p>
<FormattedMessage
id="xpack.ml.influencersList.totalAnomalyScoreTooltipDescription"
defaultMessage="Total anomaly score: {totalScoreLabel}"
values={{ totalScoreLabel }}
/>
</p>
</React.Fragment>
);
}
Expand Down Expand Up @@ -124,7 +137,12 @@ export function InfluencersList({ influencers }) {
<EuiFlexItem grow={false}>
<EuiSpacer size="xxl" />
<EuiText>
<h4>No influencers found</h4>
<h4>
<FormattedMessage
id="xpack.ml.influencersList.noInfluencersFoundTitle"
defaultMessage="No influencers found"
/>
</h4>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Loading