7

How to update an existing messages.pot file? For example, I have translated messages.pot file:

.... #: forms.py:11 msgid "Nickname" msgstr "Имя" #: forms.py:18 msgid "Wrong email" msgstr "Неправильный пароль" .... 

If I'll mark new text with selector gettext, for example:

flash(gettext('Login successful')) 

and run: pybabel extract -F babel.cfg -o messages.pot
I'll receive a new messages.po file:

 .... #: forms.py:11 msgid "Nickname" msgstr "" #: forms.py:18 msgid "Wrong email" msgstr "" #: models.py:783 msgid "Login successful" msgstr "" .... 

So, how can I update an existing messages.pot file, saving translated strings ("Nickname", "Wrong email")?

1 Answer 1

19

pot file not for translations, it just list of all strings for translation without specific language.

For real translations used po - text file and mo - binary file with translations. This files will created for any languages that you need. See my files structure:

translations/ translations/ru/ translations/ru/LC_MESSAGES/ translations/ru/LC_MESSAGES/messages.mo translations/ru/LC_MESSAGES/messages.po translations/messages.pot 

To get all strings for translation:

pybabel extract -F babel.cfg -o messages.pot . 

To init po file (first time):

pybabel init -i messages.pot -d . -l ru 

To update exist po file:

pybabel update -i messages.pot -d . 

To compile po file to mo:

pybabel compile -f -d . 

See more in documentation.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.