#28773: manage.py makemessages throws syntax error due to incorrectly generated
django.pot
-------------------------------------+-------------------------------------
     Reporter:  Hendy Irawan         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:                       |                  Version:  1.11
  Internationalization               |
     Severity:  Normal               |               Resolution:
     Keywords:  gettext,             |             Triage Stage:
  makemessages, Windows              |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Hendy Irawan:

Old description:

> This only happens after there are several translations (so it's not
> happening on a clean project with very few translations).
> And I'm on Windows. Seems related to #28409.
>
> {{{
> (venv) C:\Users\ceefour\git\samara\samaraweb>python manage.py
> makemessages -l id_ID --keep-pot -v3
> examining files with the extensions: .py, .txt and .html
> ignoring file .gitignore in .
> ignoring file README.md in .
> ignoring file 0001_initial.cpython-36.pyc in .\edu\migrations\__pycache__
> ignoring file 0002_category.cpython-36.pyc in
> .\edu\migrations\__pycache__
> ignoring file 0003_profile.cpython-36.pyc in .\edu\migrations\__pycache__
> ignoring file 0004_profile_price_range.cpython-36.pyc in
> .\edu\migrations\__pycache__
> ignoring file __init__.cpython-36.pyc in .\edu\migrations\__pycache__
> ignoring file admin.cpython-36.pyc in .\edu\__pycache__
> ignoring file apps.cpython-36.pyc in .\edu\__pycache__
> ignoring file models.cpython-36.pyc in .\edu\__pycache__
> ignoring file urls.cpython-36.pyc in .\edu\__pycache__
> ignoring file urls_root.cpython-36.pyc in .\edu\__pycache__
> ignoring file views.cpython-36.pyc in .\edu\__pycache__
> ignoring file views_root.cpython-36.pyc in .\edu\__pycache__
> ignoring file __init__.cpython-36.pyc in .\edu\__pycache__
> ignoring file context_processors.cpython-36.pyc in
> .\samaraweb\__pycache__
> ignoring file middleware.cpython-36.pyc in .\samaraweb\__pycache__
> ignoring file settings.cpython-36.pyc in .\samaraweb\__pycache__
> ignoring file urls.cpython-36.pyc in .\samaraweb\__pycache__
> ignoring file wsgi.cpython-36.pyc in .\samaraweb\__pycache__
> ignoring file __init__.cpython-36.pyc in .\samaraweb\__pycache__
> ignoring file samara_dev_public_edu_brand.sql in .\snapshot
> ignoring file samara_dev_public_edu_category.sql in .\snapshot
> ignoring file samara_dev_public_edu_city.sql in .\snapshot
> ignoring file samara_dev_public_edu_country.sql in .\snapshot
> ignoring file samara_dev_public_edu_place.sql in .\snapshot
> ignoring file samara_dev_public_edu_populatedplace.sql in .\snapshot
> ignoring file samara_dev_public_edu_profile.sql in .\snapshot
> ignoring file samara_dev_public_edu_profile_categories.sql in .\snapshot
> ignoring file samara_dev_public_edu_state.sql in .\snapshot
> processing file __init__.py in .\edu
> processing file admin.py in .\edu
> processing file apps.py in .\edu
> processing file 0001_initial.py in .\edu\migrations
> processing file 0002_category.py in .\edu\migrations
> processing file 0003_profile.py in .\edu\migrations
> processing file 0004_profile_price_range.py in .\edu\migrations
> processing file __init__.py in .\edu\migrations
> processing file models.py in .\edu
> processing file base.html in .\edu\templates\edu
> processing file footer.html in .\edu\templates\edu
> processing file header.html in .\edu\templates\edu
> processing file home.html in .\edu\templates\edu
> processing file index.html in .\edu\templates\edu
> processing file loc_detail.html in .\edu\templates\edu
> processing file org_detail.html in .\edu\templates\edu
> processing file privacy.html in .\edu\templates\edu
> processing file terms.html in .\edu\templates\edu
> processing file tests.py in .\edu
> processing file urls.py in .\edu
> processing file urls_root.py in .\edu
> processing file views.py in .\edu
> processing file views_root.py in .\edu
> processing file manage.py in .
> processing file __init__.py in .\samaraweb
> processing file context_processors.py in .\samaraweb
> processing file middleware.py in .\samaraweb
> processing file settings.dev.py in .\samaraweb
> processing file settings.prd.py in .\samaraweb
> processing file settings.py in .\samaraweb
> processing file urls.py in .\samaraweb
> processing file wsgi.py in .\samaraweb
> processing locale id_ID
> CommandError: errors happened while running msgmerge
> C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61:3: syntax
> error
> C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
> "edu" unknown
> C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
> "templates" unknown
> C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
> "edu" unknown
> C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
> "loc_detail" unknown
> C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
> "html" unknown
> msgmerge: found 6 fatal errors
> }}}
>
> Sometimes happens with msguniq instead of msgmerge.
>
> Here's a snippet of the generated django.pot, where syntax error occurs :
>
> {{{
> #: .\edu\templates\edu\home.html:46
>  .\edu\templates\edu\loc_detail.html:12
> msgid ""
> "Your child goes to school soon? It's time to find the favorite nursery/"
> "preschool and kindergarten for your child."
> msgstr ""
> }}}
>
> Note that the .po files are fine, and I can run manage.py compilemessages
> just fine (and I can still create messages in the manual way, but with
> this feature broken, it's not scalable).
> Only makemessages is not working.
>
> gettext:
>
> {{{
> (venv) C:\Users\ceefour\git\samara\samaraweb>gettext -V
> gettext (GNU gettext-runtime) 0.19.8.1
> Copyright (C) 1995-1997, 2000-2007 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Written by Ulrich Drepper.
>  gettext: write error
> }}}

New description:

 This only happens after there are several translations (so it's not
 happening on a clean project with very few translations).
 And I'm on Windows. Seems related to #28409.

 {{{
 (venv) C:\Users\ceefour\git\samara\samaraweb>python manage.py makemessages
 -l id_ID --keep-pot -v3
 examining files with the extensions: .py, .txt and .html
 ignoring file .gitignore in .
 ignoring file README.md in .
 ignoring file 0001_initial.cpython-36.pyc in .\edu\migrations\__pycache__
 ignoring file 0002_category.cpython-36.pyc in .\edu\migrations\__pycache__
 ignoring file 0003_profile.cpython-36.pyc in .\edu\migrations\__pycache__
 ignoring file 0004_profile_price_range.cpython-36.pyc in
 .\edu\migrations\__pycache__
 ignoring file __init__.cpython-36.pyc in .\edu\migrations\__pycache__
 ignoring file admin.cpython-36.pyc in .\edu\__pycache__
 ignoring file apps.cpython-36.pyc in .\edu\__pycache__
 ignoring file models.cpython-36.pyc in .\edu\__pycache__
 ignoring file urls.cpython-36.pyc in .\edu\__pycache__
 ignoring file urls_root.cpython-36.pyc in .\edu\__pycache__
 ignoring file views.cpython-36.pyc in .\edu\__pycache__
 ignoring file views_root.cpython-36.pyc in .\edu\__pycache__
 ignoring file __init__.cpython-36.pyc in .\edu\__pycache__
 ignoring file context_processors.cpython-36.pyc in .\samaraweb\__pycache__
 ignoring file middleware.cpython-36.pyc in .\samaraweb\__pycache__
 ignoring file settings.cpython-36.pyc in .\samaraweb\__pycache__
 ignoring file urls.cpython-36.pyc in .\samaraweb\__pycache__
 ignoring file wsgi.cpython-36.pyc in .\samaraweb\__pycache__
 ignoring file __init__.cpython-36.pyc in .\samaraweb\__pycache__
 ignoring file samara_dev_public_edu_brand.sql in .\snapshot
 ignoring file samara_dev_public_edu_category.sql in .\snapshot
 ignoring file samara_dev_public_edu_city.sql in .\snapshot
 ignoring file samara_dev_public_edu_country.sql in .\snapshot
 ignoring file samara_dev_public_edu_place.sql in .\snapshot
 ignoring file samara_dev_public_edu_populatedplace.sql in .\snapshot
 ignoring file samara_dev_public_edu_profile.sql in .\snapshot
 ignoring file samara_dev_public_edu_profile_categories.sql in .\snapshot
 ignoring file samara_dev_public_edu_state.sql in .\snapshot
 processing file __init__.py in .\edu
 processing file admin.py in .\edu
 processing file apps.py in .\edu
 processing file 0001_initial.py in .\edu\migrations
 processing file 0002_category.py in .\edu\migrations
 processing file 0003_profile.py in .\edu\migrations
 processing file 0004_profile_price_range.py in .\edu\migrations
 processing file __init__.py in .\edu\migrations
 processing file models.py in .\edu
 processing file base.html in .\edu\templates\edu
 processing file footer.html in .\edu\templates\edu
 processing file header.html in .\edu\templates\edu
 processing file home.html in .\edu\templates\edu
 processing file index.html in .\edu\templates\edu
 processing file loc_detail.html in .\edu\templates\edu
 processing file org_detail.html in .\edu\templates\edu
 processing file privacy.html in .\edu\templates\edu
 processing file terms.html in .\edu\templates\edu
 processing file tests.py in .\edu
 processing file urls.py in .\edu
 processing file urls_root.py in .\edu
 processing file views.py in .\edu
 processing file views_root.py in .\edu
 processing file manage.py in .
 processing file __init__.py in .\samaraweb
 processing file context_processors.py in .\samaraweb
 processing file middleware.py in .\samaraweb
 processing file settings.dev.py in .\samaraweb
 processing file settings.prd.py in .\samaraweb
 processing file settings.py in .\samaraweb
 processing file urls.py in .\samaraweb
 processing file wsgi.py in .\samaraweb
 processing locale id_ID
 CommandError: errors happened while running msgmerge
 C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61:3: syntax
 error
 C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
 "edu" unknown
 C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
 "templates" unknown
 C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
 "edu" unknown
 C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
 "loc_detail" unknown
 C:\Users\ceefour\git\samara\samaraweb\edu\locale\django.pot:61: keyword
 "html" unknown
 msgmerge: found 6 fatal errors
 }}}

 Sometimes happens with msguniq instead of msgmerge.

 Here's a snippet of the generated django.pot, where syntax error occurs
 (at the second message). Note that all messages up to this point have
 correct syntax:

 {{{
 #: .\edu\templates\edu\home.html:45 .\edu\templates\edu\index.html:11
 #: .\edu\templates\edu\loc_detail.html:11
 #, python-format
 msgid "Best Nursery & Preschools in %(loc_name)s"
 msgstr ""

 #: .\edu\templates\edu\home.html:46
  .\edu\templates\edu\loc_detail.html:12
 msgid ""
 "Your child goes to school soon? It's time to find the favorite nursery/"
 "preschool and kindergarten for your child."
 msgstr ""
 }}}

 Note that the .po files are fine, and I can run manage.py compilemessages
 just fine (and I can still create messages in the manual way, but with
 this feature broken, it's not scalable).
 Only makemessages is not working.

 gettext:

 {{{
 (venv) C:\Users\ceefour\git\samara\samaraweb>gettext -V
 gettext (GNU gettext-runtime) 0.19.8.1
 Copyright (C) 1995-1997, 2000-2007 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later
 <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
 Written by Ulrich Drepper.
  gettext: write error
 }}}

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28773#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.126c0348c5a6c7ee8dadedc97038271d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to