[galaxy-commits] galaxy-dist commit ee6aac1b8cba: Bugfix: pick out a language-code from Accept-Language header.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Jul 16 10:06:29 EDT 2010


# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User MORITA Hideyuki <h-morita at esm.co.jp>
# Date 1278490499 -32400
# Node ID ee6aac1b8cba0f4d2054df150e5568cad76fa189
# Parent  47411bb09df44719760aac61e4b90de4fd190aad
Bugfix: pick out a language-code from Accept-Language header.

--- a/lib/galaxy/web/framework/__init__.py
+++ b/lib/galaxy/web/framework/__init__.py
@@ -27,6 +27,7 @@ import mako.runtime
 
 pkg_resources.require( "Babel" )
 from babel.support import Translations
+from babel import Locale
 
 pkg_resources.require( "SQLAlchemy >= 0.4" )
 from sqlalchemy import and_
@@ -200,7 +201,7 @@ class GalaxyWebTransaction( base.Default
         if 'HTTP_ACCEPT_LANGUAGE' in self.environ:
             # locales looks something like: ['en', 'en-us;q=0.7', 'ja;q=0.3']
             locales = self.environ['HTTP_ACCEPT_LANGUAGE'].split( ',' )
-            locales = [ l.split( ';' )[0] for l in locales ]
+            locales = [ Locale.parse(l.split( ';' )[0], sep='-').language for l in locales ]
         else:
             # Default to English
             locales = 'en'


More information about the galaxy-commits mailing list