Module: LocalizedName

Included in:
String
Defined in:
lib/enju_seed/localized_name.rb

Instance Method Summary collapse

Instance Method Details

#localize(locale = I18n.locale) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/enju_seed/localized_name.rb', line 2

def localize(locale = I18n.locale)
  string = YAML.load(self)
  if string.is_a?(Hash) and string[locale.to_s]
    return string[locale.to_s]
  end
  self
rescue NoMethodError
  self
end