[Lens] Fixes color mappings special tockens i18n (#168152)

## Summary

fix https://github.com/elastic/kibana/issues/168151

To test:
- create a cartesian charts with breakdowns that contains both the
`Other` group and an `(empty)` value
- apply a manual color mapping that use both these terms by select them
from the combo-box, not by typing them.
- Then change the Kibana language to a different one other than English
and see if the color mapping applies correctly.

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
Marco Vettorello 2023-10-06 11:21:41 +02:00 committed by GitHub
parent 866edd206d
commit c828ff49db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View file

@ -6,6 +6,7 @@
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import { ColorMapping } from '../config';
export function ruleMatch(
@ -41,6 +42,16 @@ export function rangeMatch(rule: ColorMapping.RuleRange, value: number) {
// TODO: move in some data/table related package
export const SPECIAL_TOKENS_STRING_CONVERTION = new Map([
['__other__', 'Other'],
['', '(empty)'],
[
'__other__',
i18n.translate('coloring.colorMapping.terms.otherBucketLabel', {
defaultMessage: 'Other',
}),
],
[
'',
i18n.translate('coloring.colorMapping.terms.emptyLabel', {
defaultMessage: '(empty)',
}),
],
]);

View file

@ -229,6 +229,8 @@
"coloring.dynamicColoring.rangeType.label": "Type de valeur",
"coloring.dynamicColoring.rangeType.number": "Numéro",
"coloring.dynamicColoring.rangeType.percent": "Pourcent",
"coloring.colorMapping.terms.otherBucketLabel": "Autre",
"coloring.colorMapping.terms.emptyLabel": "(vide)",
"console.helpPage.learnAboutConsoleAndQueryDslText": "En savoir plus sur {console} et {queryDsl}",
"console.historyPage.itemOfRequestListAriaLabel": "Requête : {historyItem}",
"console.settingsPage.refreshInterval.everyNMinutesTimeInterval": "Toutes les {value} {value, plural, one {minute} many {minutes} other {minutes}}",

View file

@ -229,6 +229,8 @@
"coloring.dynamicColoring.rangeType.label": "値型",
"coloring.dynamicColoring.rangeType.number": "数字",
"coloring.dynamicColoring.rangeType.percent": "割合(%",
"coloring.colorMapping.terms.otherBucketLabel":"その他",
"coloring.colorMapping.terms.emptyLabel": "(空)",
"console.helpPage.learnAboutConsoleAndQueryDslText": "{console}と{queryDsl}についてさらに詳しく",
"console.historyPage.itemOfRequestListAriaLabel": "リクエスト:{historyItem}",
"console.settingsPage.refreshInterval.everyNMinutesTimeInterval": "{value}{value, plural, other {分}}毎",

View file

@ -229,6 +229,8 @@
"coloring.dynamicColoring.rangeType.label": "值类型",
"coloring.dynamicColoring.rangeType.number": "数字",
"coloring.dynamicColoring.rangeType.percent": "百分比",
"coloring.colorMapping.terms.otherBucketLabel":"其他",
"coloring.colorMapping.terms.emptyLabel": "(空)",
"console.helpPage.learnAboutConsoleAndQueryDslText": "了解 {console} 和 {queryDsl}",
"console.historyPage.itemOfRequestListAriaLabel": "请求:{historyItem}",
"console.settingsPage.refreshInterval.everyNMinutesTimeInterval": "每 {value} {value, plural, other {分钟}}",