[openstack-dev] [all][i18n] how to indicate non-translatable identifiers in translatable strings?

Brant Knudson blk at acm.org
Wed Nov 2 21:02:08 UTC 2016


On Wed, Nov 2, 2016 at 11:34 AM, Brian Rosmaita <
brian.rosmaita at rackspace.com> wrote:

> This issue came up during a code review; I've asked around a bit but
> haven't been able to find an answer.
>
> Some of the help output for utility scripts associated with Glance aren't
> being translated, so Li Wei put up a patch to fix this [0], but there are
> at least two problematic cases.
>
> Case 1:
>     parser.add_option('-S', '--os_auth_strategy', dest="os_auth_strategy",
>         metavar="STRATEGY",
>         help=_("Authentication strategy (keystone or noauth)."))
>
> For that one, 'keystone' and 'noauth' are identifiers, so we don't want
> them translated.  Would putting single quotes around them like this be
> sufficient to indicate they shouldn't be translated?  For example,
>
>     help=_("Authentication strategy ('keystone' or 'noauth').")
>
>
one option is, don't put the non-translated words in the _(""); for example:

 help=_("Authentication strategy (%r or %r).") % ('keystone', 'noauth')


>
> Andreas Jaeger mentioned that maybe we could use a "translation comment"
> [1].  I guess we'd do something like:
>
>     # NOTE: do not translate the stuff in single quotes
>     help=_("Authentication strategy ('keystone' or 'noauth').")
>
>
> What are other people doing for this?
>
> Case 2:
> We've got a big block of usage text, roughly
>
>     usage = _("""
> %prog <command> [options] [args]
>
> Commands:
>     keyword1    what it does
>     keyword2    what it does
>     ...
>     keyword8    what it does
> """)
>
> We don't want the keywords to be translated, but I'm not sure how to
> convey this to the translators.
>
> Thanks in advance for your help,
> brian
>
>
> [0] https://review.openstack.org/#/c/367795/8
> [1] http://babel.pocoo.org/en/latest/messages.html#translator-comments
>
>
>
> __________________________________________________________________________
> 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
>



-- 
- Brant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20161102/e307c93a/attachment.html>


More information about the OpenStack-dev mailing list