Class | Locale |
In: |
lib/globalite/locale.rb
|
Parent: | Object |
code | [R] | |
country | [R] | |
language | [R] |
# 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
# 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