Skip to content

Commit

Permalink
i18n.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeelmers committed Feb 4, 2020
1 parent 441cf76 commit dbec747
Show file tree
Hide file tree
Showing 43 changed files with 321 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export class AggConfig {

if (!this.type) return '';
return percentageMode
? i18n.translate('common.ui.vis.aggConfig.percentageOfLabel', {
? i18n.translate('data.search.aggs.percentageOfLabel', {
defaultMessage: 'Percentage of {label}',
values: { label: this.type.makeLabel(this) },
})
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/data/public/search/aggs/agg_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export const AggGroupNames = Object.freeze({
export type AggGroupNames = $Values<typeof AggGroupNames>;

export const aggGroupNamesMap = () => ({
[AggGroupNames.Metrics]: i18n.translate('common.ui.aggTypes.aggGroups.metricsText', {
[AggGroupNames.Metrics]: i18n.translate('data.search.aggs.aggGroups.metricsText', {
defaultMessage: 'Metrics',
}),
[AggGroupNames.Buckets]: i18n.translate('common.ui.aggTypes.aggGroups.bucketsText', {
[AggGroupNames.Buckets]: i18n.translate('data.search.aggs.aggGroups.bucketsText', {
defaultMessage: 'Buckets',
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class AggType<
if (config.customLabels !== false) {
params.push({
name: 'customLabel',
displayName: i18n.translate('common.ui.aggTypes.string.customLabel', {
displayName: i18n.translate('data.search.aggs.string.customLabel', {
defaultMessage: 'Custom label',
}),
type: 'string',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { IBucketAggConfig } from './_bucket_agg_type';

export const intervalOptions = [
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.autoDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.autoDisplayName', {
defaultMessage: 'Auto',
}),
val: 'auto',
Expand All @@ -32,49 +32,49 @@ export const intervalOptions = [
},
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.millisecondDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.millisecondDisplayName', {
defaultMessage: 'Millisecond',
}),
val: 'ms',
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.secondDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.secondDisplayName', {
defaultMessage: 'Second',
}),
val: 's',
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.minuteDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.minuteDisplayName', {
defaultMessage: 'Minute',
}),
val: 'm',
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.hourlyDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.hourlyDisplayName', {
defaultMessage: 'Hourly',
}),
val: 'h',
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.dailyDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.dailyDisplayName', {
defaultMessage: 'Daily',
}),
val: 'd',
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.weeklyDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.weeklyDisplayName', {
defaultMessage: 'Weekly',
}),
val: 'w',
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.monthlyDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.monthlyDisplayName', {
defaultMessage: 'Monthly',
}),
val: 'M',
},
{
display: i18n.translate('common.ui.aggTypes.buckets.intervalOptions.yearlyDisplayName', {
display: i18n.translate('data.search.aggs.buckets.intervalOptions.yearlyDisplayName', {
defaultMessage: 'Yearly',
}),
val: 'y',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function isDateHistogramBucketAggConfig(agg: any): agg is IBucketDateHist

export const dateHistogramBucketAgg = new BucketAggType<IBucketDateHistogramAggConfig>({
name: BUCKET_TYPES.DATE_HISTOGRAM,
title: i18n.translate('common.ui.aggTypes.buckets.dateHistogramTitle', {
title: i18n.translate('data.search.aggs.buckets.dateHistogramTitle', {
defaultMessage: 'Date Histogram',
}),
ordered: {
Expand All @@ -79,7 +79,7 @@ export const dateHistogramBucketAgg = new BucketAggType<IBucketDateHistogramAggC
}

const field = agg.getFieldDisplayName();
return i18n.translate('common.ui.aggTypes.buckets.dateHistogramLabel', {
return i18n.translate('data.search.aggs.buckets.dateHistogramLabel', {
defaultMessage: '{fieldName} per {intervalDescription}',
values: {
fieldName: field,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { createFilterDateRange } from './create_filter/date_range';

import { KBN_FIELD_TYPES, fieldFormats } from '../../../../../../../plugins/data/public';

const dateRangeTitle = i18n.translate('common.ui.aggTypes.buckets.dateRangeTitle', {
const dateRangeTitle = i18n.translate('data.search.aggs.buckets.dateRangeTitle', {
defaultMessage: 'Date Range',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { i18n } from '@kbn/i18n';
import { BucketAggType } from './_bucket_agg_type';
import { BUCKET_TYPES } from './bucket_agg_types';

const filterTitle = i18n.translate('common.ui.aggTypes.buckets.filterTitle', {
const filterTitle = i18n.translate('data.search.aggs.buckets.filterTitle', {
defaultMessage: 'Filter',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { BUCKET_TYPES } from './bucket_agg_types';
const config = chrome.getUiSettingsClient();
const storage = new Storage(window.localStorage);

const filtersTitle = i18n.translate('common.ui.aggTypes.buckets.filtersTitle', {
const filtersTitle = i18n.translate('data.search.aggs.buckets.filtersTitle', {
defaultMessage: 'Filters',
description:
'The name of an aggregation, that allows to specify multiple individual filters to group data by.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function getPrecision(val: string) {
const isOutsideCollar = (bounds: GeoBoundingBox, collar: MapCollar) =>
bounds && collar && !geoContains(collar, bounds);

const geohashGridTitle = i18n.translate('common.ui.aggTypes.buckets.geohashGridTitle', {
const geohashGridTitle = i18n.translate('data.search.aggs.buckets.geohashGridTitle', {
defaultMessage: 'Geohash',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public';
import { IBucketAggConfig } from './_bucket_agg_type';
import { METRIC_TYPES } from '../metrics/metric_agg_types';

const geotileGridTitle = i18n.translate('common.ui.aggTypes.buckets.geotileGridTitle', {
const geotileGridTitle = i18n.translate('data.search.aggs.buckets.geotileGridTitle', {
defaultMessage: 'Geotile',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const getUIConfig = () => npStart.core.uiSettings;

export const histogramBucketAgg = new BucketAggType<IBucketHistogramAggConfig>({
name: BUCKET_TYPES.HISTOGRAM,
title: i18n.translate('common.ui.aggTypes.buckets.histogramTitle', {
title: i18n.translate('data.search.aggs.buckets.histogramTitle', {
defaultMessage: 'Histogram',
}),
ordered: {},
Expand Down Expand Up @@ -117,7 +117,7 @@ export const histogramBucketAgg = new BucketAggType<IBucketHistogramAggConfig>({
.catch((e: Error) => {
if (e.name === 'AbortError') return;
toastNotifications.addWarning(
i18n.translate('common.ui.aggTypes.histogram.missingMaxMinValuesWarning', {
i18n.translate('data.search.aggs.histogram.missingMaxMinValuesWarning', {
defaultMessage:
'Unable to retrieve max and min values to auto-scale histogram buckets. This may lead to poor visualization performance.',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { BUCKET_TYPES } from './bucket_agg_types';
import { createFilterIpRange } from './create_filter/ip_range';
import { KBN_FIELD_TYPES, fieldFormats } from '../../../../../../../plugins/data/public';

const ipRangeTitle = i18n.translate('common.ui.aggTypes.buckets.ipRangeTitle', {
const ipRangeTitle = i18n.translate('data.search.aggs.buckets.ipRangeTitle', {
defaultMessage: 'IPv4 Range',
});

Expand Down Expand Up @@ -57,7 +57,7 @@ export const ipRangeBucketAgg = new BucketAggType({
return new IpRangeFormat();
},
makeLabel(aggConfig) {
return i18n.translate('common.ui.aggTypes.buckets.ipRangeLabel', {
return i18n.translate('data.search.aggs.buckets.ipRangeLabel', {
defaultMessage: '{fieldName} IP ranges',
values: {
fieldName: aggConfig.getFieldDisplayName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { BUCKET_TYPES } from './bucket_agg_types';
const keyCaches = new WeakMap();
const formats = new WeakMap();

const rangeTitle = i18n.translate('common.ui.aggTypes.buckets.rangeTitle', {
const rangeTitle = i18n.translate('data.search.aggs.buckets.rangeTitle', {
defaultMessage: 'Range',
});

Expand All @@ -36,7 +36,7 @@ export const rangeBucketAgg = new BucketAggType({
title: rangeTitle,
createFilter: createFilterRange,
makeLabel(aggConfig) {
return i18n.translate('common.ui.aggTypes.buckets.rangesLabel', {
return i18n.translate('data.search.aggs.aggTypesLabel', {
defaultMessage: '{fieldName} ranges',
values: {
fieldName: aggConfig.getFieldDisplayName(),
Expand Down Expand Up @@ -69,7 +69,7 @@ export const rangeBucketAgg = new BucketAggType({
const format = agg.fieldOwnFormatter();
const gte = '\u2265';
const lt = '\u003c';
return i18n.translate('common.ui.aggTypes.buckets.ranges.rangesFormatMessage', {
return i18n.translate('data.search.aggs.aggTypes.rangesFormatMessage', {
defaultMessage: '{gte} {from} and {lt} {to}',
values: {
gte,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import { isStringType, migrateIncludeExcludeFormat } from './migrate_include_exc
import { BUCKET_TYPES } from './bucket_agg_types';
import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public';

const significantTermsTitle = i18n.translate('common.ui.aggTypes.buckets.significantTermsTitle', {
const significantTermsTitle = i18n.translate('data.search.aggs.buckets.significantTermsTitle', {
defaultMessage: 'Significant Terms',
});

export const significantTermsBucketAgg = new BucketAggType({
name: BUCKET_TYPES.SIGNIFICANT_TERMS,
title: significantTermsTitle,
makeLabel(aggConfig) {
return i18n.translate('common.ui.aggTypes.buckets.significantTermsLabel', {
return i18n.translate('data.search.aggs.buckets.significantTermsLabel', {
defaultMessage: 'Top {size} unusual terms in {fieldName}',
values: {
size: aggConfig.params.size,
Expand All @@ -54,7 +54,7 @@ export const significantTermsBucketAgg = new BucketAggType({
},
{
name: 'exclude',
displayName: i18n.translate('common.ui.aggTypes.buckets.significantTerms.excludeLabel', {
displayName: i18n.translate('data.search.aggs.buckets.significantTerms.excludeLabel', {
defaultMessage: 'Exclude',
}),
type: 'string',
Expand All @@ -64,7 +64,7 @@ export const significantTermsBucketAgg = new BucketAggType({
},
{
name: 'include',
displayName: i18n.translate('common.ui.aggTypes.buckets.significantTerms.includeLabel', {
displayName: i18n.translate('data.search.aggs.buckets.significantTerms.includeLabel', {
defaultMessage: 'Include',
}),
type: 'string',
Expand Down
22 changes: 11 additions & 11 deletions src/legacy/core_plugins/data/public/search/aggs/buckets/terms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const [orderAggSchema] = new Schemas([
},
]).all;

const termsTitle = i18n.translate('common.ui.aggTypes.buckets.termsTitle', {
const termsTitle = i18n.translate('data.search.aggs.buckets.termsTitle', {
defaultMessage: 'Terms',
});

Expand Down Expand Up @@ -114,11 +114,11 @@ export const termsBucketAgg = new BucketAggType({
nestedSearchSource.setField('aggs', filterAgg);

const request = inspectorAdapters.requests.start(
i18n.translate('common.ui.aggTypes.buckets.terms.otherBucketTitle', {
i18n.translate('data.search.aggs.buckets.terms.otherBucketTitle', {
defaultMessage: 'Other bucket',
}),
{
description: i18n.translate('common.ui.aggTypes.buckets.terms.otherBucketDescription', {
description: i18n.translate('data.search.aggs.buckets.terms.otherBucketDescription', {
defaultMessage:
'This request counts the number of documents that fall ' +
'outside the criterion of the data buckets.',
Expand Down Expand Up @@ -213,13 +213,13 @@ export const termsBucketAgg = new BucketAggType({
default: 'desc',
options: [
{
text: i18n.translate('common.ui.aggTypes.buckets.terms.orderDescendingTitle', {
text: i18n.translate('data.search.aggs.buckets.terms.orderDescendingTitle', {
defaultMessage: 'Descending',
}),
value: 'desc',
},
{
text: i18n.translate('common.ui.aggTypes.buckets.terms.orderAscendingTitle', {
text: i18n.translate('data.search.aggs.buckets.terms.orderAscendingTitle', {
defaultMessage: 'Ascending',
}),
value: 'asc',
Expand All @@ -239,10 +239,10 @@ export const termsBucketAgg = new BucketAggType({
{
name: 'otherBucketLabel',
type: 'string',
default: i18n.translate('common.ui.aggTypes.buckets.terms.otherBucketLabel', {
default: i18n.translate('data.search.aggs.buckets.terms.otherBucketLabel', {
defaultMessage: 'Other',
}),
displayName: i18n.translate('common.ui.aggTypes.otherBucket.labelForOtherBucketLabel', {
displayName: i18n.translate('data.search.aggs.otherBucket.labelForOtherBucketLabel', {
defaultMessage: 'Label for other bucket',
}),
shouldShow: agg => agg.getParam('otherBucket'),
Expand All @@ -255,21 +255,21 @@ export const termsBucketAgg = new BucketAggType({
},
{
name: 'missingBucketLabel',
default: i18n.translate('common.ui.aggTypes.buckets.terms.missingBucketLabel', {
default: i18n.translate('data.search.aggs.buckets.terms.missingBucketLabel', {
defaultMessage: 'Missing',
description: `Default label used in charts when documents are missing a field.
Visible when you create a chart with a terms aggregation and enable "Show missing values"`,
}),
type: 'string',
displayName: i18n.translate('common.ui.aggTypes.otherBucket.labelForMissingValuesLabel', {
displayName: i18n.translate('data.search.aggs.otherBucket.labelForMissingValuesLabel', {
defaultMessage: 'Label for missing values',
}),
shouldShow: agg => agg.getParam('missingBucket'),
write: noop,
},
{
name: 'exclude',
displayName: i18n.translate('common.ui.aggTypes.buckets.terms.excludeLabel', {
displayName: i18n.translate('data.search.aggs.buckets.terms.excludeLabel', {
defaultMessage: 'Exclude',
}),
type: 'string',
Expand All @@ -279,7 +279,7 @@ export const termsBucketAgg = new BucketAggType({
},
{
name: 'include',
displayName: i18n.translate('common.ui.aggTypes.buckets.terms.includeLabel', {
displayName: i18n.translate('data.search.aggs.buckets.terms.includeLabel', {
defaultMessage: 'Include',
}),
type: 'string',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import { MetricAggType } from './metric_agg_type';
import { METRIC_TYPES } from './metric_agg_types';
import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public';

const averageTitle = i18n.translate('common.ui.aggTypes.metrics.averageTitle', {
const averageTitle = i18n.translate('data.search.aggs.metrics.averageTitle', {
defaultMessage: 'Average',
});

export const avgMetricAgg = new MetricAggType({
name: METRIC_TYPES.AVG,
title: averageTitle,
makeLabel: aggConfig => {
return i18n.translate('common.ui.aggTypes.metrics.averageLabel', {
return i18n.translate('data.search.aggs.metrics.averageLabel', {
defaultMessage: 'Average {field}',
values: { field: aggConfig.getFieldDisplayName() },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import { makeNestedLabel } from './lib/make_nested_label';
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
import { METRIC_TYPES } from './metric_agg_types';

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

const averageBucketTitle = i18n.translate('common.ui.aggTypes.metrics.averageBucketTitle', {
const averageBucketTitle = i18n.translate('data.search.aggs.metrics.averageBucketTitle', {
defaultMessage: 'Average Bucket',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import { makeNestedLabel } from './lib/make_nested_label';
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
import { METRIC_TYPES } from './metric_agg_types';

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

const maxBucketTitle = i18n.translate('common.ui.aggTypes.metrics.maxBucketTitle', {
const maxBucketTitle = i18n.translate('data.search.aggs.metrics.maxBucketTitle', {
defaultMessage: 'Max Bucket',
});

Expand Down
Loading

0 comments on commit dbec747

Please sign in to comment.