|
4 | 4 | * you may not use this file except in compliance with the Elastic License. |
5 | 5 | */ |
6 | 6 |
|
| 7 | +import { i18n } from '@kbn/i18n'; |
| 8 | + |
7 | 9 | import { flatten } from 'lodash'; |
8 | 10 | const type = 'operator'; |
9 | 11 |
|
| 12 | +const equalsText = i18n.translate('xpack.kueryAutocomplete.equalOperatorDescription.equalsText', { |
| 13 | + defaultMessage: 'equals', |
| 14 | + description: 'Part of xpack.kueryAutocomplete.equalOperatorDescription. Full text: "equals some value"' |
| 15 | +}); |
| 16 | +const lessThanOrEqualToText = i18n.translate('xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText', { |
| 17 | + defaultMessage: 'less than or equal to', |
| 18 | + description: 'Part of xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription. Full text: "is less than or equal to some value"' |
| 19 | +}); |
| 20 | +const greaterThanOrEqualToText = i18n.translate('xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText', { |
| 21 | + defaultMessage: 'greater than or equal to', |
| 22 | + description: 'Part of xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription. Full text: "is greater than or equal to some value"' |
| 23 | +}); |
| 24 | +const lessThanText = i18n.translate('xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText', { |
| 25 | + defaultMessage: 'less than', |
| 26 | + description: 'Part of xpack.kueryAutocomplete.lessThanOperatorDescription. Full text: "is less than some value"' |
| 27 | +}); |
| 28 | +const greaterThanText = i18n.translate('xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText', { |
| 29 | + defaultMessage: 'greater than', |
| 30 | + description: 'Part of xpack.kueryAutocomplete.greaterThanOperatorDescription. Full text: "is greater than some value"' |
| 31 | +}); |
| 32 | +const existsText = i18n.translate('xpack.kueryAutocomplete.existOperatorDescription.existsText', { |
| 33 | + defaultMessage: 'exists', |
| 34 | + description: 'Part of xpack.kueryAutocomplete.existOperatorDescription. Full text: "exists in any form"' |
| 35 | +}); |
| 36 | + |
10 | 37 | const operators = { |
11 | 38 | ':': { |
12 | | - description: '<span class="suggestionItem__callout">equals</span> some value', |
| 39 | + description: i18n.translate('xpack.kueryAutocomplete.equalOperatorDescription', { |
| 40 | + defaultMessage: '{equals} some value', |
| 41 | + values: { equals: `<span class="suggestionItem__callout">${equalsText}</span>` }, |
| 42 | + description: 'Full text: "equals some value". See ' + |
| 43 | + 'xpack.kueryAutocomplete.equalOperatorDescription.equalsText for "equals" part.' |
| 44 | + }), |
13 | 45 | fieldTypes: ['string', 'number', 'date', 'ip', 'geo_point', 'geo_shape', 'boolean'] |
14 | 46 | }, |
15 | 47 | '<=': { |
16 | | - description: 'is <span class="suggestionItem__callout">less than or equal to</span> some value', |
| 48 | + description: i18n.translate('xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription', { |
| 49 | + defaultMessage: 'is {lessThanOrEqualTo} some value', |
| 50 | + values: { lessThanOrEqualTo: `<span class="suggestionItem__callout">${lessThanOrEqualToText}</span>` }, |
| 51 | + description: 'Full text: "is less than or equal to some value". See ' + |
| 52 | + 'xpack.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText for "less than or equal to" part.' |
| 53 | + }), |
17 | 54 | fieldTypes: ['number', 'date', 'ip'] |
18 | 55 | }, |
19 | 56 | '>=': { |
20 | | - description: 'is <span class="suggestionItem__callout">greater than or equal to</span> to some value', |
| 57 | + description: i18n.translate('xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription', { |
| 58 | + defaultMessage: 'is {greaterThanOrEqualTo} some value', |
| 59 | + values: { greaterThanOrEqualTo: `<span class="suggestionItem__callout">${greaterThanOrEqualToText}</span>` }, |
| 60 | + description: 'Full text: "is greater than or equal to some value". See ' + |
| 61 | + 'xpack.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText for "greater than or equal to" part.' |
| 62 | + }), |
21 | 63 | fieldTypes: ['number', 'date', 'ip'] |
22 | 64 | }, |
23 | 65 | '<': { |
24 | | - description: 'is <span class="suggestionItem__callout">less than</span> some value', |
| 66 | + description: i18n.translate('xpack.kueryAutocomplete.lessThanOperatorDescription', { |
| 67 | + defaultMessage: 'is {lessThan} some value', |
| 68 | + values: { lessThan: `<span class="suggestionItem__callout">${lessThanText}</span>` }, |
| 69 | + description: 'Full text: "is less than some value". See ' + |
| 70 | + 'xpack.kueryAutocomplete.lessThanOperatorDescription.lessThanText for "less than" part.' |
| 71 | + }), |
25 | 72 | fieldTypes: ['number', 'date', 'ip'] |
26 | 73 | }, |
27 | 74 | '>': { |
28 | | - description: 'is <span class="suggestionItem__callout">greater than</span> some value', |
| 75 | + description: i18n.translate('xpack.kueryAutocomplete.greaterThanOperatorDescription', { |
| 76 | + defaultMessage: 'is {greaterThan} some value', |
| 77 | + values: { greaterThan: `<span class="suggestionItem__callout">${greaterThanText}</span>` }, |
| 78 | + description: 'Full text: "is greater than some value". See ' + |
| 79 | + 'xpack.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText for "greater than" part.' |
| 80 | + }), |
29 | 81 | fieldTypes: ['number', 'date', 'ip'] |
30 | 82 | }, |
31 | 83 | ':*': { |
32 | | - description: '<span class="suggestionItem__callout">exists</span> in any form' |
| 84 | + description: i18n.translate('xpack.kueryAutocomplete.existOperatorDescription', { |
| 85 | + defaultMessage: '{exists} in any form', |
| 86 | + values: { exists: `<span class="suggestionItem__callout">${existsText}</span>` }, |
| 87 | + description: 'Full text: "exists in any form". See ' + |
| 88 | + 'xpack.kueryAutocomplete.existOperatorDescription.existsText for "exists" part.' |
| 89 | + }) |
33 | 90 | }, |
34 | 91 | }; |
35 | 92 |
|
|
0 commit comments