Class: Weatherman::I18N
- Inherits:
-
Object
- Object
- Weatherman::I18N
- Defined in:
- lib/yahoo_weatherman/i18n.rb
Overview
I18n
This class uses the locale files to translate the response sent from the Yahoo! Weather feed.
Constant Summary
- I18N_YAML_DIR =
File.(File.join(File.dirname(__FILE__), '..', '..', 'i18n'))
- LANGUAGES =
{}
Instance Attribute Summary (collapse)
-
- (Object) language
Returns the value of attribute language.
Instance Method Summary (collapse)
-
- (I18N) initialize(language)
constructor
Expects a string with the locale file name.
-
- (Object) translate!(attributes)
Translates the messages in the response if a locale file was specified in the constructor.
Constructor Details
- (I18N) initialize(language)
Expects a string with the locale file name. Eg. I18N.new('pt-br') will load the i18n/pt-br.yml file.
20 21 22 |
# File 'lib/yahoo_weatherman/i18n.rb', line 20 def initialize(language) @language = language end |
Instance Attribute Details
- (Object) language
Returns the value of attribute language
14 15 16 |
# File 'lib/yahoo_weatherman/i18n.rb', line 14 def language @language end |
Instance Method Details
- (Object) translate!(attributes)
Translates the messages in the response if a locale file was specified in the constructor. It modifies the hash passed in place.
28 29 30 31 32 33 34 35 |
# File 'lib/yahoo_weatherman/i18n.rb', line 28 def translate!(attributes) if i18n? translate_text! attributes translate_days! attributes translate_locations! attributes end attributes end |