1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/2b7295ac12dc/ changeset: r5051:2b7295ac12dc user: natefoo date: 2011-02-11 22:15:18 summary: Instead of raising in exception, default to english if a locale is set by the client but not installed on the server. affected #: 1 file (177 bytes) --- a/lib/galaxy/web/framework/__init__.py Fri Feb 11 15:32:13 2011 -0500 +++ b/lib/galaxy/web/framework/__init__.py Fri Feb 11 16:15:18 2011 -0500 @@ -27,7 +27,7 @@ pkg_resources.require( "Babel" ) from babel.support import Translations -from babel import Locale +from babel import Locale, UnknownLocaleError pkg_resources.require( "SQLAlchemy >= 0.4" ) from sqlalchemy import and_ @@ -198,11 +198,16 @@ # and such). self.workflow_building_mode = False def setup_i18n( self ): + locales = [] 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 = [ Locale.parse(l.split( ';' )[0], sep='-').language for l in locales ] - else: + for locale in locales: + try: + locales.append( Locale.parse( locale.split( ';' )[0], sep='-' ).language ) + except UnknownLocaleError: + pass + if not locales: # Default to English locales = 'en' t = Translations.load( dirname='locale', locales=locales, domain='ginga' ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.