<div dir="ltr"><div>The following is a PSA for all OpenStackClient plugins.</div><div><br></div>







Matt Edmonds filed bug 1636209 [1] against OpenStackClient because the main help message was not getting translated. In the example below, the "Create new user" string was not translated (some of the help text was removed for readability):<br><br>====================================<br>$ openstack user create --help<br>  usage: openstack user create [-h]<br>  ... [--password <password >] <name><br><br>Create new user          <<<<<<br><br>positional arguments:<br>  <name>                New user name<div><br>optional arguments:<br>  --password < password>   Set user password<br>====================================<br><br>As it turns out, this was because we were setting this help message in a docstring, which could not be marked for translation. cliff was automatically picking up the docstring and using that (as-designed).</div><div><br></div><div>Doug Hellmann fixed the issue for cliff by allowing a class attribute [2], and I proposed a patch for OpenStackClient [3]. Look for a new cliff release soon, and a bump to the minimum version in global-requirements.<br><br>In case you want to do this in your plugin (assuming you are setup for translations), and not handcraft 100+ lines, you can run the following commands (this is what I used, and I'm sure someone will come up with a better way of doing it)<br><br>$ find . -name '*.py' -exec sed -i .bak -e 's/""".*"""/_description=_("&")/g' {} \;<br>$ find . -type f -name '*.py.bak' -delete<br>$ git checkout examples/ releasenotes/ openstackclient/tests/<br><br>Thanks for reading!</div><div>Steve<br><br>[1] <a href="https://bugs.launchpad.net/python-openstackclient/+bug/1636209">https://bugs.launchpad.net/python-openstackclient/+bug/1636209</a></div><div>[2] <a href="https://review.openstack.org/#/c/397321/">https://review.openstack.org/#/c/397321/</a><br>[3] <a href="https://review.openstack.org/#/c/396939/">https://review.openstack.org/#/c/396939/</a><br><br><br></div></div>