cdmikechen commented on a change in pull request #13020:
URL: https://github.com/apache/superset/pull/13020#discussion_r572917074



##########
File path: superset/models/helpers.py
##########
@@ -425,7 +425,19 @@ def changed_on_utc(self) -> str:
 
     @property
     def changed_on_humanized(self) -> str:
-        return humanize.naturaltime(datetime.now() - self.changed_on)
+        try:
+            from superset import conf
+            from flask_babel import get_locale
+            langs = conf.get("LANGUAGES", None)
+            locale = str(get_locale())
+
+            if "_" in locale:
+                humanize.i18n.activate(locale)
+            elif langs is not None:
+                humanize.i18n.activate("{}_{}".format(locale,
+                                                      
langs[locale]["flag"].upper()))

Review comment:
       @ktmud
   I've searched in superset, there is only one place where humanize is used, 
so that I think we may need not call the activate method.
   I've tested most pages and found no problems (including switching languages).




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

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