lib/sinatra/ghetto_i18n.rb
# The language for the current request. If the user is browsing to a
# language specific URL (ie, :lang is included in the params), then use
# that.
#
# If not, try to figure it out from the Accept-Language HTTP header.
#
# If that fails as well, resort to the +default_language+ setting.
The language for the current request. If the user is browsing to a
language specific URL , then use
that.

If not, try to figure it out from the Accept-Language HTTP header.

If that fails as well, resort to the +default_language+ setting.
The language for the current request . If the user is browsing to a language specific URL then use that . If not try to figure it out from the Accept - Language HTTP header . If that fails as well resort to the + default_language + setting .
def language_from_http 
        env["HTTP_ACCEPT_LANGUAGE"].to_s.split(",").each do |lang|
          self.class.languages.each do |code, *|
            return code if lang =~ /^#{code}/
          end
        end
        nil
      end
def language_from_http env [ "HTTP_ACCEPT_LANGUAGE" ] . to_s . split ( "," ) . each do | lang | self . class . languages . each do | code , * | return code if lang =~ / ^ #{ code } / end end nil end
The language for the current request.
The language for the current request .
# :nodoc: