<div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 13, 2014 at 5:03 PM, Alexei Kornienko <span dir="ltr"><<a href="mailto:alexei.kornienko@gmail.com" target="_blank">alexei.kornienko@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div class="">
<div>On 03/13/2014 10:44 PM, Doug Hellmann
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div style="font-size:small"><br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Feb 27, 2014 at 3:45 AM,
yongli he <span dir="ltr"><<a href="mailto:yongli.he@intel.com" target="_blank">yongli.he@intel.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> refer to :<br>
<a href="https://wiki.openstack.org/wiki/Translations" target="_blank">https://wiki.openstack.org/wiki/Translations</a><br>
<br>
now some exception use _ and some not. the wiki suggest
do not to do that. but i'm not sure.<br>
<br>
what's the correct way?<br>
<br>
<br>
F.Y.I <br>
<br>
<h4><span>What To Translate</span></h4>
<p>
At present the convention is to translate<span> </span><i>all</i><span> </span>user-facing
strings. This means API messages, CLI responses,
documentation, help text, etc.</p>
<p>
There has been a lack of consensus about the
translation of log messages; the current ruling is
that while it is not against policy to mark log
messages for translation if your project feels
strongly about it, translating log messages is not
actively encouraged.</p>
</div>
</blockquote>
<div><br>
</div>
<div>
<div style="font-size:small">I've
updated the wiki to replace that paragraph with a
pointer to <a href="https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation" target="_blank">https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation</a>
which explains the log translation rules. We will be
adding the job needed to have different log translations
during Juno.</div>
<br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>
Exception text should<span> </span><i>not</i><span> </span>be
marked for translation, becuase if an exception occurs
there is no guarantee that the translation machinery
will be functional.</p>
</div>
</blockquote>
<div><br>
</div>
<div>
<div style="font-size:small">This
makes no sense to me. Exceptions should be translated.
By far the largest number of errors will be presented to
users through the API or through Horizon (which gets
them from the API). We will ensure that the translation
code does its best to fall back to the original string
if the translation fails.</div>
</div>
</div>
</div>
</div>
</blockquote></div>
There is another option: exception can contain non localized string
and a thin wrapper will translate them on API layer right before
output. <br>
Something like:<br>
print _(str(exception)).<br>
<br>
It seems a cleaner solution to me since we don't need to add
translations all over the code and we call a gettext just once when
it's actually needed.</div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Unfortunately, that's not how gettext works. Each string needs to be marked up inline in order for the message catalog extraction tool to find it and add it to the strings to be translated.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Doug</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div class=""><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>
<div style="font-size:small"><br>
</div>
<div style="font-size:small">Doug</div>
<br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> <br>
<br>
Regards<span><font color="#888888"><br>
Yongli He<br>
<br>
</font></span></div>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
OpenStack-dev mailing list
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
</blockquote>
<br>
</div></div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div></div>