Class Locale
In: lib/globalite/locale.rb
Parent: Object

Methods

Attributes

code  [R] 
country  [R] 
language  [R] 

Public Class methods

[Source]

    # File lib/globalite/locale.rb, line 15
15:   def self.code
16:     ActionController::Base.session_options[:locale] ||= "#{Globalite.language}-#{Globalite.country}".to_sym
17:   end

[Source]

    # File lib/globalite/locale.rb, line 10
10:   def self.country
11:     Globalite.country
12:   end

[Source]

   # File lib/globalite/locale.rb, line 5
5:   def self.language
6:     Globalite.language
7:   end

[Source]

    # File lib/globalite/locale.rb, line 20
20:   def self.set_code(locale= code)
21:     if locale.to_s.split('-') && locale.to_s.length.between?(4,5) && Globalite.locales.include?(locale.to_sym) 
22:       Globalite.current_language = locale.to_s.split('-')[0].downcase.to_sym if locale.to_s.split('-')[0]
23:       Globalite.current_country = locale.to_s.split('-')[1].upcase.to_sym if locale.to_s.split('-')[1]
24:       set_session_locale("#{Globalite.language}-#{Globalite.country}")
25:     end
26:   end

[Source]

    # File lib/globalite/locale.rb, line 28
28:   def self.update_session_locale
29:     set_session_locale
30:   end

[Validate]