Opened 16 years ago

Closed 11 years ago

Last modified 10 years ago

#9523 closed New feature (fixed)

Restart runserver after translation MO files change

Reported by: wim@… Owned by: Bouke Haarsma
Component: Internationalization Version: dev
Severity: Normal Keywords:
Cc: trebor74hr@…, bmihelac@…, charette.s@…, Bouke Haarsma Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello friendly people,

I have a feature-request concerning i18n.

After running: "django-admin.py compilemessages" I'd like the testing server to restart automatically.

Now it doesn't.

Thanks for looking at this feature request!

Change History (18)

comment:1 by Malcolm Tredinnick, 16 years ago

Summary: i18n - compilemessagesRestart runserver after translation MO files change
Triage Stage: UnreviewedSomeday/Maybe

(Changed title to describe the problem.)

This sounds like a fair bit of work for not a huge amount of gain. The filenames for the loaded translations aren't stored anywhere (and it would be complicating things to add them just for this request). So we end up having to check every single translation file to see if there's a change.

Maybe somebody will come along and write a patch that doesn't chew up a lot of resources (file stats aren't too expensive if the dirents are already in buffer cache) and add that to the reload checker without introducing too much tight coupling, but it isn't going to be really high priority, I expect.

comment:2 by Robert Lujo, 15 years ago

Solution suggestion

Whenever new translation is to be submitted django-admin compilemessages management command has to be called (http://docs.djangoproject.com/en/1.1/topics/i18n/localization/).
If command http://code.djangoproject.com/browser/django/trunk/django/core/management/commands/compilemessages.py issues at least one successful compiling (new version of mo is created) - it could
"touch" some django python file - what should trigger django-dev server restart. The only issue is which file to touch, while it shouldn't be any file that user is editing in the meantime.

btw. #4032 is closed ticket with the same issue.

comment:3 by Luke Plant, 14 years ago

Severity: Normal
Type: New feature

comment:4 by Robert Lujo, 13 years ago

Cc: trebor74hr@… added
Easy pickings: unset

comment:5 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 by bmihelac, 12 years ago

Cc: bmihelac@… added

comment:7 by Simon Charette, 12 years ago

Cc: charette.s@… added

comment:8 by Aymeric Augustin, 12 years ago

Triage Stage: Someday/MaybeAccepted

I think this ticket should be "accepted".

Malcolm's had two objections: it's low priority, and it isn't obvious to implement. But if someone writes a good patch, we'll certainly consider it.

comment:9 by kulewski, 11 years ago

Has patch: set

I provided a pull request fixing this issue: https://github.com/django/django/pull/1283

comment:10 by Tim Graham, 11 years ago

Needs tests: set

I've left some comments on the rebased PR. I'd like to see this tested in some way -- based on the coverage report, none of django/utils/autoreload.py is tested.

comment:11 by Bouke Haarsma, 11 years ago

Cc: Bouke Haarsma added
Owner: changed from nobody to Bouke Haarsma
Status: newassigned

I've updated the PR and I included a few tests for the gen_filenames helper. The autoreloader is in the omit section of .coveragerc, so that's why there's no coverage at all.

comment:12 by Bouke Haarsma <bouke@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In c3936c0d79d79aced25ceba8beff0c91a6b5c2ed:

Fixed #9523 -- Restart runserver after translation MO files change

Thanks to Krzysztof Kulewski for the initial patch.

comment:13 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In 8b3d9d96ed8304d749c9056c42be89084d9b34aa:

Merge pull request #1799 from Bouke/tickets/9523

Fixed #9523 -- Restart runserver after translation MO files change

comment:14 by Bouke Haarsma, 11 years ago

Needs tests: unset
Resolution: fixed
Status: closednew

Translations in INSTALLED_APPS, which Django might use, are not being watched. By inspecting INSTALLED_APPS, this can be fixed.

PR: https://github.com/django/django/pull/1878

comment:15 by Bouke Haarsma, 11 years ago

Version: 1.0master

comment:16 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 2397daab4a1b95a055514b009818730f4dfc4799:

Fixed #9523 -- Restart runserver after compiling apps translations

Django also uses locales provided by apps, which also might change. Also when
i18n is disabled, there is no need for watching translation files.

comment:17 by Claude Paroz <claude@…>, 10 years ago

In 0d363b25b82b0a86b7243512470f364bef92bc3d:

Fixed #22857 -- Reset translations when only .mo file changed

No need to restart the server when a translation file changes.
Refs #9523. Thanks artscoop for the report and Tim Graham for
the review.

comment:18 by Tim Graham <timograham@…>, 10 years ago

In cbcb7c010bdc015c79b4b8a0ba2955abb23aee82:

[1.7.x] Fixed #22857 -- Reset translations when only .mo file changed

No need to restart the server when a translation file changes.
Refs #9523. Thanks artscoop for the report and Tim Graham for
the review.

Backport of 0d363b25b8 from master

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