lib/utopia/localization.rb
# A wrapper to provide easy access to locale related data in the request.
A wrapper to provide easy access to locale related data in the request.
A wrapper to provide easy access to locale related data in the request .
def browser_preferred_locales(env)
			accept_languages = env[HTTP_ACCEPT_LANGUAGE]
			return [] unless accept_languages
			languages = HTTP::Accept::Languages.parse(accept_languages)
			return @all_locales & languages
		rescue HTTP::Accept::ParseError
			return []
		end
def browser_preferred_locales ( env ) accept_languages = env [ HTTP_ACCEPT_LANGUAGE ] return [ ] unless accept_languages languages = HTTP :: Accept :: Languages . parse ( accept_languages ) return @all_locales & languages rescue HTTP :: Accept :: ParseError return [ ] end
A wrapper to provide easy access to locale related data in the request.
A wrapper to provide easy access to locale related data in the request .
# No user prefered languages: # Extract the ordered list of languages: # Returns available languages based on the order languages: # If we fail to parse the browser Accept-Language header, we ignore it (silently).
env