Roundup Tracker - Issues

Issue 2551146

classification
Generating locale info reports errors with misformatted strings
Type: behavior Severity: normal
Components: User Interface Versions:
process
Status: fixed fixed
:
: rouilj : rouilj
Priority: : StarterTicket

Created on 2021-07-03 16:51 by rouilj, last changed 2022-11-25 04:14 by rouilj.

Messages
msg7297 Author: [hidden] (rouilj) Date: 2021-07-03 16:51
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.
msg7678 Author: [hidden] (rouilj) Date: 2022-11-25 04:14
fixed on a few changesets:

changeset:   7055:9b4bd9bc9bdc
changeset:   7056:9fe29682dca2
changeset:   7057:7259ce224d65
changeset:   7058:8094cbf5f6f7
changeset:   7059:2c89bdc88923

all around Mon Nov 21 18:02:19 2022
History
Date User Action Args
2022-11-25 04:14:22rouiljsetstatus: new -> fixed
assignee: rouilj
resolution: fixed
messages: + msg7678
2021-08-21 19:19:33rouiljsetkeywords: + StarterTicket
2021-07-03 16:51:12rouiljcreate