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 Agg_types(part_3) #26118

Merged
merged 34 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
34 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
6b4474d
Translate agg_types - metrics
Nox911 Nov 23, 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
7f25e13
Fix issues
Nox911 Nov 26, 2018
6fc630d
Merge branch 'master' into feature/translate-ui-agg_types-metrics
Nox911 Nov 26, 2018
df4fab4
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 26, 2018
88ace11
Merge branch 'master' into feature/translate-ui-agg_types-metrics
Nox911 Nov 26, 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
10 changes: 8 additions & 2 deletions src/ui/public/agg_types/metrics/avg.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@
*/

import { MetricAggType } from './metric_agg_type';
import { i18n } from '@kbn/i18n';

export const avgMetricAgg = new MetricAggType({
name: 'avg',
title: 'Average',
title: i18n.translate('common.ui.aggTypes.metrics.averageTitle', {
defaultMessage: 'Average'
}),
makeLabel: function (aggConfig) {
return 'Average ' + aggConfig.getFieldDisplayName();
return i18n.translate('common.ui.aggTypes.metrics.averageLabel', {
defaultMessage: 'Average {field}',
values: { field: aggConfig.getFieldDisplayName() }
});
},
params: [
{
Expand Down
11 changes: 9 additions & 2 deletions src/ui/public/agg_types/metrics/bucket_avg.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ import { get } from 'lodash';
import { MetricAggType } from './metric_agg_type';
import { makeNestedLabel } from './lib/make_nested_label';
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
import { i18n } from '@kbn/i18n';

const overallAverageLabel = i18n.translate('common.ui.aggTypes.metrics.overallAverageLabel', {
defaultMessage: 'overall average'
});

export const bucketAvgMetricAgg = new MetricAggType({
name: 'avg_bucket',
title: 'Average Bucket',
makeLabel: agg => makeNestedLabel(agg, 'overall average'),
title: i18n.translate('common.ui.aggTypes.metrics.averageBucketTitle', {
defaultMessage: 'Average Bucket'
}),
makeLabel: agg => makeNestedLabel(agg, overallAverageLabel),
subtype: siblingPipelineAggHelper.subtype,
params: [
...siblingPipelineAggHelper.params()
Expand Down
11 changes: 9 additions & 2 deletions src/ui/public/agg_types/metrics/bucket_max.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@
import { MetricAggType } from './metric_agg_type';
import { makeNestedLabel } from './lib/make_nested_label';
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
import { i18n } from '@kbn/i18n';

const overallMaxLabel = i18n.translate('common.ui.aggTypes.metrics.overallMaxLabel', {
defaultMessage: 'overall max'
});

export const bucketMaxMetricAgg = new MetricAggType({
name: 'max_bucket',
title: 'Max Bucket',
makeLabel: agg => makeNestedLabel(agg, 'overall max'),
title: i18n.translate('common.ui.aggTypes.metrics.maxBucketTitle', {
defaultMessage: 'Max Bucket'
}),
makeLabel: agg => makeNestedLabel(agg, overallMaxLabel),
subtype: siblingPipelineAggHelper.subtype,
params: [
...siblingPipelineAggHelper.params()
Expand Down
11 changes: 9 additions & 2 deletions src/ui/public/agg_types/metrics/bucket_min.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@
import { MetricAggType } from './metric_agg_type';
import { makeNestedLabel } from './lib/make_nested_label';
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
import { i18n } from '@kbn/i18n';

const overallMinLabel = i18n.translate('common.ui.aggTypes.metrics.overallMinLabel', {
defaultMessage: 'overall min'
});

export const bucketMinMetricAgg = new MetricAggType({
name: 'min_bucket',
title: 'Min Bucket',
makeLabel: agg => makeNestedLabel(agg, 'overall min'),
title: i18n.translate('common.ui.aggTypes.metrics.minBucketTitle', {
defaultMessage: 'Min Bucket'
}),
makeLabel: agg => makeNestedLabel(agg, overallMinLabel),
subtype: siblingPipelineAggHelper.subtype,
params: [
...siblingPipelineAggHelper.params()
Expand Down
11 changes: 9 additions & 2 deletions src/ui/public/agg_types/metrics/bucket_sum.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@
import { MetricAggType } from './metric_agg_type';
import { makeNestedLabel } from './lib/make_nested_label';
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
import { i18n } from '@kbn/i18n';

const overallSumLabel = i18n.translate('common.ui.aggTypes.metrics.overallSumLabel', {
defaultMessage: 'overall sum'
});

export const bucketSumMetricAgg = new MetricAggType({
name: 'sum_bucket',
title: 'Sum Bucket',
makeLabel: agg => makeNestedLabel(agg, 'overall sum'),
title: i18n.translate('common.ui.aggTypes.metrics.sumBucketTitle', {
defaultMessage: 'Sum Bucket'
}),
makeLabel: agg => makeNestedLabel(agg, overallSumLabel),
subtype: siblingPipelineAggHelper.subtype,
params: [
...siblingPipelineAggHelper.params()
Expand Down
10 changes: 8 additions & 2 deletions src/ui/public/agg_types/metrics/cardinality.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@

import { MetricAggType } from './metric_agg_type';
import { fieldFormats } from '../../registry/field_formats';
import { i18n } from '@kbn/i18n';

export const cardinalityMetricAgg = new MetricAggType({
name: 'cardinality',
title: 'Unique Count',
title: i18n.translate('common.ui.aggTypes.metrics.uniqueCountTitle', {
defaultMessage: 'Unique Count'
}),
makeLabel: function (aggConfig) {
return 'Unique count of ' + aggConfig.getFieldDisplayName();
return i18n.translate('common.ui.aggTypes.metrics.uniqueCountLabel', {
defaultMessage: 'Unique count of {field}',
values: { field: aggConfig.getFieldDisplayName() }
});
},
getFormat: function () {
return fieldFormats.getDefaultInstance('number');
Expand Down
9 changes: 7 additions & 2 deletions src/ui/public/agg_types/metrics/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@

import { MetricAggType } from './metric_agg_type';
import { fieldFormats } from '../../registry/field_formats';
import { i18n } from '@kbn/i18n';

export const countMetricAgg = new MetricAggType({
name: 'count',
title: 'Count',
title: i18n.translate('common.ui.aggTypes.metrics.countTitle', {
defaultMessage: 'Count'
}),
hasNoDsl: true,
makeLabel: function () {
return 'Count';
return i18n.translate('common.ui.aggTypes.metrics.countLabel', {
defaultMessage: 'Count'
});
},
getFormat: function () {
return fieldFormats.getDefaultInstance('number');
Expand Down
11 changes: 9 additions & 2 deletions src/ui/public/agg_types/metrics/cumulative_sum.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@
import { MetricAggType } from './metric_agg_type';
import { parentPipelineAggHelper } from './lib/parent_pipeline_agg_helper';
import { makeNestedLabel } from './lib/make_nested_label';
import { i18n } from '@kbn/i18n';

const cumulativeSumLabel = i18n.translate('common.ui.aggTypes.metrics.cumulativeSumLabel', {
defaultMessage: 'cumulative sum'
});

export const cumulativeSumMetricAgg = new MetricAggType({
name: 'cumulative_sum',
title: 'Cumulative Sum',
title: i18n.translate('common.ui.aggTypes.metrics.cumulativeSumTitle', {
defaultMessage: 'Cumulative Sum'
}),
subtype: parentPipelineAggHelper.subtype,
makeLabel: agg => makeNestedLabel(agg, 'cumulative sum'),
makeLabel: agg => makeNestedLabel(agg, cumulativeSumLabel),
params: [
...parentPipelineAggHelper.params()
],
Expand Down
11 changes: 9 additions & 2 deletions src/ui/public/agg_types/metrics/derivative.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@
import { MetricAggType } from './metric_agg_type';
import { parentPipelineAggHelper } from './lib/parent_pipeline_agg_helper';
import { makeNestedLabel } from './lib/make_nested_label';
import { i18n } from '@kbn/i18n';

const derivativeLabel = i18n.translate('common.ui.aggTypes.metrics.derivativeLabel', {
defaultMessage: 'derivative'
});

export const derivativeMetricAgg = new MetricAggType({
name: 'derivative',
title: 'Derivative',
title: i18n.translate('common.ui.aggTypes.metrics.derivativeTitle', {
defaultMessage: 'Derivative'
}),
subtype: parentPipelineAggHelper.subtype,
makeLabel: agg => makeNestedLabel(agg, 'derivative'),
makeLabel: agg => makeNestedLabel(agg, derivativeLabel),
params: [
...parentPipelineAggHelper.params()
],
Expand Down
9 changes: 7 additions & 2 deletions src/ui/public/agg_types/metrics/geo_bounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@
*/

import { MetricAggType } from './metric_agg_type';
import { i18n } from '@kbn/i18n';

export const geoBoundsMetricAgg = new MetricAggType({
name: 'geo_bounds',
title: 'Geo Bounds',
title: i18n.translate('common.ui.aggTypes.metrics.geoBoundsTitle', {
defaultMessage: 'Geo Bounds'
}),
makeLabel: function () {
return 'Geo Bounds';
return i18n.translate('common.ui.aggTypes.metrics.geoBoundsLabel', {
defaultMessage: 'Geo Bounds'
});
},
params: [
{
Expand Down
9 changes: 7 additions & 2 deletions src/ui/public/agg_types/metrics/geo_centroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@
*/

import { MetricAggType } from './metric_agg_type';
import { i18n } from '@kbn/i18n';

export const geoCentroidMetricAgg = new MetricAggType({
name: 'geo_centroid',
title: 'Geo Centroid',
title: i18n.translate('common.ui.aggTypes.metrics.geoCentroidTitle', {
defaultMessage: 'Geo Centroid'
}),
makeLabel: function () {
return 'Geo Centroid';
return i18n.translate('common.ui.aggTypes.metrics.geoCentroidLabel', {
defaultMessage: 'Geo Centroid'
});
},
params: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import _ from 'lodash';
import { safeMakeLabel } from './safe_make_label';
import { i18n } from '@kbn/i18n';

const parentPipelineAggController = function ($scope) {

Expand Down Expand Up @@ -59,8 +60,10 @@ const parentPipelineAggController = function ($scope) {
} else {
if (lastBucket) {
const type = $scope.agg.type.title;
lastBucket.error = `Last bucket aggregation must be "Date Histogram" or
"Histogram" when using "${type}" metric aggregation!`;
lastBucket.error = i18n.translate('common.ui.aggTypes.metrics.wrongLastBucketTypeErrorMessage', {
defaultMessage: 'Last bucket aggregation must be "Date Histogram" or "Histogram" when using "{type}" metric aggregation!',
values: { type }
});
Nox911 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,26 @@ import { Schemas } from '../../../vis/editors/default/schemas';
import { parentPipelineAggController } from './parent_pipeline_agg_controller';
import { parentPipelineAggWriter } from './parent_pipeline_agg_writer';
import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers';
import { i18n } from '@kbn/i18n';


const metricAggFilter = ['!top_hits', '!percentiles', '!percentile_ranks', '!median', '!std_dev'];
const metricAggSchema = (new Schemas([
{
group: 'none',
name: 'metricAgg',
title: 'Metric Agg',
title: i18n.translate('common.ui.aggTypes.metrics.metricAggTitle', {
defaultMessage: 'Metric Agg'
}),
hideCustomLabel: true,
aggFilter: metricAggFilter
}
])).all[0];

const parentPipelineAggHelper = {
subtype: 'Parent Pipeline Aggregations',
subtype: i18n.translate('common.ui.aggTypes.metrics.parentPipelineAggregationsSubtypeTitle', {
defaultMessage: 'Parent Pipeline Aggregations'
}),
params: function () {
return [
{
Expand Down
5 changes: 4 additions & 1 deletion src/ui/public/agg_types/metrics/lib/safe_make_label.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
import { i18n } from '@kbn/i18n';

export const safeMakeLabel = function (agg) {
try {
return agg.makeLabel();
} catch (e) {
return '- agg not valid -';
return i18n.translate('common.ui.aggTypes.metrics.aggNotValidErrorMessage', {
defaultMessage: '- agg not valid -'
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@
*/

import { safeMakeLabel } from './safe_make_label';
import { i18n } from '@kbn/i18n';

const siblingPipelineAggController = function (type) {
return function ($scope) {
const metricTitle = i18n.translate('common.ui.aggTypes.metrics.metricTitle', {
defaultMessage: 'Metric'
});
const bucketTitle = i18n.translate('common.ui.aggTypes.metrics.bucketTitle', {
defaultMessage: 'Bucket'
});

$scope.aggType = type;
$scope.aggTitle = type === 'customMetric' ? 'Metric' : 'Bucket';
$scope.aggTitle = type === 'customMetric' ? metricTitle : bucketTitle;
$scope.aggGroup = type === 'customMetric' ? 'metrics' : 'buckets';
$scope.safeMakeLabel = safeMakeLabel;

Expand Down
13 changes: 10 additions & 3 deletions src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { siblingPipelineAggController } from './sibling_pipeline_agg_controller'
import { siblingPipelineAggWriter } from './sibling_pipeline_agg_writer';
import metricAggTemplate from '../../controls/sub_metric.html';
import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers';
import { i18n } from '@kbn/i18n';

const metricAggFilter = [
'!top_hits', '!percentiles', '!percentile_ranks', '!median', '!std_dev',
Expand All @@ -36,7 +37,9 @@ const metricAggSchema = (new Schemas([
{
group: 'none',
name: 'metricAgg',
title: 'Metric Agg',
title: i18n.translate('common.ui.aggTypes.metrics.metricAggTitle', {
defaultMessage: 'Metric Agg'
}),
aggFilter: metricAggFilter
}
])).all[0];
Expand All @@ -45,14 +48,18 @@ const bucketAggFilter = [];
const bucketAggSchema = (new Schemas([
{
group: 'none',
title: 'Bucket Agg',
title: i18n.translate('common.ui.aggTypes.metrics.bucketAggTitle', {
defaultMessage: 'Bucket Agg'
}),
name: 'bucketAgg',
aggFilter: bucketAggFilter
}
])).all[0];

const siblingPipelineAggHelper = {
subtype: 'Sibling Pipeline Aggregations',
subtype: i18n.translate('common.ui.aggTypes.metrics.siblingPipelineAggregationsSubtypeTitle', {
defaultMessage: 'Sibling Pipeline Aggregations'
}),
params: function () {
return [
{
Expand Down
10 changes: 8 additions & 2 deletions src/ui/public/agg_types/metrics/max.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@
*/

import { MetricAggType } from './metric_agg_type';
import { i18n } from '@kbn/i18n';

export const maxMetricAgg = new MetricAggType({
name: 'max',
title: 'Max',
title: i18n.translate('common.ui.aggTypes.metrics.maxTitle', {
defaultMessage: 'Max'
}),
makeLabel: function (aggConfig) {
return 'Max ' + aggConfig.getFieldDisplayName();
return i18n.translate('common.ui.aggTypes.metrics.maxLabel', {
defaultMessage: 'Max {field}',
values: { field: aggConfig.getFieldDisplayName() }
});
},
params: [
{
Expand Down
Loading