I want to translate 'usage: ' into 'foobar'.
print(gettext.find('test', 'i18n', ['en_US']))
translator = gettext.translation('test', localedir='i18n', languages=['en_US'])
translator.install()
print(_('usage: '))
parser = argparse.ArgumentParser(prog="jcheq.py",
usage="%(prog)s [opciones] [paths...]\nThe paths are optional; if not given . is "
"used.",
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
But it outputs this:
~/Desktop/Proyectos/UNPAZ/jcheq/jcheq$ python3 jcheq.py --help
i18n/en_US/LC_MESSAGES/test.mo
foobar:
usage: jcheq.py [opciones] [paths...]
The paths are optional; if not given . is used.
Opciones:
-h, --help Mostrar este mensaje de ayuda y salir.
-m, --modified show last modified date/time (default: False)
Seems that it is working for my string, but not for argparse's one:
argparse.py:292 aprox
def _format_usage(self, usage, actions, groups, prefix):
if prefix is None:
prefix = _('usage: ')