ERGO1995 commented on PR #31646:
URL: https://github.com/apache/superset/pull/31646#issuecomment-2580730614

   > Running CI, but it doesn't look happy so far.
   > 
   > Regarding translations for "dynamic content" (chart titles, dashboard 
titles, column names, dataset names, etc., etc.) there hasn't yet been a SIP 
around this. It's been talked about, but nothing formalized. Some people want 
to do it with automated API based workflows, some want to just have a 
translations table that uses UUIDs for all assets as a reference, some want to 
commingle it with the current translation files/build process. Unclear if it 
should be tied to any new UI, or if the process is "invisible". If you have 
ideas, contributions/discussion would be welcomed.
   
   @rusackas I tested this modification in charts.jsx:
   
   ```
   updateSliceName={t(props.updateSliceName)}
   sliceName={t(props.sliceName)}
   ```
   
   Then, I created a file 
superset/superset-frontend/src/dashboard/customTrads.ts like this:
   ```
   import { t } from '@superset-ui/core';
   
   // List of translatable titles
   t('Production turnover');
   t('Production cost');
   ```
   
   Next, I executed the following commands in the backend container:
   ```
   pybabel extract -F superset/translations/babel.cfg -k _ -k __ -k t -k tn -k 
tct -o superset/translations/messages.pot .
   pybabel update -i superset/translations/messages.pot -d superset/translations
   ```
   
   Afterward, I recompiled the translations in both the backend and frontend, 
as the chart titles in the dashboards rely on the messages.json file. Now, when 
selecting the language, the translations I configured in messages.po are 
correctly applied once extracted.
   
   I'm not sure if this is the best approach, but with minimal changes to the 
existing code and using a custom file, it seems to achieve the desired outcome.


-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to