I'm using python, gettext and kivy to make a multi-language app.
I have a label with some text
Label(text = _("hi")). I made the code to be able to switch language, but that requires to reset the text,Label.text = _(Label.text), but this code is a problem, since once the translation is done, the text to be used asmsgidis translated, and therefore, not found in.pofiles the next time.I created a workaround, something like
MyLabel(textKey = msgid). This solves all the problems, since changing language is done withMyLabel.text = _(MyLabel.textKey).But this approach has an issue, if I use
xgettextto generate the.potfile,msgidis not recognized because it is not written as_(msgid)and it cannot be (point 1).
My question is: is there a way to tell xgettext to recognise textKey = msgid?
I ended up using
pygettext, there I can use the-kargument. See docs.