Feature request: django.py makemessages --add-location=full|file|never

194 views
Skip to first unread message

ling-xi...@savoirfairelinux.com

unread,
Mar 27, 2017, 3:28:37 PM3/27/17
to Django developers (Contributions to Django itself)
Hello there,

Please let me know if it is a duplicate. I would like to propose the support of `--add-location` of `xgettext` in Django makemessages, in order to provide a fine-grain control of the metadata of .po files.

At present, Django makemessages support `--no-location` to completely suppress the `#: file:line` lines.

Quote from https://www.gnu.org/software/gettext/manual/gettext.html:

--add-location=type

Generate ‘#: filename:line’ lines (default).

The optional type can be either ‘full’, ‘file’, or ‘never’. If it is not given or ‘full’, it generates the lines with both file name and line number. If it is ‘file’, the line number part is omitted. If it is ‘never’, it completely suppresses the lines (same as --no-location).



After consulting the Git history of GNU gettext on Savannah, I found it added in March 2014:


commit 90c76fda268779b80c2fa969b8efddbb4aa5da1e
Author: Daiki Ueno <EMAIL ADDRESS>
Date:   Mon Mar 24 18:43:01 2014 +0900

    Extend --add-location option to suppress line number output
   
    The --add-location option of msgattrib, msgcat, msgcomm, msgconv,
    msgen, msgfilter, msggrep, msgmerge, msguniq, and xgettext
    commands now takes an optional argument 'never', 'full', or
    'file', to control the format of "#: ..."  comments.
   
    The default catalog reader changed to always remember file
    positions so the line number part can be suppressed in output
    phase rather than input phase.



Why adding this: it will help a lot the version control of .po files. It will exclude many noises that can simply be triggered by a line addition/deletion. By keeping file names but not line numbers, this would be a good compromise between developers who find this metadata noisy and translators who may rely on this information.

Please kindly comment. Thank you!

Adam Johnson

unread,
Mar 27, 2017, 5:56:06 PM3/27/17
to django-d...@googlegroups.com
I don't see any reason against adding it. If there isn't a ticket already, you can make one at https://code.djangoproject.com/ , then look at the extensive contributing guide.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/f0405b21-aee9-415a-9772-296353678da6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Adam

Hanne Moa

unread,
Mar 29, 2017, 3:03:52 AM3/29/17
to django-d...@googlegroups.com
Since no flag equals "full" and "--no-location" equals "never" maybe a
new flag "--file-location" for "file" instead of "--add-location" for
all three?
>> email to django-develop...@googlegroups.com.
>> To post to this group, send email to django-d...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-develop...@googlegroups.com.
> To post to this group, send email to django-d...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAMyDDM2evqjYeU_%3DMqRxTNjfqeOkS3sStdSVbBR6VxcEZ3k30w%40mail.gmail.com.

ling-xi...@savoirfairelinux.com

unread,
Apr 3, 2017, 1:35:15 PM4/3/17
to Django developers (Contributions to Django itself)
Hello,

I browsed the archived emails on gettext "--add-location". The very original proposal was "--no-linenumbers" but it was finally implemented as it is now. It doesn't seem to me, however, that there is much discussion on this topic:

https://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=--no-linenumbers&submit=Search%21&idxname=bug-gettext&max=20&result=normal&sort=date%3Aearly

Perhaps I'll just follow what gettext has done, as it might be easier for someone who already has experience with gettext utilities. I think we may let Django take both "--no-location" and "--add-location=...", and simply let gettext decide which one overrides.

How do you think?

ling-xi...@savoirfairelinux.com

unread,
Apr 3, 2017, 1:51:18 PM4/3/17
to Django developers (Contributions to Django itself)
Reply all
Reply to author
Forward
0 new messages