mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[i18n] Translate kuery_autocomplete (#29162)
* Translate kuery_autocomplete * Resolve review comments
This commit is contained in:
parent
8d41746ce8
commit
905ea526b2
4 changed files with 98 additions and 9 deletions
|
@ -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",
|
||||
|
|
|
@ -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: `<p>Requires <span class="suggestionItem__callout">both arguments</span> to be true</p>`,
|
||||
or: `<p>Requires <span class="suggestionItem__callout">one or more arguments</span> to be true</p>`
|
||||
and: '<p>' +
|
||||
i18n.translate('xpack.kueryAutocomplete.andOperatorDescription', {
|
||||
defaultMessage: 'Requires {bothArguments} to be true',
|
||||
values: { bothArguments: `<span class="suggestionItem__callout">${bothArgumentsText}</span>` },
|
||||
description: 'Full text: "Requires both arguments to be true". See ' +
|
||||
'xpack.kueryAutocomplete.andOperatorDescription.bothArgumentsText for "both arguments" part.'
|
||||
}) +
|
||||
'</p>',
|
||||
or: '<p>' +
|
||||
i18n.translate('xpack.kueryAutocomplete.orOperatorDescription', {
|
||||
defaultMessage: 'Requires {oneOrMoreArguments} to be true',
|
||||
values: { oneOrMoreArguments: `<span class="suggestionItem__callout">${oneOrMoreArgumentsText}</span>` },
|
||||
description: 'Full text: "Requires one or more arguments to be true". See ' +
|
||||
'xpack.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText for "one or more arguments" part.'
|
||||
}) +
|
||||
'</p>'
|
||||
};
|
||||
|
||||
function getDescription(conjunction) {
|
||||
|
|
|
@ -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 `<p>Filter results that contain <span class="suggestionItem__callout">${escape(fieldName)}</span></p>`;
|
||||
return '<p>' +
|
||||
i18n.translate('xpack.kueryAutocomplete.filterResultsDescription', {
|
||||
defaultMessage: 'Filter results that contain {fieldName}',
|
||||
values: { fieldName: `<span class="suggestionItem__callout">${escape(fieldName)}</span>` }
|
||||
}) +
|
||||
'</p>';
|
||||
}
|
||||
|
||||
export function getSuggestionsProvider({ indexPatterns }) {
|
||||
|
|
|
@ -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: '<span class="suggestionItem__callout">equals</span> some value',
|
||||
description: i18n.translate('xpack.kueryAutocomplete.equalOperatorDescription', {
|
||||
defaultMessage: '{equals} some value',
|
||||
values: { equals: `<span class="suggestionItem__callout">${equalsText}</span>` },
|
||||
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 <span class="suggestionItem__callout">less than or equal to</span> some value',
|
||||
description: i18n.translate('xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription', {
|
||||
defaultMessage: 'is {lessThanOrEqualTo} some value',
|
||||
values: { lessThanOrEqualTo: `<span class="suggestionItem__callout">${lessThanOrEqualToText}</span>` },
|
||||
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 <span class="suggestionItem__callout">greater than or equal to</span> to some value',
|
||||
description: i18n.translate('xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription', {
|
||||
defaultMessage: 'is {greaterThanOrEqualTo} some value',
|
||||
values: { greaterThanOrEqualTo: `<span class="suggestionItem__callout">${greaterThanOrEqualToText}</span>` },
|
||||
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 <span class="suggestionItem__callout">less than</span> some value',
|
||||
description: i18n.translate('xpack.kueryAutocomplete.lessThanOperatorDescription', {
|
||||
defaultMessage: 'is {lessThan} some value',
|
||||
values: { lessThan: `<span class="suggestionItem__callout">${lessThanText}</span>` },
|
||||
description: 'Full text: "is less than some value". See ' +
|
||||
'xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText for "less than" part.'
|
||||
}),
|
||||
fieldTypes: ['number', 'date', 'ip']
|
||||
},
|
||||
'>': {
|
||||
description: 'is <span class="suggestionItem__callout">greater than</span> some value',
|
||||
description: i18n.translate('xpack.kueryAutocomplete.greaterThanOperatorDescription', {
|
||||
defaultMessage: 'is {greaterThan} some value',
|
||||
values: { greaterThan: `<span class="suggestionItem__callout">${greaterThanText}</span>` },
|
||||
description: 'Full text: "is greater than some value". See ' +
|
||||
'xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText for "greater than" part.'
|
||||
}),
|
||||
fieldTypes: ['number', 'date', 'ip']
|
||||
},
|
||||
':*': {
|
||||
description: '<span class="suggestionItem__callout">exists</span> in any form'
|
||||
description: i18n.translate('xpack.kueryAutocomplete.existOperatorDescription', {
|
||||
defaultMessage: '{exists} in any form',
|
||||
values: { exists: `<span class="suggestionItem__callout">${existsText}</span>` },
|
||||
description: 'Full text: "exists in any form". See ' +
|
||||
'xpack.kueryAutocomplete.existOperatorDescription.existsText for "exists" part.'
|
||||
})
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue