PolinaFam commented on code in PR #34051:
URL: https://github.com/apache/superset/pull/34051#discussion_r2194766753
##########
superset/models/helpers.py:
##########
@@ -546,10 +546,28 @@ def changed_on_utc(self) -> str:
@property
def changed_on_humanized(self) -> str:
+ locale = str(get_locale() or 'en')
Review Comment:
Fixed
##########
superset/models/helpers.py:
##########
@@ -546,10 +546,28 @@ def changed_on_utc(self) -> str:
@property
def changed_on_humanized(self) -> str:
+ locale = str(get_locale() or 'en')
+ try:
+ humanize.i18n.activate(locale)
+ result = humanize.naturaltime(datetime.now() - self.changed_on)
+ humanize.i18n.deactivate()
+ return result
+ except:
+ pass
+ # Fallback to English
return humanize.naturaltime(datetime.now() - self.changed_on)
@property
def created_on_humanized(self) -> str:
+ locale = str(get_locale() or 'en')
+ try:
+ humanize.i18n.activate(locale)
+ result = humanize.naturaltime(datetime.now() - self.created_on)
+ humanize.i18n.deactivate()
+ return result
+ except:
+ pass
+ # Fallback to English
return humanize.naturaltime(datetime.now() - self.created_on)
Review Comment:
Fixed
--
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]