rusackas commented on code in PR #34118:
URL: https://github.com/apache/superset/pull/34118#discussion_r2196887812


##########
superset-frontend/packages/superset-ui-core/src/translation/Translator.ts:
##########
@@ -86,20 +86,35 @@ export default class Translator {
   }
 
   translate(input: string, ...args: unknown[]): string {
-    return this.i18n.translate(input).fetch(...args);
+    try {
+      return this.i18n.translate(input).fetch(...args);
+    } catch (err) {
+      logging.warn(`Translation failed for key "${input}" with args:`, args);
+      logging.warn(err);
+      return input;
+    }
   }
 
   translateWithNumber(key: string, ...args: unknown[]): string {
-    const [plural, num, ...rest] = args;
-    if (typeof plural === 'number') {
+    try {
+      const [plural, num, ...rest] = args;
+      if (typeof plural === 'number') {
+        return this.i18n
+          .translate(key)
+          .ifPlural(plural, key)
+          .fetch(plural, num, ...args);

Review Comment:
   Should that be `.fetch(plural, num, ...rest)`?



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