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

Brian Rosmaita brian.rosmaita at RACKSPACE.COM
Wed Nov 2 16:34:45 UTC 2016

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",
        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').")

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]

    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,

[0] https://review.openstack.org/#/c/367795/8
[1] http://babel.pocoo.org/en/latest/messages.html#translator-comments

More information about the OpenStack-dev mailing list