Module: Sinatra::GhettoI18n::Helpers

Defined in:
lib/sinatra/ghetto_i18n.rb

Instance Method Summary collapse

Instance Method Details

#languageObject

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.



146
147
148
149
# File 'lib/sinatra/ghetto_i18n.rb', line 146

def language
  @_lang ||= params[:lang] || language_from_http ||
    self.class.default_language
end