I’m maintaining a PyQt6 application which uses gettext to make translations (i18n).
Sometimes there are external strings to be translated. The solution adopted by the author of this application was adding to a messages.py
file where these strings can be added so that they can be extracted in the .pot template and then appear in the several .po files.
Most of the times you have to know not only the string, but also the context it applies to, otherwise the translation won’t work.
For example, here:
_('QWidgetTextControl', '&Copy')
QWidgetTextControl is the context, in the gettext terms.
We cannot guess the context. Every time I had to add strings in that messages.py I ran the application in debug mode and when I clicked on the button containing the string to be translated I saw the string and the context.
So far so good.
Now I’m trying to find the strings but most importantly the contexts of the macOS app menu created by PyQt6. This menu does not appear when you run the application in debug mode using the terminal so there’s no way to see the strings and the contexts.
I guess there are two possible solutions:
- Someone could know which context (Qt widget) these menu entries have. I thought this forum could be the right place to ask this question. I tried a few in above PR, but none seemed to work.
- I should find a way to enable debug mode from the GUI (no terminal). That would be desirable, but I have very limited coding skills (still learning the basics).
I need some help. Thanks in advance