diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml index 4dea0975eaf5a62ca64be5c4c5fd514b846d0986..7eca01b4c33cc72cb20ebef0c321b42eddb7bc46 100644 --- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml +++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml @@ -52,14 +52,14 @@ <key> <string>_body</string> </key> <value> <string encoding="cdata"><![CDATA[ -import DateTime\n if not date:\n - return date\n + return \'\'\n try:\n - now = DateTime.DateTime(DateTime.now())\n - date = DateTime.DateTime(date)\n -except :\n - return date \n + now = DateTime()\n + date = DateTime(date)\n +except:\n + return \'\' \n +Base_translateString = context.Base_translateString\n diff = now - date\n if diff < 1:\n hours = diff*24.0\n @@ -68,24 +68,24 @@ if diff < 1:\n if minutes < 1:\n seconds = minutes*60.0\n if seconds < 1:\n - return \'Now\'\n + return Base_translateString(\'Now\')\n if 2 > seconds > 1: \n - return str(int(seconds)) +\' second ago\'\n - return str(int(seconds)) +\' seconds ago\' \n + return Base_translateString(\'${timedif} second ago\', mapping={\'timedif\':int(seconds)})\n + return Base_translateString(\'${timedif} seconds ago\', mapping={\'timedif\':int(seconds)})\n if 2 > minutes > 1:\n - return str(int(minutes)) +\' minute ago\' \n - return str(int(minutes)) +\' minutes ago\' \n + return Base_translateString(\'${timedif} minute ago\', mapping={\'timedif\':int(minutes)})\n + return Base_translateString(\'${timedif} minutes ago\', mapping={\'timedif\':int(minutes)})\n if 2 > hours > 1:\n - return str(int(hours)) +\' hour ago\' \n - return str(int(hours)) +\' hours ago\'\n + return Base_translateString(\'${timedif} hour ago\', mapping={\'timedif\':int(hours)})\n + return Base_translateString(\'${timedif} hours ago\', mapping={\'timedif\':int(hours)})\n else:\n if diff > 365.25:\n - return \'More than 1 year\'\n + return Base_translateString(\'More than 1 year\')\n elif diff > 30:\n - return \'More than 1 month\'\n + return Base_translateString(\'More than 1 month\')\n elif 2 > diff > 1:\n - return \'Yesterday\'\n - return str(int(diff))+\' days ago\'\n + return Base_translateString(\'Yesterday\')\n + return Base_translateString(\'${timedif} days ago\', mapping={\'timedif\':int(diff)})\n ]]></string> </value> diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision index 3935a99d8f1a36593717061ef1b86a24f93467c4..14e963ae25a763ee1f1d13138a5a7ef66f0e8194 100644 --- a/bt5/erp5_base/bt/revision +++ b/bt5/erp5_base/bt/revision @@ -1 +1 @@ -974 \ No newline at end of file +975 \ No newline at end of file