[openstack-dev] [ironic] Translations removal

Taryma, Joanna joanna.taryma at intel.com
Tue Mar 21 22:10:49 UTC 2017


Hi team,

As discussed on Monday, logged messages shouldn’t be translated anymore. Exception messages still should be still translated.
While removing usages of _LE, _LW, _LI should be fairly easy, some usages of _ may cause issues.

Some messages in the code are declared with ‘_’ method and used both for logger and exception. This has to be changed, so we don’t have some log entries translated because of that.
The best option in terms of code redundancy would be something like:
msg = “<error message>”
LOG.error(msg, {<key>: <val>})
raise Exception(_(msg) % {<key>: <val>})

However, pep8 does not accept passing variable to translation functions,  so this results in ‘H701 Empty localization string’ error.
Possible options to handle that:

1)       Duplicate messages:

LOG.error(“<error message>”, {<key>: <val>})

raise Exception(_(“<error message>”) % {<key>: <val>})

2)       Ignore this error

3)       Talk to hacking people about possible upgrade of this check

4)       Pass translated text to LOG in such cases

I’d personally vote for 2. What are your thoughts?

Kind regards,
Joanna

[0] http://eavesdrop.openstack.org/irclogs/%23openstack-ironic/%23openstack-ironic.2017-03-21.log.html#t2017-03-21T14:00:49
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170321/60fd936f/attachment.html>


More information about the OpenStack-dev mailing list