On 03/13/2014 10:44 PM, Doug Hellmann wrote:
On Thu, Feb 27, 2014 at 3:45 AM, yongli he <[email protected]
<mailto:[email protected]>> wrote:
refer to :
https://wiki.openstack.org/wiki/Translations
now some exception use _ and some not. the wiki suggest do not to
do that. but i'm not sure.
what's the correct way?
F.Y.I
What To Translate
At present the convention is to translate/all/user-facing strings.
This means API messages, CLI responses, documentation, help text, etc.
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.
I've updated the wiki to replace that paragraph with a pointer to
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation which
explains the log translation rules. We will be adding the job needed
to have different log translations during Juno.
Exception text should/not/be marked for translation, becuase if an
exception occurs there is no guarantee that the translation
machinery will be functional.
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.
There is another option: exception can contain non localized string and
a thin wrapper will translate them on API layer right before output.
Something like:
print _(str(exception)).
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.
Doug
Regards
Yongli He
_______________________________________________
OpenStack-dev mailing list
[email protected]
<mailto:[email protected]>
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
_______________________________________________
OpenStack-dev mailing list
[email protected]
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
_______________________________________________
OpenStack-dev mailing list
[email protected]
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev