Is there a way to pass a Python variable string into gettext function _()?

91 views Asked by At

Is there a way to pass a variable string into gettext function _()?

Like:

my_str = 'Hello, World!'
print(_(my_str ))

This does not work when I run pygettext. How can I fix it?

my_str = 'Hello, World!'
print(_(my_str ))

I expect to have as output of pygettext, in the .po file

.
.
.
msgid "Hello, World!"
msgstr ""
.
.
.
0

There are 0 answers