diff MoinMoin/userprefs/prefs.py @ 3032:c242772754c5

stats macro which shows the preferred language distribution of the wiki users (Thanks to Nina Kuisma) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 03 Feb 2008 20:22:23 +0100
parents 572f8ce1adff
children a1322262398a
line wrap: on
line diff
--- a/MoinMoin/userprefs/prefs.py	Sun Feb 03 19:28:34 2008 +0100
+++ b/MoinMoin/userprefs/prefs.py	Sun Feb 03 20:22:23 2008 +0100
@@ -158,6 +158,11 @@
 
         # try to get the (optional) preferred language
         theuser.language = form.get('language', [''])[0]
+        if theuser.language == u'': # For language-statistics
+            from MoinMoin import i18n
+            theuser.real_language = i18n.get_browser_language(self.request)
+        else:
+            theuser.real_language = ''
 
         # I want to handle all inputs from user_form_fields, but
         # don't want to handle the cases that have already been coded
@@ -170,7 +175,7 @@
         already_handled = ['name', 'email',
                            'aliasname', 'edit_rows', 'editor_default',
                            'editor_ui', 'tz_offset', 'datetime_fmt',
-                           'theme_name', 'language', 'jid']
+                           'theme_name', 'language', 'real_language', 'jid']
         for field in self.cfg.user_form_fields:
             key = field[0]
             if ((key in self.cfg.user_form_disable)