Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#16903 closed New feature (fixed)

Add '--no-location' option for 'makemessages' command

Reported by: Alpár Jüttner Owned by: nobody
Component: Core (Management commands) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

The attached patch adds a --no-location option for the makemessages management command. It is against svn trunk revision -r16861. Please consider adding it to the svn repo.

Rational: Location comments in the .po files can are very annoying when they are version controlled, because changes in the source codes will trigger a lot of changes in the .po files, even when the strings to be translated are not affected. The obvious remedy for this is using --no-location.

Attachments (3)

no-location.patch (5.3 KB ) - added by Alpár Jüttner 12 years ago.
no-location-with-tests.patch (6.6 KB ) - added by Alpár Jüttner 12 years ago.
Tests added
no-location-3.patch (7.9 KB ) - added by Alpár Jüttner 12 years ago.
Fix tests, add docs

Download all attachments as: .zip

Change History (14)

by Alpár Jüttner, 12 years ago

Attachment: no-location.patch added

comment:1 by Aymeric Augustin, 12 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

It would be nice to add a test in tests/regressiontests/i18n/commands.

comment:2 by Alpár Jüttner, 12 years ago

A novice question. Assume I have a sole checkout of django svn trunk. What is the easiest way to run its tests? (All of them, or just a specific one, such as NoWrapExtractorTests).

in reply to:  2 comment:3 by Aymeric Augustin, 12 years ago

The fastest way to run all the tests is:

% cd tests
% PYTHONPATH=.. python runtests.py --settings=test_sqlite

That will take some time, because there are more than 4000 tests. You can find more details — in particular, how to run a subset of the tests — in the contributing guide: https://docs.djangoproject.com/en/1.3/internals/contributing/#running-the-unit-tests

by Alpár Jüttner, 12 years ago

Tests added

in reply to:  1 ; comment:4 by Alpár Jüttner, 12 years ago

Replying to aaugustin:

It would be nice to add a test in tests/regressiontests/i18n/commands.

The newly attached patch also performs some basic tests. Let me know if this is sufficient or not.

(Thanks for the help on testing.)

in reply to:  4 comment:5 by Alpár Jüttner, 12 years ago

Is there anything to do for me in order to get this patch merged into the svn version?

comment:6 by Julien Phalip, 12 years ago

Needs documentation: set
Patch needs improvement: set

The patch and tests look good. One note though: the tests currently can be running until you import NoLocationExtractorTests in regressiontests.i18n.tests.py under the if can_run_extraction_tests condition. Could you also update the test method names to test_location_enabled() and test_location_disabled().

Finally, some documentation should be added for this new option: https://docs.djangoproject.com/en/dev/ref/django-admin/#makemessages

Thanks for the great work!

by Alpár Jüttner, 12 years ago

Attachment: no-location-3.patch added

Fix tests, add docs

comment:7 by Alpár Jüttner, 12 years ago

Please find the revised patch attached.
Changes compared to the previous version:

  • Doc added to docs/ref/django-admin.txt
  • Import NoLocationExtractorTests from tests/regressiontests/i18n/tests.py
  • Change the test function names to the suggested ones.

comment:8 by Julien Phalip, 12 years ago

Triage Stage: AcceptedReady for checkin

Looks great, thank you!

comment:9 by Julien Phalip, 12 years ago

Resolution: fixed
Status: newclosed

In [17081]:

Fixed #16903 -- Added --no-location option to the makemessages command to not write '#: filename:line' comment lines in language files. Thanks to alpar for the suggestion and patch.

comment:10 by Ramiro Morales <ramiro@…>, 10 years ago

In 4b715fc05a75c375d5afe1860ce748ae2a2e290b:

Fixed #21209 -- .po file path comments on Windows.

Literals from source files with Django template language syntax don't
have a '.py' suffix anymore.

Also, the '.\' prefix is preserved to respect GNU gettext behavior on
that platform.

Refs #16903.

comment:11 by Ramiro Morales <ramiro@…>, 10 years ago

In d16753eecd3c97c781382fbb4c119f6bae314487:

[1.6.x] Fixed #21209 -- .po file path comments on Windows.

Literals from source files with Django template language syntax don't
have a '.py' suffix anymore.

Also, the '.\' prefix is preserved to respect GNU gettext behavior on
that platform.

Refs #16903.

4b715fc05a from master.

Note: See TracTickets for help on using tickets.
Back to Top