I want to write a Python script that would extract the msgid strings from the Django.po files generated by makemessages command for i18n.
Sample:
#: views.py:231
msgid "Jack and Jill went up the hill."
msgstr ""
#: views.py:34
msgid "Wrong choice. Select wisely."
msgstr ""
#: views.py:100 views.py:420 views.py:655 templates/thankYou.html:4
msgid "Thank You. You will be contacted shortly."
msgstr ""
I'd like to:
Extract each
msgidstring and place it in a text file.Meanwhile, I'd also create a corresponding list of line numbers of the
msgid'smsgstrs, so that after translation, I could easily insert the translated text back into their correspondingmsgstr ""quotesAnd then after I translate the text file wholly, I feed it back to the 2nd part of my script which then puts the translated strings back into their corresponding
msgstrparts.
Any ideas how I should go about this ?