diff --git a/.i18nrc.json b/.i18nrc.json index 915d9845560fb..650182830796f 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -28,6 +28,7 @@ "xpack.idxMgmt": "x-pack/plugins/index_management", "xpack.indexLifecycleMgmt": "x-pack/plugins/index_lifecycle_management", "xpack.infra": "x-pack/plugins/infra", + "xpack.kueryAutocomplete": "x-pack/plugins/kuery_autocomplete", "xpack.licenseMgmt": "x-pack/plugins/license_management", "xpack.ml": "x-pack/plugins/ml", "xpack.logstash": "x-pack/plugins/logstash", diff --git a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/conjunction.js b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/conjunction.js index 8aa64c13cb956..d9a98a4666d29 100644 --- a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/conjunction.js +++ b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/conjunction.js @@ -4,11 +4,36 @@ * you may not use this file except in compliance with the Elastic License. */ +import { i18n } from '@kbn/i18n'; + const type = 'conjunction'; +const bothArgumentsText = i18n.translate('xpack.kueryAutocomplete.andOperatorDescription.bothArgumentsText', { + defaultMessage: 'both arguments', + description: 'Part of xpack.kueryAutocomplete.andOperatorDescription. Full text: "Requires both arguments to be true"' +}); +const oneOrMoreArgumentsText = i18n.translate('xpack.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText', { + defaultMessage: 'one or more arguments', + description: 'Part of xpack.kueryAutocomplete.orOperatorDescription. Full text: "Requires one or more arguments to be true"' +}); + const conjunctions = { - and: `

Requires both arguments to be true

`, - or: `

Requires one or more arguments to be true

` + and: '

' + + i18n.translate('xpack.kueryAutocomplete.andOperatorDescription', { + defaultMessage: 'Requires {bothArguments} to be true', + values: { bothArguments: `${bothArgumentsText}` }, + description: 'Full text: "Requires both arguments to be true". See ' + + 'xpack.kueryAutocomplete.andOperatorDescription.bothArgumentsText for "both arguments" part.' + }) + + '

', + or: '

' + + i18n.translate('xpack.kueryAutocomplete.orOperatorDescription', { + defaultMessage: 'Requires {oneOrMoreArguments} to be true', + values: { oneOrMoreArguments: `${oneOrMoreArgumentsText}` }, + description: 'Full text: "Requires one or more arguments to be true". See ' + + 'xpack.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText for "one or more arguments" part.' + }) + + '

' }; function getDescription(conjunction) { diff --git a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/field.js b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/field.js index 7a96fd6baa945..762ab51324668 100644 --- a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/field.js +++ b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/field.js @@ -8,12 +8,18 @@ import { escape, flatten } from 'lodash'; import { escapeKuery } from './escape_kuery'; import { sortPrefixFirst } from 'ui/utils/sort_prefix_first'; import { isFilterable } from 'ui/index_patterns/static_utils'; +import { i18n } from '@kbn/i18n'; const type = 'field'; function getDescription(fieldName) { - return `

Filter results that contain ${escape(fieldName)}

`; + return '

' + + i18n.translate('xpack.kueryAutocomplete.filterResultsDescription', { + defaultMessage: 'Filter results that contain {fieldName}', + values: { fieldName: `${escape(fieldName)}` } + }) + + '

'; } export function getSuggestionsProvider({ indexPatterns }) { diff --git a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/operator.js b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/operator.js index c5301e7e783e4..76139e4e76728 100644 --- a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/operator.js +++ b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/operator.js @@ -4,32 +4,89 @@ * you may not use this file except in compliance with the Elastic License. */ +import { i18n } from '@kbn/i18n'; + import { flatten } from 'lodash'; const type = 'operator'; +const equalsText = i18n.translate('xpack.kueryAutocomplete.equalOperatorDescription.equalsText', { + defaultMessage: 'equals', + description: 'Part of xpack.kueryAutocomplete.equalOperatorDescription. Full text: "equals some value"' +}); +const lessThanOrEqualToText = i18n.translate('xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText', { + defaultMessage: 'less than or equal to', + description: 'Part of xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription. Full text: "is less than or equal to some value"' +}); +const greaterThanOrEqualToText = i18n.translate('xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText', { + defaultMessage: 'greater than or equal to', + description: 'Part of xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription. Full text: "is greater than or equal to some value"' +}); +const lessThanText = i18n.translate('xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText', { + defaultMessage: 'less than', + description: 'Part of xpack.kueryAutocomplete.lessThanOperatorDescription. Full text: "is less than some value"' +}); +const greaterThanText = i18n.translate('xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText', { + defaultMessage: 'greater than', + description: 'Part of xpack.kueryAutocomplete.greaterThanOperatorDescription. Full text: "is greater than some value"' +}); +const existsText = i18n.translate('xpack.kueryAutocomplete.existOperatorDescription.existsText', { + defaultMessage: 'exists', + description: 'Part of xpack.kueryAutocomplete.existOperatorDescription. Full text: "exists in any form"' +}); + const operators = { ':': { - description: 'equals some value', + description: i18n.translate('xpack.kueryAutocomplete.equalOperatorDescription', { + defaultMessage: '{equals} some value', + values: { equals: `${equalsText}` }, + description: 'Full text: "equals some value". See ' + + 'xpack.kueryAutocomplete.equalOperatorDescription.equalsText for "equals" part.' + }), fieldTypes: ['string', 'number', 'date', 'ip', 'geo_point', 'geo_shape', 'boolean'] }, '<=': { - description: 'is less than or equal to some value', + description: i18n.translate('xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription', { + defaultMessage: 'is {lessThanOrEqualTo} some value', + values: { lessThanOrEqualTo: `${lessThanOrEqualToText}` }, + description: 'Full text: "is less than or equal to some value". See ' + + 'xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText for "less than or equal to" part.' + }), fieldTypes: ['number', 'date', 'ip'] }, '>=': { - description: 'is greater than or equal to to some value', + description: i18n.translate('xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription', { + defaultMessage: 'is {greaterThanOrEqualTo} some value', + values: { greaterThanOrEqualTo: `${greaterThanOrEqualToText}` }, + description: 'Full text: "is greater than or equal to some value". See ' + + 'xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText for "greater than or equal to" part.' + }), fieldTypes: ['number', 'date', 'ip'] }, '<': { - description: 'is less than some value', + description: i18n.translate('xpack.kueryAutocomplete.lessThanOperatorDescription', { + defaultMessage: 'is {lessThan} some value', + values: { lessThan: `${lessThanText}` }, + description: 'Full text: "is less than some value". See ' + + 'xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText for "less than" part.' + }), fieldTypes: ['number', 'date', 'ip'] }, '>': { - description: 'is greater than some value', + description: i18n.translate('xpack.kueryAutocomplete.greaterThanOperatorDescription', { + defaultMessage: 'is {greaterThan} some value', + values: { greaterThan: `${greaterThanText}` }, + description: 'Full text: "is greater than some value". See ' + + 'xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText for "greater than" part.' + }), fieldTypes: ['number', 'date', 'ip'] }, ':*': { - description: 'exists in any form' + description: i18n.translate('xpack.kueryAutocomplete.existOperatorDescription', { + defaultMessage: '{exists} in any form', + values: { exists: `${existsText}` }, + description: 'Full text: "exists in any form". See ' + + 'xpack.kueryAutocomplete.existOperatorDescription.existsText for "exists" part.' + }) }, };