Module: AjaxfulRating::Locale
- Included in:
- StarsBuilder
- Defined in:
- lib/axr/locale.rb
Overview
Customize messages by adding I18n keys:
ajaxful_rating:
helper:
global_average: "Global rating average: {{value}} out of {{max}}"
user_rating: "Your rating: {{value}} out of {{max}}"
hover: "Rate {{value}} out of {{max}}"
Constant Summary
- DEFAULTS =
{ :user_rating => "Your rating: {{value}} out of {{max}}", :global_average => "Global rating average: {{value}} out of {{max}}", :hover => "Rate {{value}} out of {{max}}" }
Instance Method Summary (collapse)
Instance Method Details
- (Object) i18n(key, value = nil)
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/axr/locale.rb', line 18 def i18n(key, value = nil) key = if key == :current [:show_user_rating] ? :user_rating : :global_average else key.to_sym end default = DEFAULTS[key] key = "ajaxful_rating.helper.#{key}" I18n.t(key, :value => (value || show_value), :max => rateable.class.max_stars, :default => default) end |