Sha256: a3ec45e5b24fd28a098c5cb93efc74acae0f224415f75b0dc56fb417a4f25e34

Contents?: true

Size: 277 Bytes

Versions: 134

Compression:

Stored size: 277 Bytes

Contents

module LocalizedName
  def localize(locale = I18n.locale.to_s)
    values = Hash[*self.strip.split("\n").map{|n| n.split(':', 2)}.flatten]
    name = values[locale.to_s] || self
    name.strip
  rescue ArgumentError
    self
  end
end

class String
  include LocalizedName
end

Version data entries

134 entries across 134 versions & 5 rubygems

Version Path
enju_message-0.0.20 spec/dummy/lib/enju_leaf/localized_name.rb
enju_message-0.1.4 spec/dummy/lib/enju_leaf/localized_name.rb
enju_event-0.0.20 spec/dummy/lib/enju_leaf/localized_name.rb
enju_event-0.1.7 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.45 spec/dummy/lib/enju_leaf/localized_name.rb
enju_subject-0.0.14 spec/dummy/lib/localized_name.rb
enju_circulation-0.0.43 spec/dummy/lib/enju_leaf/localized_name.rb
enju_event-0.0.19 spec/dummy/lib/enju_leaf/localized_name.rb
enju_message-0.1.3 spec/dummy/lib/enju_leaf/localized_name.rb
enju_subject-0.0.13 spec/dummy/lib/localized_name.rb
enju_circulation-0.0.42 spec/dummy/lib/enju_leaf/localized_name.rb
enju_event-0.1.6 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.41 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.40 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.39 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.38 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.37 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.36 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.35 spec/dummy/lib/enju_leaf/localized_name.rb
enju_circulation-0.0.34 spec/dummy/lib/enju_leaf/localized_name.rb