You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Hammoood (via GitHub)" <gi...@apache.org> on 2025/10/22 07:15:57 UTC

Re: [I] [i18n] Partial Translation in Charts - Superset 6.0.0 [superset]

Hammoood commented on issue #34751:
URL: https://github.com/apache/superset/issues/34751#issuecomment-3430792680

   hey, i have same issue :
   problem is not from backend side, superset is load translations correctly.
   it is in frontend and how to import translation function (t(''))
   all front components are get translations correct
   problem in plugins (controlPanel components), and components in packeges folder
   i try fix issue by extend translation func and use it in those component, it is worked but still there typescript issues
   it is not complete yet
   
   `
   import { t as coreT } from '@superset-ui/core';
   
   export function t(key: string, defaultValue?: string) {
     const getter = () => {
       try {
         if (typeof coreT === 'function') {
           const res = coreT(key, defaultValue);
           if (typeof res === 'string') return res;
         }
       } catch (e) {}
       return defaultValue ?? key;
     };
   
     const fn: any = () => getter();
     fn.get = getter;
     fn.toString = getter;
     fn.valueOf = getter;
     if (typeof Symbol !== 'undefined' && Symbol.toPrimitive) {
       fn[Symbol.toPrimitive] = (_hint: any) => getter();
     }
     return fn;
   }
   
   export default t;
   `


-- 
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-unsubscribe@superset.apache.org

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


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