I have a Python/Django code base in which strings are encapsulated in gettext calls. For legacy reasons, the strings in the Python files have been written in French and the English translations are inside a .po file.
I now wish to make sure the Python files are in English, strings included. I would like to automatically switch the strings so that the English translations from the .po file end up in the Python files (instead of the French strings), while adding the French strings to a new .po file (matching the new "original" English string).
Since I have a lot of strings, doing this manually would be extremely tedious. Is there any tool or library that could facilitate this process?
There is no such tool.
If you don't write it yourself, you can use POEdit or Emacs as a helper. Both have a function that lets you jump to the source code line of a PO entry so that copy and paste is a little faster.
Automatically switch Python gettext strings with their translations from a .po file