changeset 495:73cf57f641a7

CheckTranslation action: added original page diff link.
author Eugene Syromyatnikov <evgsyr@gmail.com>
date Mon, 08 Feb 2010 06:05:09 +0300
parents 1294c1c0ec56
children a4e59a30d352
files data/plugin/action/CheckTranslation.py
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/CheckTranslation.py	Fri Feb 05 10:13:01 2010 +0100
+++ b/data/plugin/action/CheckTranslation.py	Mon Feb 08 06:05:09 2010 +0300
@@ -11,7 +11,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import re, time
+import re, time, calendar
 from MoinMoin import i18n, search
 from MoinMoin.i18n import strings
 i18n.strings = strings
@@ -149,9 +149,13 @@
                         trans_status.append(_('/!\\ ##master-revision special comment can\'t be parsed. Value of special comment: "%s". Please use correct revision number.', wiki=True) % request.formatter.text(master_rev))
                     else:
                         if rev_num < orig_page_rev and translation_warnings['outdated_master_rev']:
-                            trans_status.append(_('(!) Translated page is outdated: it is based on revision %(trans_rev)s, but original page has revision %(orig_rev)s.', wiki=True) % {
+                            trans_status.append(_('(!) Translated page is outdated: it is based on revision %(trans_rev)s, but original page has revision %(orig_rev)s. %(diff_link)s.', wiki=True) % {
                                 'orig_rev': request.formatter.text(orig_page_rev),
                                 'trans_rev': request.formatter.text(master_rev),
+                                'diff_link': orig_page.link_to(request, on=1, querystr={
+                                    'action': 'diff',
+                                    'rev1': request.formatter.text(master_rev),
+                                    }) + request.formatter.text(_("Diff of original page")) + orig_page.link_to(request, on=0),
                             })
 
                 if 'date' in master_metas and translation_warnings['outdated_master_date']:
@@ -170,9 +174,13 @@
                         orig_date_s = time.strftime('%Y-%m-%d %H:%M:%S', orig_date)
 
                         if master_date < orig_date:
-                            trans_status.append(_('(!) Translated page is outdated: it has master date %(master_date)s, but original page last edited at %(orig_date)s.', wiki=True) % {
+                            trans_status.append(_('(!) Translated page is outdated: it has master date %(master_date)s, but original page last edited at %(orig_date)s. %(diff_link)s.', wiki=True) % {
                                 'orig_date': request.formatter.text(orig_date_s),
                                 'master_date': request.formatter.text(time.strftime('%Y-%m-%d %H:%M:%S', master_date)),
+                                'diff_link': orig_page.link_to(request, on=1, querystr={
+                                    'action': 'diff',
+                                    'date': (calendar.timegm(master_date) * 1000000),
+                                    }) + request.formatter.text(_("Diff of original page")) + orig_page.link_to(request, on=0),
                             })
 
         data.addRow(("<br>".join(orig_status), "<br>".join(trans_status)))