Opened 10 years ago

Closed 9 years ago

#3955 closed (fixed)

compile-messages.py could use LOCALE_PATHS from settings.py

Reported by: Olivier Ricou <ricou@…> Owned by: Ilya Semenov
Component: Internationalization Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Why compile-messages.py does not use the LOCALE_PATHS variable defined in settings.py
to define the basedir directory ? Now we are restricted to locale and conf/locale.

Attachments (4)

compile-messages-use-settings-module.diff (3.0 KB) - added by Ilya Semenov 9 years ago.
bugfix_for_r6349.diff (1.0 KB) - added by Wang Chun <wangchun@…> 9 years ago.
bugfix for r6349
bugfix_for_r6349.2.diff (1.1 KB) - added by Wang Chun <wangchun@…> 9 years ago.
bugfix for r6349
bugfix-no-locale-paths-in-settings.diff (1.1 KB) - added by Ilya Semenov 9 years ago.
A bugfix to a patch by Wang Chun, uses hasattr() instead of try/except

Download all attachments as: .zip

Change History (14)

comment:1 Changed 10 years ago by Malcolm Tredinnick

Triage Stage: UnreviewedAccepted

Good point. This would be a reasonable fix to make: have compile-messages.py also compile PO files under the directories in LOCALE_PATHS.

comment:2 Changed 10 years ago by Malcolm Tredinnick

Component: TranslationsInternationalization

comment:3 Changed 9 years ago by Ilya Semenov

Owner: changed from nobody to Ilya Semenov
Status: newassigned

comment:4 Changed 9 years ago by Ilya Semenov

Has patch: set
Triage Stage: AcceptedReady for checkin

Here it goes.

Changed 9 years ago by Ilya Semenov

comment:5 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: assignedclosed

(In [6349]) Fixed #3955 -- Added the ability to traverse LOCALE_PATHS when compiling PO files. Thanks, semenov.

Changed 9 years ago by Wang Chun <wangchun@…>

Attachment: bugfix_for_r6349.diff added

bugfix for r6349

comment:6 Changed 9 years ago by anonymous

Resolution: fixed
Status: closedreopened
Triage Stage: Ready for checkinUnreviewed

I reopened this ticket because of a bug in r6349.

I have runtime error with compile-messages.py:

Traceback (most recent call last):
  File "/home/wangchun/src/django/django/bin/compile-messages.py", line 64, in <module>
    main()
  File "/home/wangchun/src/django/django/bin/compile-messages.py", line 61, in main
    compile_messages(options.locale)
  File "/home/wangchun/src/django/django/bin/compile-messages.py", line 17, in compile_messages
    basedirs += settings.LOCALE_PATHS
  File "/home/wangchun/src/cityweekend/lib/django/django/conf/__init__.py", line 32, in __getattr__
    return getattr(self._target, name)
AttributeError: 'Settings' object has no attribute 'LOCALE_PATHS'

I have attached a patch for this.

Changed 9 years ago by Wang Chun <wangchun@…>

Attachment: bugfix_for_r6349.2.diff added

bugfix for r6349

comment:7 Changed 9 years ago by Wang Chun <wangchun@…>

sorry, stupid mistake...

plz use bugfix_for_r6349.2.diff instead.

comment:8 Changed 9 years ago by Ilya Semenov

Agreed. However, they tend to use hasattr() approach instead of try/except in Django code, so the patch should look a bit different.

Changed 9 years ago by Ilya Semenov

A bugfix to a patch by Wang Chun, uses hasattr() instead of try/except

comment:9 Changed 9 years ago by Ilya Semenov

Triage Stage: UnreviewedReady for checkin

comment:10 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: reopenedclosed

(In [6447]) Fixed #3955 -- Handled the case when there is no LOCALE_PATHS setting from [6349]. Thanks, Wang Chun and semenov.

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