Module: Localized::Config
- Defined in:
- lib/localized/config.rb
Class Method Summary collapse
- .configuration ⇒ Object
- .default_host_prefix ⇒ Object
- .default_locale ⇒ Object
- .default_site ⇒ Object
- .locale_to_site_map ⇒ Object
- .site_to_locale_map ⇒ Object
- .supported_locales ⇒ Object
- .supported_sites ⇒ Object
Class Method Details
.configuration ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/localized/config.rb', line 4 def self.configuration @configuration ||= begin config_file = File.(File.join(Rails.root.to_s,'/config/localized.yml')) defaults_file = File.(File.join(__FILE__, '..', '..', '..', 'config/defaults.yml')) defaults = YAML.load_file(defaults_file) custom = YAML.load_file(config_file) if File.exists?(config_file) symobolize_keys_and_values(defaults.merge(custom || {})) end.symbolize_keys end |
.default_host_prefix ⇒ Object
14 15 16 |
# File 'lib/localized/config.rb', line 14 def self.default_host_prefix @default_host_prefix ||= self.configuration[:default_host_prefix].to_s end |
.default_locale ⇒ Object
38 39 40 |
# File 'lib/localized/config.rb', line 38 def self.default_locale @default_locale ||= site_to_locale_map[default_site] end |
.default_site ⇒ Object
26 27 28 |
# File 'lib/localized/config.rb', line 26 def self.default_site @default_site ||= self.configuration[:default_site] end |
.locale_to_site_map ⇒ Object
22 23 24 |
# File 'lib/localized/config.rb', line 22 def self.locale_to_site_map @locale_to_site_map ||= site_to_locale_map.invert end |
.site_to_locale_map ⇒ Object
18 19 20 |
# File 'lib/localized/config.rb', line 18 def self.site_to_locale_map @site_to_locale_map ||= self.configuration[:site_locale_map].symbolize_keys end |
.supported_locales ⇒ Object
34 35 36 |
# File 'lib/localized/config.rb', line 34 def self.supported_locales @supported_locales ||= site_to_locale_map.values.sort end |
.supported_sites ⇒ Object
30 31 32 |
# File 'lib/localized/config.rb', line 30 def self.supported_sites @supported_sites ||= site_to_locale_map.symbolize_keys.keys.sort end |