Module: WrfForecast::LocaleConfiguration
- Defined in:
- lib/wrf_forecast/locale_configuration.rb
Overview
This module loads and regulates the locale settings that are used to create the forecast
Class Method Summary collapse
-
.change_locale(locale) ⇒ Object
module method to change the locale.
-
.determine_locale(locale_string) ⇒ Object
module method to determine the correct locale from a given string.
-
.initialize_locale(locale_path) ⇒ Object
module method to load the locale files from the given path.
Class Method Details
.change_locale(locale) ⇒ Object
module method to change the locale
18 19 20 21 |
# File 'lib/wrf_forecast/locale_configuration.rb', line 18 def self.change_locale(locale) I18n.locale = locale nil end |
.determine_locale(locale_string) ⇒ Object
module method to determine the correct locale from a given string
25 26 27 28 29 30 31 32 33 |
# File 'lib/wrf_forecast/locale_configuration.rb', line 25 def self.determine_locale(locale_string) case locale_string when "de" then change_locale(:de) when "en" then change_locale(:en) else puts "Warning: found no match for locale #{locale_string}." end nil end |
.initialize_locale(locale_path) ⇒ Object
module method to load the locale files from the given path
10 11 12 13 14 |
# File 'lib/wrf_forecast/locale_configuration.rb', line 10 def self.initialize_locale(locale_path) I18n.load_path << Dir[File.(locale_path) + "/*.yml"] I18n.default_locale = :en nil end |