Module: Wordlist::Lexer::Lang

Defined in:
lib/wordlist/lexer/lang.rb

Overview

Detects the system's default language.

Since:

  • 1.0.0

Class Method Summary collapse

Class Method Details

.defaultSymbol

The default language.

Returns:

  • (Symbol)

Since:

  • 1.0.0



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wordlist/lexer/lang.rb', line 18

def self.default
  if (lang = ENV['LANG'])
    lang, encoding = lang.split('.',2)
    lang, country = lang.split('_',2)

    unless lang == 'C'
      lang.to_sym
    else
      :en
    end
  else
    :en
  end
end