pomegranited commented on code in PR #31751:
URL: https://github.com/apache/superset/pull/31751#discussion_r1919428395


##########
superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx:
##########
@@ -123,10 +127,22 @@ function Echart(
     getEchartInstance: () => chartRef.current,
   }));
 
+  const localeObj = useSelector(
+    (state: ExplorePageState) => state?.common?.locale ?? 'en',
+  );
+  try {
+    const lang = require(
+      `echarts/lib/i18n/lang/${localeObj.toUpperCase()}`,
+    ).default;
+    echarts.registerLocale(localeObj.toUpperCase(), lang);
+  } catch (e) {
+    console.warn(`Locale ${localeObj} not supported in ECharts`);
+  }
+
   useEffect(() => {
     if (!divRef.current) return;
     if (!chartRef.current) {
-      chartRef.current = init(divRef.current);
+      chartRef.current = init(divRef.current, undefined, { locale: localeObj 
});

Review Comment:
   Thank you @jpchev , those look great :) I don't have access to merge this, 
but will leave my review to support it.
   
   Here's some guidance @rusackas gave me on debugging the pre-commit checks 
that are failing here too: 
https://github.com/apache/superset/pull/31692#issuecomment-2569817382



-- 
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]

Reply via email to