changeset 3123:5cb80bd604b4

refactored _() getText calls to match new api
author Radomir Dopieralski <moindev@sheep.art.pl>
date Wed, 27 Feb 2008 00:28:28 +0100
parents a1322262398a
children 5d7582e47c50
files MoinMoin/PageGraphicalEditor.py MoinMoin/auth/__init__.py MoinMoin/auth/openidrp.py MoinMoin/events/emailnotify.py MoinMoin/events/notification.py MoinMoin/formatter/text_html.py MoinMoin/macro/Action.py MoinMoin/macro/AdvancedSearch.py MoinMoin/macro/EmbedObject.py MoinMoin/macro/FullSearch.py MoinMoin/macro/GetText.py MoinMoin/macro/SystemAdmin.py MoinMoin/macro/SystemInfo.py MoinMoin/macro/TableOfContents.py MoinMoin/macro/__init__.py MoinMoin/theme/classic.py MoinMoin/user.py MoinMoin/util/diff_html.py
diffstat 18 files changed, 46 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageGraphicalEditor.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/PageGraphicalEditor.py	Wed Feb 27 00:28:28 2008 +0100
@@ -195,7 +195,7 @@
                     loadable_draft = True
                     page_rev = rev
                     draft_timestamp_str = request.user.getFormattedDateTime(draft_timestamp)
-                    draft_message = _(u"'''<<BR>>Your draft based on revision %(draft_rev)d (saved %(draft_timestamp_str)s) can be loaded instead of the current revision %(page_rev)d by using the load draft button - in case you lost your last edit somehow without saving it.''' A draft gets saved for you when you do a preview, cancel an edit or unsuccessfully save.") % locals()
+                    draft_message = _(u"'''<<BR>>Your draft based on revision %(draft_rev)d (saved %(draft_timestamp_str)s) can be loaded instead of the current revision %(page_rev)d by using the load draft button - in case you lost your last edit somehow without saving it.''' A draft gets saved for you when you do a preview, cancel an edit or unsuccessfully save.", wiki=True, percent=True) % locals()
 
         # Setup status message
         status = [kw.get('msg', ''), conflict_msg, edit_lock_message, draft_message]
@@ -263,7 +263,7 @@
         if self.cfg.page_license_enabled:
             request.write('<p><em>', _(
 """By hitting '''%(save_button_text)s''' you put your changes under the %(license_link)s.
-If you don't want that, hit '''%(cancel_button_text)s''' to cancel your changes.""") % {
+If you don't want that, hit '''%(cancel_button_text)s''' to cancel your changes.""", wiki=True, percent=True) % {
                 'save_button_text': save_button_text,
                 'cancel_button_text': cancel_button_text,
                 'license_link': wikiutil.getLocalizedPage(request, self.cfg.page_license_page).link_to(request),
@@ -302,7 +302,7 @@
 <label for="chktrivial">%(label)s</label>
 ''' % {
           'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'],
-          'label': _("Trivial change", formatted=False),
+          'label': _("Trivial change"),
        })
 
         from MoinMoin.security.textcha import TextCha
--- a/MoinMoin/auth/__init__.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/auth/__init__.py	Wed Feb 27 00:28:28 2008 +0100
@@ -238,6 +238,6 @@
         userprefslink = request.page.url(request, querystr={'action': 'newaccount'})
         sendmypasswordlink = request.page.url(request, querystr={'action': 'recoverpass'})
         return _('If you do not have an account, <a href="%(userprefslink)s">you can create one now</a>. '
-                 '<a href="%(sendmypasswordlink)s">Forgot your password?</a>', formatted=False) % {
+                 '<a href="%(sendmypasswordlink)s">Forgot your password?</a>') % {
                'userprefslink': userprefslink,
                'sendmypasswordlink': sendmypasswordlink}
--- a/MoinMoin/auth/openidrp.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/auth/openidrp.py	Wed Feb 27 00:28:28 2008 +0100
@@ -92,7 +92,7 @@
                                                     {'oidstage': '1'})
         info = oidconsumer.complete(query, return_to=return_to)
         if info.status == consumer.FAILURE:
-            return CancelLogin(_('OpenID error: %s.') % info.message)
+            return CancelLogin(_('OpenID error: %s.') % info.message, percent=True)
         elif info.status == consumer.CANCEL:
             return CancelLogin(_('Verification canceled.'))
         elif info.status == consumer.SUCCESS:
