Class BrowserLanguageCode
In: lib/browser_language_code.rb
Parent: Object

Parts borrowed from the multi-lang plugin of Fabien Penso penso.info/svn/rails/plugins/multi_lang/

Methods

detect  

Public Class methods

Fetches the detected language from the broswer

Returns ‘en’ by default.

[Source]

    # File lib/browser_language_code.rb, line 22
22:   def self.detect(http_accept_language)
23:     language_codes = []
24:     if not http_accept_language.nil? and not http_accept_language.empty?
25:       lang_parse_comma(http_accept_language).each do |lang, val|
26:         return lang
27:       end
28:     end
29:     return 'en'
30:   end

[Validate]