[issue2551146] Generating locale info reports errors with misformatted strings

John Rouillard <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from John Rouillard:

When running step 1 of Release.txt, we get abunch of warnings like:

../roundup/cgi/client.py:1430: warning: 'msgid' format string with 
unnamed arguments cannot be properly localized:
                      The translator cannot reorder the arguments.
                      Please consider using a format string with named 
arguments,
                      and a mapping instead of a tuple for the 
arguments.
 
which points to:

  logger.error(
     self._("Csrf mismatch user: current session %s != stored session 
%s, current user/stored user is: %s for key %s."),
        current_session, nonce_session, current_user, key)

It makes it easier for translators if written as:

     self._("Csrf mismatch user: current session %(current_session)s != 
stored session %(nonce_session)s, current user/stored user is: %
(current_user)s for key %(key)s."),
        {"current_session": current_session,
         "nonce_session": nonce_session,
         "current_user": current_user, "key": key})

or, if the arguments are simple variables in local scope
(as opposed to function calls etc.)

     self._("Csrf mismatch user: current session %(current_session)s != 
stored session %(nonce_session)s, current user/stored user is: %
(current_user)s for key %(key)s."), locals())

Most important for translation are user facing strings. Second most 
important are admin facing (which includes logging at warning or 
higher.) Third are tracing statements at info or lower.

----------
components: User Interface
messages: 7297
nosy: rouilj
severity: normal
status: new
title: Generating locale info reports errors with misformatted strings
type: behavior

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551146>
_________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.