Opened 7 years ago

Closed 22 months ago

Last modified 14 months ago

#9523 closed New feature (fixed)

Restart runserver after translation MO files change

Reported by: wim@… Owned by: bouke
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: trebor74hr@…, bmihelac@…, charette.s@…, bouke 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 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from i18n - compilemessages to Restart runserver after translation MO files change
  • Triage Stage changed from Unreviewed to Someday/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 Changed 6 years ago by trebor74hr

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 Changed 4 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 4 years ago by trebor74hr

  • Cc trebor74hr@… added
  • Easy pickings unset

comment:5 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 3 years ago by bmihelac

  • Cc bmihelac@… added

comment:7 Changed 3 years ago by charettes

  • Cc charette.s@… added

comment:8 Changed 3 years ago by aaugustin

  • Triage Stage changed from Someday/Maybe to Accepted

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 Changed 2 years ago by kulewski

  • Has patch set

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

comment:10 Changed 23 months ago by timo

  • 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 Changed 22 months ago by bouke

  • Cc bouke added
  • Owner changed from nobody to bouke
  • Status changed from new to assigned

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 Changed 22 months ago by Bouke Haarsma <bouke@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In c3936c0d79d79aced25ceba8beff0c91a6b5c2ed:

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

Thanks to Krzysztof Kulewski for the initial patch.

comment:13 Changed 22 months ago by Aymeric Augustin <aymeric.augustin@…>

In 8b3d9d96ed8304d749c9056c42be89084d9b34aa:

Merge pull request #1799 from Bouke/tickets/9523

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

comment:14 Changed 22 months ago by bouke

  • Needs tests unset
  • Resolution fixed deleted
  • Status changed from closed to new

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 Changed 22 months ago by bouke

  • Version changed from 1.0 to master

comment:16 Changed 22 months ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 14 months ago by Claude Paroz <claude@…>

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 Changed 14 months ago by Tim Graham <timograham@…>

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