<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 22, 2017 at 12:10 AM, Taryma, Joanna <span dir="ltr"><<a href="mailto:joanna.taryma@intel.com" target="_blank">joanna.taryma@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="white" lang="EN-US">
<div class="gmail-m_-2527518923472078309WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">Hi team, <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">As discussed on Monday, logged messages shouldn’t be translated anymore. Exception messages still should be still translated.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">While removing usages of _LE, _LW, _LI should be fairly easy, some usages of _ may cause issues.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">The best option in terms of code redundancy would be something like:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">msg = “<error message>”<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">LOG.error(msg, {<key>: <val>})<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">raise Exception(_(msg) % {<key>: <val>})<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">However, pep8 does not accept passing variable to translation functions, so this results in ‘H701 Empty localization string’ error.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Possible options to handle that:<u></u><u></u></span></p>
<p class="gmail-m_-2527518923472078309MsoListParagraph"><u></u><span style="font-size:11pt"><span>1)<span style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman"">
</span></span></span><u></u><span style="font-size:11pt">Duplicate messages:<u></u><u></u></span></p>
<p class="gmail-m_-2527518923472078309MsoListParagraph"><span style="font-size:11pt">LOG.error(“<error message>”, {<key>: <val>})<u></u><u></u></span></p>
<p class="gmail-m_-2527518923472078309MsoListParagraph"><span style="font-size:11pt">raise Exception(_(“<error message>”) % {<key>: <val>})<u></u><u></u></span></p>
<p class="gmail-m_-2527518923472078309MsoListParagraph"><u></u><span style="font-size:11pt"><span>2)<span style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman"">
</span></span></span><u></u><span style="font-size:11pt">Ignore this error<u></u><u></u></span></p>
<p class="gmail-m_-2527518923472078309MsoListParagraph"><u></u><span style="font-size:11pt"><span>3)<span style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman"">
</span></span></span><u></u><span style="font-size:11pt">Talk to hacking people about possible upgrade of this check<u></u><u></u></span></p>
<p class="gmail-m_-2527518923472078309MsoListParagraph"><u></u><span style="font-size:11pt"><span>4)<span style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"times new roman"">
</span></span></span><u></u><span style="font-size:11pt">Pass translated text to LOG in such cases<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I’d personally vote for 2. What are your thoughts?</span></p></div></div></blockquote><div><br></div><div>I don't think we can simply ignore it -- <a href="https://docs.openstack.org/developer/oslo.i18n/guidelines.html#using-a-marker-function">https://docs.openstack.org/developer/oslo.i18n/guidelines.html#using-a-marker-function</a>, it is just a marker for i18n IIUC, and if we'll change to just doing _(var), it will not be translated.</div><div><br></div><div>-Vlad</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="white" lang="EN-US"><div class="gmail-m_-2527518923472078309WordSection1"><p class="MsoNormal"><span style="font-size:11pt"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Kind regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Joanna<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">[0] <a href="http://eavesdrop.openstack.org/irclogs/%23openstack-ironic/%23openstack-ironic.2017-03-21.log.html#t2017-03-21T14:00:49" target="_blank">http://eavesdrop.openstack.<wbr>org/irclogs/%23openstack-<wbr>ironic/%23openstack-ironic.<wbr>2017-03-21.log.html#t2017-03-<wbr>21T14:00:49</a><u></u><u></u></span></p>
</div>
</div>
<br>______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
<br></blockquote></div><br></div></div>