src/pyams_content/shared/site/zmi/container.py
changeset 1182 601ab27cdd59
parent 1159 fc062f9e32c0
child 1198 d8fbefa460d6
--- a/src/pyams_content/shared/site/zmi/container.py	Mon Dec 17 10:25:56 2018 +0100
+++ b/src/pyams_content/shared/site/zmi/container.py	Mon Dec 17 11:30:29 2018 +0100
@@ -92,26 +92,25 @@
             if pub_info.publication_effective_date <= now:
                 if pub_info.publication_expiration_date:
                     if pub_info.publication_effective_date > now:
-                        self.state = '<span class="text-danger">{}</span>'.format(
-                            translate(_("Retired since {}")).format(
-                                format_datetime(pub_info.publication_expiration_date)))
+                        state = _("Retired")
+                        state_label = _("{state} since {from_date}")
                     else:
-                        self.state = translate(_("Published since {} until {}")).format(
-                            format_datetime(pub_info.publication_effective_date),
-                            format_datetime(pub_info.publication_expiration_date))
+                        state = _("Published")
+                        state_label = _("{state} since {from_date} until {to_date}")
                 else:
-                    self.state = translate(_("Published since {}")).format(
-                        format_datetime(pub_info.publication_effective_date))
+                    state = _("Published")
+                    state_label = _("{state} since {from_date}")
             else:
                 if pub_info.publication_expiration_date:
-                    self.state = '<span class="text-danger">{}</span>'.format(
-                        translate(_("To be published from {} to {}")).format(
-                            format_datetime(pub_info.publication_effective_date),
-                            format_datetime(pub_info.publication_expiration_date)))
+                    state = _("To be published")
+                    state_label = _("{state} from {from_date} to {to_date}")
                 else:
-                    self.state = '<span class="text-danger">{}</span>'.format(
-                        translate(_("Published after {}")).format(
-                            format_datetime(pub_info.publication_effective_date)))
+                    state = _("Published")
+                    state_label = _("{state} after {to_date}")
+            self.state = translate(state_label).format(
+                state='<span class="text-danger">{}</span>'.format(translate(state)),
+                from_date=format_datetime(pub_info.publication_effective_date),
+                to_date=format_datetime(pub_info.publication_expiration_date))
         else:
             self.state = '<span class="text-danger">{}</span>'.format(
                 translate(_("Not published")))