changeset 368:f31618787bec

action.CheckTranslation: optional parameter language added
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 19 Apr 2009 10:19:02 +0200
parents cee1e71502a7
children 95269fc6bc51
files data/plugin/action/CheckTranslation.py
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/CheckTranslation.py	Sat Apr 18 20:10:12 2009 +0200
+++ b/data/plugin/action/CheckTranslation.py	Sun Apr 19 10:19:02 2009 +0200
@@ -3,7 +3,7 @@
     MoinMoin - CheckTranslation.py
 
     shows a table of System Pages and their translations to the users language
-    if the user lang is anything else than en
+    if the users language is anything else than en
 
     @copyright: 2009 MoinMoin:ReimarBauer
     @license: GNU GPL, see COPYING for details.
@@ -14,7 +14,11 @@
 from MoinMoin.util.dataset import TupleDataset, Column
 from MoinMoin.widget.browser import DataBrowserWidget
 
-
+def lang_select():
+    """ Create language selection. """
+    from MoinMoin import i18n
+    return i18n.wikiLanguages().keys()
+            
 def execute(pagename, request):
     _ = request.getText
 
@@ -26,13 +30,16 @@
 
     SystemPages = getattr(strings, selection)
 
-    users_lang = request.user.valid and request.user.language or 'en'
-    if users_lang == "en":
-        msg = _("Please select an other language than english in your settings for this action")
+    users_lang = request.values.get('language') or (request.user.valid and request.user.language) or 'en'
+    if users_lang == "en" or users_lang not in lang_select():
+        msg = _("Please select an other language than english in your settings for this action (%s)" % ' '.join(lang_select()))
         request.theme.add_msg(msg, "err")
         Page(request, pagename).send_page()
         return
 
+    request.lang = users_lang
+    _ = request.getText # translation mapping needs to be refreshed
+
     data = TupleDataset()
     data.columns = [
            Column('en', label=_('Developer language')),
@@ -71,7 +78,7 @@
     table.setData(data)
 
     msg = ''.join(table.format(method='GET'))
-    msg = "Help pages and their translations of selection: <b>%s</b> %s" % (selection, msg)
+    msg = 'Help pages and their translations to "%s" of selection: "%s" %s' % (users_lang, selection, msg)
     if msg:
         request.theme.add_msg(msg, "info")
     Page(request, pagename).send_page()