--- a/MoinMoin/events/emailnotify.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/events/emailnotify.py	Wed Feb 27 00:28:28 2008 +0100
@@ -35,8 +35,8 @@
     change = notification.page_change_message("page_changed", request, page, email_lang, comment=comment, revisions=revisions)
     _ = lambda s, formatted=True, r=request, l=email_lang: r.getText(s, formatted=formatted, lang=l)
 
-    subject = _('[%(sitename)s] %(trivial)sUpdate of "%(pagename)s" by %(username)s', formatted=False) % {
-            'trivial': (trivial and _("Trivial ", formatted=False)) or "",
+    subject = _('[%(sitename)s] %(trivial)sUpdate of "%(pagename)s" by %(username)s') % {
+            'trivial': (trivial and _("Trivial ")) or "",
             'sitename': page.cfg.sitename or "Wiki",
             'pagename': page.page_name,
             'username': page.uid_override or user.getUserIdentification(request),
--- a/MoinMoin/events/notification.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/events/notification.py	Wed Feb 27 00:28:28 2008 +0100
@@ -87,7 +87,7 @@
     if msgtype == "page_changed":
         changes['text'] = _("Dear Wiki user,\n\n"
         'You have subscribed to a wiki page or wiki category on "%(sitename)s" for change notification.\n\n'
-        'The "%(pagename)s" page has been changed by %(editor)s:\n\n', formatted=False) % {
+        'The "%(pagename)s" page has been changed by %(editor)s:\n\n') % {
             'pagename': page.page_name,
             'editor': page.uid_override or user.getUserIdentification(request),
             'sitename': page.cfg.sitename or request.getBaseURL(),
@@ -95,19 +95,19 @@
 
         # append a diff (or append full page text if there is no diff)
         if len(revisions) < 2:
-            changes['diff'] = _("New page:\n", formatted=False) + page.get_raw_body()
+            changes['diff'] = _("New page:\n") + page.get_raw_body()
         else:
             lines = wikiutil.pagediff(request, page.page_name, revisions[1],
                                       page.page_name, revisions[0])
             if lines:
                 changes['diff'] = '\n'.join(lines)
             else:
-                changes['diff'] = _("No differences found!\n", formatted=False)
+                changes['diff'] = _("No differences found!\n")
 
     elif msgtype == "page_deleted":
         changes['text'] = _("Dear wiki user,\n\n"
             'You have subscribed to a wiki page "%(sitename)s" for change notification.\n\n'
-            'The page "%(pagename)s" has been deleted by %(editor)s:\n\n', formatted=False) % {
+            'The page "%(pagename)s" has been deleted by %(editor)s:\n\n') % {
                 'pagename': page.page_name,
                 'editor': page.uid_override or user.getUserIdentification(request),
                 'sitename': page.cfg.sitename or request.getBaseURL(),
@@ -116,8 +116,7 @@
     elif msgtype == "page_renamed":
         changes['text'] = _("Dear wiki user,\n\n"
             'You have subscribed to a wiki page "%(sitename)s" for change notification.\n\n'
-            'The page "%(pagename)s" has been renamed from "%(oldname)s" by %(editor)s:\n',
-            formatted=False) % {
+            'The page "%(pagename)s" has been renamed from "%(oldname)s" by %(editor)s:\n') % {
                 'editor': page.uid_override or user.getUserIdentification(request),
                 'pagename': page.page_name,
                 'sitename': page.cfg.sitename or request.getBaseURL(),
@@ -145,7 +144,7 @@
     body = _("""Dear Superuser, a new user has just been created. Details follow:
 
     User name: %(username)s
-    Email address: %(useremail)s""", formatted=False) % {
+    Email address: %(useremail)s""") % {
          'username': username,
          'useremail': email,
          }
--- a/MoinMoin/formatter/text_html.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/formatter/text_html.py	Wed Feb 27 00:28:28 2008 +0100
@@ -626,7 +626,7 @@
                 css = 'attachment'
             else:
                 target = AttachFile.getAttachUploadUrl(pagename, fname, self.request)
-                title = _('Upload new attachment "%(filename)s"', formatted=False) % {'filename': wikiutil.escape(fname)}
+                title = _('Upload new attachment "%(filename)s"') % {'filename': wikiutil.escape(fname)}
                 css = 'attachment nonexistent'
             return self.url(on, target, css=css, title=title)
         else:
@@ -640,7 +640,7 @@
         if exists:
             kw['css'] = 'attachment'
             kw['src'] = AttachFile.getAttachUrl(pagename, filename, self.request, addts=1)
-            title = _('Inlined image: %(url)s', formatted=False) % {'url': self.text(url)}
+            title = _('Inlined image: %(url)s') % {'url': self.text(url)}
             if not 'title' in kw:
                 kw['title'] = title
             # alt is required for images:
@@ -648,7 +648,7 @@
                 kw['alt'] = kw['title']
             return self.image(**kw)
         else:
-            title = _('Upload new attachment "%(filename)s"', formatted=False) % {
+            title = _('Upload new attachment "%(filename)s"') % {
                       'filename': wikiutil.escape(fname)}
             img = self.icon('attachimg')
             css = 'nonexistent'
@@ -679,7 +679,7 @@
 
         # check whether attachment exists, possibly point to upload form
         if not exists:
-            linktext = _('Create new drawing "%(filename)s (opens in new window)"', formatted=False)
+            linktext = _('Create new drawing "%(filename)s (opens in new window)"')
             return wikiutil.link_tag(
                 self.request,
                 ('%s?action=AttachFile&rename=%s%s' %
@@ -710,18 +710,18 @@
                 # add alt and title tags to areas
                 map = re.sub('href\s*=\s*"((?!%TWIKIDRAW%).+?)"', r'href="\1" alt="\1" title="\1"', map)
                 # add in edit links plus alt and title attributes
-                alt = title = _('Edit drawing %(filename)s (opens in new window)', formatted=False) % {'filename': self.text(fname)}
+                alt = title = _('Edit drawing %(filename)s (opens in new window)') % {'filename': self.text(fname)}
                 map = map.replace('%TWIKIDRAW%"', '%s" alt="%s" title="%s"' % (edit_link, alt, title))
                 # unxml, because 4.01 concrete will not validate />
                 map = map.replace('/>', '>')
-                alt = title = _('Clickable drawing: %(filename)s', formatted=False) % {'filename': self.text(fname)}
+                alt = title = _('Clickable drawing: %(filename)s') % {'filename': self.text(fname)}
                 return (map + self.image(
                     alt=alt,
                     title=title,
                     src=AttachFile.getAttachUrl(pagename, filename, self.request, addts=1),
                     usemap='#'+mapid, css="drawing"))
         else:
-            alt = title = _('Edit drawing %(filename)s (opens in new window)', formatted=False) % {'filename': self.text(fname)}
+            alt = title = _('Edit drawing %(filename)s (opens in new window)') % {'filename': self.text(fname)}
             return wikiutil.link_tag(self.request,
                                      edit_link,
                                      self.image(alt=alt,
--- a/MoinMoin/macro/Action.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/Action.py	Wed Feb 27 00:28:28 2008 +0100
@@ -33,7 +33,7 @@
     if not _kwargs:
         _kwargs = {}
 
-    text = _(text, formatted=False)
+    text = _(text)
     if action in _get_valid_actions(macro):
         page = macro.formatter.page
         _kwargs['action'] = action
--- a/MoinMoin/macro/AdvancedSearch.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/AdvancedSearch.py	Wed Feb 27 00:28:28 2008 +0100
@@ -97,7 +97,7 @@
     # category selection
     categories = form_get(request, 'categories')
     c_select = makeSelection('categories',
-            [('', _('any category', formatted=False))] +
+            [('', _('any category'))] +
             [(cat, '%s' % cat) for cat in getCategories(request)],
             categories, 3, True)
 
@@ -107,14 +107,14 @@
         for lang, lmeta in languages.items()])
     userlang = macro.request.lang
     lang_select = makeSelection('language',
-            [('', _('any language', formatted=False)),
+            [('', _('any language')),
             (userlang, langs[userlang])] + sorted(langs.items(), key=lambda i: i[1]),
             searchedlang, 3, True)
 
     # mimetype selection
     mimetype = form_get(request, 'mimetype')
     mt_select = makeSelection('mimetype',
-            [('', _('any mimetype', formatted=False))] +
+            [('', _('any mimetype'))] +
             [(type, 'all %s files' % type) for type in getMimetypes()] +
             [(m[1], '*%s - %s' % m) for m in sorted(mimetypes.types_map.items())],
             mimetype, 3, True)
--- a/MoinMoin/macro/EmbedObject.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/EmbedObject.py	Wed Feb 27 00:28:28 2008 +0100
@@ -88,21 +88,21 @@
         _ = self._
 
         if not mt:
-            return _("Not supported mimetype of file: %s", formatted=False) % self.target
+            return _("Not supported mimetype of file: %s") % self.target
 
         mime_type = "%s/%s" % (mt.major, mt.minor, )
         dangerous = mime_type in self.request.cfg.mimetypes_xss_protect
 
         if not mime_type in self.request.cfg.mimetypes_embed or dangerous:
             kw = {'src': url}
-            return "%s: %s%s%s" % (self.macro.formatter.text(_('Embedding of object by chosen formatter not possible', formatted=False)),
+            return "%s: %s%s%s" % (self.macro.formatter.text(_('Embedding of object by chosen formatter not possible')),
                                self.macro.formatter.url(1, kw['src']),
                                self.macro.formatter.text(self.target),
                                self.macro.formatter.url(0))
 
         if self.alt == "":
             self.alt = "%(text)s %(mime_type)s" % {
-                           'text': _("Embedded", formatted=False),
+                           'text': _("Embedded"),
                            'mime_type': mime_type,
                         }
 
@@ -211,14 +211,14 @@
         _ = self._
 
         if not self.target:
-            msg = _('Not enough arguments given to EmbedObject macro! Try <<EmbedObject(attachment [,width=width] [,height=height] [,alt=alternate Text])>>', formatted=False)
+            msg = _('Not enough arguments given to EmbedObject macro! Try <<EmbedObject(attachment [,width=width] [,height=height] [,alt=alternate Text])>>')
             return "%s%s%s" % (self.formatter.sysmsg(1), self.formatter.text(msg), self.formatter.sysmsg(0))
 
         if not self._is_URL(self.target):
             pagename, fname = AttachFile.absoluteName(self.target, self.formatter.page.page_name)
 
             if not AttachFile.exists(self.request, pagename, fname):
-                linktext = _('Upload new attachment "%(filename)s"', formatted=False)
+                linktext = _('Upload new attachment "%(filename)s"')
                 return wikiutil.link_tag(self.request, ('%s?action=AttachFile&rename=%s' % (
                                                          wikiutil.quoteWikinameURL(pagename),
                                                          wikiutil.url_quote_plus(fname))),
@@ -229,7 +229,7 @@
             mt = wikiutil.MimeType(filename=fname)
         else:
             if not self.url_mimetype:
-                return _('Not enough arguments given to EmbedObject macro! Try <<EmbedObject(url, url_mimetype [,width=width] [,height=height] [,alt=alternate Text])>>', formatted=False)
+                return _('Not enough arguments given to EmbedObject macro! Try <<EmbedObject(url, url_mimetype [,width=width] [,height=height] [,alt=alternate Text])>>')
             else:
                 mt = wikiutil.MimeType() # initialize dict
                 mt.major, mt.minor = self.url_mimetype.split('/')
--- a/MoinMoin/macro/FullSearch.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/FullSearch.py	Wed Feb 27 00:28:28 2008 +0100
@@ -97,7 +97,7 @@
     # TODO: search should implement those errors message for clients
     elif needle.isspace():
         err = _('Please use a more selective search term instead of '
-                '{{{"%s"}}}') % needle
+                '{{{"%s"}}}', wiki=True) % needle
         return '<span class="error">%s</span>' % err
 
     needle = needle.strip()
--- a/MoinMoin/macro/GetText.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/GetText.py	Wed Feb 27 00:28:28 2008 +0100
@@ -15,7 +15,7 @@
 
 def execute(macro, args):
     """ Return a translation of args, or args as is """
-    translation = macro.request.getText(args, formatted=False)
+    translation = macro.request.getText(args)
 
     return macro.formatter.text(translation)
 
--- a/MoinMoin/macro/SystemAdmin.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/SystemAdmin.py	Wed Feb 27 00:28:28 2008 +0100
@@ -22,8 +22,8 @@
         return ''
 
     _MENU = {
-        'attachments': (("File attachment browser"), do_admin_browser),
-        'users': (("User account browser"), do_user_browser),
+        'attachments': (_("File attachment browser"), do_admin_browser),
+        'users': (_("User account browser"), do_user_browser),
     }
     choice = request.form.get('sysadm', [None])[0]
 
--- a/MoinMoin/macro/SystemInfo.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/SystemInfo.py	Wed Feb 27 00:28:28 2008 +0100
@@ -161,13 +161,13 @@
                 stems = Stemmer.algorithms()
                 stemVersion = Stemmer.version()
             except:
-                stemVersion = _('!PyStemmer not installed')
+                stemVersion = _('PyStemmer not installed')
         except ImportError:
-            stemVersion = _('!PyStemmer not installed')
+            stemVersion = _('PyStemmer not installed')
 
         row(_('Stemming for Xapian'), xapState[request.cfg.xapian_stemming])
-        row(_('!PyStemmer Version'), stemVersion)
-        row(_('!PyStemmer stems'), ', '.join(stems) or nonestr)
+        row(_('PyStemmer Version'), stemVersion)
+        row(_('PyStemmer stems'), ', '.join(stems) or nonestr)
 
         try:
             from threading import activeCount
--- a/MoinMoin/macro/TableOfContents.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/TableOfContents.py	Wed Feb 27 00:28:28 2008 +0100
@@ -160,7 +160,7 @@
     result = [
         macro.formatter.div(1, css_class="table-of-contents"),
         macro.formatter.paragraph(1, css_class="table-of-contents-heading"),
-        macro.formatter.text(_('Contents', formatted=False)),
+        macro.formatter.text(_('Contents')),
         macro.formatter.paragraph(0),
     ]
 
--- a/MoinMoin/macro/__init__.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/macro/__init__.py	Wed Feb 27 00:28:28 2008 +0100
@@ -166,7 +166,7 @@
 
         # With whitespace argument, return same error message as FullSearch
         if not needle.strip():
-            err = _('Please use a more selective search term instead of {{{"%s"}}}') % needle
+            err = _('Please use a more selective search term instead of {{{"%s"}}}', wiki=True) % needle
             return '<span class="error">%s</span>' % err
 
         # Return a title search for needle, sorted by name.
--- a/MoinMoin/theme/classic.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/theme/classic.py	Wed Feb 27 00:28:28 2008 +0100
@@ -193,14 +193,14 @@
                 #title = Page(request, action).split_title(force=1)
                 title = action
                 # Use translated version if available
-                title = _(title, formatted=False)
+                title = _(title)
                 querystr = {'action': action}
                 if rev:
                     querystr['rev'] = str(rev)
                 link = page.link_to(request, text=title, querystr=querystr, rel='nofollow')
                 html.append(link)
 
-        title = _("DeleteCache", formatted=False)
+        title = _("DeleteCache")
         link = page.link_to(request, text=title, querystr={'action': 'refresh'}, rel='nofollow')
 
         cache = caching.CacheEntry(request, page, page.getFormatterName(), scope='item')
--- a/MoinMoin/user.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/user.py	Wed Feb 27 00:28:28 2008 +0100
@@ -1045,7 +1045,7 @@
 Login Password: %s
 
 Login URL: %s/%s?action=login
-""", formatted=False) % (
+""") % (
                         self.name, self.enc_password, self._request.getBaseURL(), getLocalizedPage(self._request, 'UserPreferences').page_name)
 
         text = _("""\
@@ -1056,11 +1056,11 @@
 for that).
 
 After successfully logging in, it is of course a good idea to set a new and known password.
-""", formatted=False) + text
+""") + text
 
 
         subject = _('[%(sitename)s] Your wiki account data',
-                    formatted=False) % {'sitename': self._cfg.sitename or "Wiki"}
+                ) % {'sitename': self._cfg.sitename or "Wiki"}
         mailok, msg = sendmail.sendmail(self._request, [self.email], subject,
                                     text, mail_from=self._cfg.mail_from)
         return mailok, msg
--- a/MoinMoin/util/diff_html.py	Wed Feb 27 00:23:46 2008 +0100
+++ b/MoinMoin/util/diff_html.py	Wed Feb 27 00:28:28 2008 +0100
@@ -38,7 +38,7 @@
 
     if len(seq1) == len(seq2) and linematch[0] == (0, 0, len(seq1)):
         # No differences.
-        return " - " + _("No differences found!", formatted=False)
+        return " - " + _("No differences found!")
 
     lastmatch = (0, 0)