chore: Localization of superset pt. 2 (#22772)

This commit is contained in:
Artem Shumeiko
2023-01-30 19:20:43 +03:00
committed by GitHub
parent b94052e438
commit c839d0daf5
60 changed files with 260 additions and 157 deletions

View File

@@ -19,7 +19,7 @@
import PropTypes from 'prop-types';
import { extent as d3Extent, range as d3Range } from 'd3-array';
import { select as d3Select } from 'd3-selection';
import { getSequentialSchemeRegistry } from '@superset-ui/core';
import { getSequentialSchemeRegistry, t } from '@superset-ui/core';
import CalHeatMap from './vendor/cal-heatmap';
const propTypes = {
@@ -85,10 +85,12 @@ function Calendar(element, props) {
const metricsData = data.data;
const METRIC_TEXT = t('Metric');
Object.keys(metricsData).forEach(metric => {
const calContainer = div.append('div');
if (showMetricName) {
calContainer.text(`Metric: ${verboseMap[metric] || metric}`);
calContainer.text(`${METRIC_TEXT}: ${verboseMap[metric] || metric}`);
}
const timestamps = metricsData[metric];
const extents = d3Extent(Object.keys(timestamps), key => timestamps[key]);

View File

@@ -9,7 +9,7 @@
/* eslint-disable */
import d3tip from 'd3-tip';
import { getContrastingColor } from '@superset-ui/core';
import { getContrastingColor, t } from '@superset-ui/core';
var d3 = typeof require === 'function' ? require('d3') : window.d3;
@@ -256,9 +256,9 @@ var CalHeatMap = function () {
// Formatting of the title displayed when hovering a legend cell
legendTitleFormat: {
lower: 'less than {min} {name}',
inner: 'between {down} and {up} {name}',
upper: 'more than {max} {name}',
lower: t('less than {min} {name}'),
inner: t('between {down} and {up} {name}'),
upper: t('more than {max} {name}'),
},
// Animation duration, in ms