[openstack-dev] [ironic] Translations removal

Vladyslav Drok vdrok at mirantis.com
Wed Mar 22 10:16:07 UTC 2017


On Wed, Mar 22, 2017 at 12:10 AM, Taryma, Joanna <joanna.taryma at intel.com>
wrote:

> 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?
>

I don't think we can simply ignore it --
https://docs.openstack.org/developer/oslo.i18n/guidelines.html#using-a-marker-function,
it is just a marker for i18n IIUC, and if we'll change to just doing
_(var), it will not be translated.

-Vlad


>
>
> Kind regards,
>
> Joanna
>
>
>
> [0] http://eavesdrop.openstack.org/irclogs/%23openstack-
> ironic/%23openstack-ironic.2017-03-21.log.html#t2017-03-21T14:00:49
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170322/7b785841/attachment.html>


More information about the OpenStack-dev mailing list