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: [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