Author: mtredinnick
Date: 2008-08-30 15:17:58 -0500 (Sat, 30 Aug 2008)
New Revision: 8749

Modified:
   django/trunk/django/core/management/commands/runserver.py
Log:
Fixed #8702 -- Set up the initial locale correctly for the development server.
Previously, "--noreload" wasn't picking up the default language setting. Thanks
to arien and Karen Tracey for debugging this.


Modified: django/trunk/django/core/management/commands/runserver.py
===================================================================
--- django/trunk/django/core/management/commands/runserver.py   2008-08-30 
19:56:14 UTC (rev 8748)
+++ django/trunk/django/core/management/commands/runserver.py   2008-08-30 
20:17:58 UTC (rev 8749)
@@ -43,11 +43,18 @@
 
         def inner_run():
             from django.conf import settings
+            from django.utils import translation
             print "Validating models..."
             self.validate(display_num_errors=True)
             print "\nDjango version %s, using settings %r" % 
(django.get_version(), settings.SETTINGS_MODULE)
             print "Development server is running at http://%s:%s/"; % (addr, 
port)
             print "Quit the server with %s." % quit_command
+
+            # django.core.management.base forces the locale to en-us. We should
+            # set it up correctly for the first request (particularly important
+            # in the "--noreload" case).
+            translation.activate(settings.LANGUAGE_CODE)
+
             try:
                 path = admin_media_path or django.__path__[0] + 
'/contrib/admin/media'
                 handler = AdminMediaHandler(WSGIHandler(), path)
@@ -70,6 +77,7 @@
                 if shutdown_message:
                     print shutdown_message
                 sys.exit(0)
+
         if use_reloader:
             from django.utils import autoreload
             autoreload.main(inner_run)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to