artemonsh opened a new issue, #21783: URL: https://github.com/apache/superset/issues/21783
When trying to use AGGREGATION FUNCTIONS like _Sum_ or _Sample Variance_ for chart Pivot Table v2 (or v1), one cannot translate them simply in .po and .json files, because an error occures.  #### How to reproduce the bug 0. Add translation for one of the aggregation functions and change the locale 1. Go to 'Charts' 2. Click on 'Pivot Chart v2' 3. Scroll down to 'Options' 4. Choose any translated option  ### Expected results I want to have an opportunity to translate the name of the aggregation functions. ### Actual results Simple translation causes an error. ### Environment (please complete the following information): - browser type and version: chrome - superset version: `2.0.0` - python version: `python 3.8` - node.js version: `node 16` - any feature flags active: ### Checklist Make sure to follow these steps before submitting your issue - thank you! - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [x] I have reproduced the issue with at least the latest released version of superset. - [x] I have checked the issue tracker for the same issue and I haven't found one similar. ### Additional context This issue is partly similar to https://github.com/apache/superset/pull/20080, but in that issue the issue with no table rendering was not raised. ### Suggestions I suggest to change variable aggregatorsFactory in the file superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx The function looks like this: ``` const aggregatorsFactory = (formatter: NumberFormatter) => ({ 'List Unique Values': aggregatorTemplates.listUnique(', ', formatter), Sum: aggregatorTemplates.sum(formatter) } ``` while it should look like this: ``` const aggregatorsFactory = (formatter: NumberFormatter) => ({ t('List Unique Values'): aggregatorTemplates.listUnique(', ', formatter), t('Sum'): aggregatorTemplates.sum(formatter) } ``` I know that it is impossible to use function result as the key for the object, but due to the lack of knowledge I cannot suggest a good way to replace keys of this object. Another suggestion is to change formatSelectOptions() function to accept both value and label, now it accepts only one value (both for value and label) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
