Genderize#translate fixed and enhanced (now it accepts User objects to fix the gender).

This commit is contained in:
Paweł Wilk 2010-12-01 06:26:06 +01:00
parent 65c796572d
commit eb2d186a12
2 changed files with 8 additions and 5 deletions

View file

@ -53,10 +53,10 @@ module I18n
module Genderize module Genderize
def translate(locale, key, options = {}) def translate(locale, key, options = {})
g = options.delete(:gender) subkey = options.delete(:gender)
if not (g.nil? || key.is_a?(Enumerable)) if not (subkey.nil? || key.is_a?(Enumerable))
g = g.to_sym subkey = subkey.grammatical_gender if subkey.respond_to?(:grammatical_gender)
subkey = Genders[g.to_sym] subkey = Genders.default unless Genders.has_key?(subkey.to_sym)
key = "#{key}.#{subkey}".to_sym key = "#{key}.#{subkey}".to_sym
end end
super(locale, key, options) super(locale, key, options)

View file

@ -165,7 +165,10 @@ en:
helper: helper:
remove: "remove" remove: "remove"
aspect_not_empty: "Aspect not empty" aspect_not_empty: "Aspect not empty"
are_you_sure: "Are you sure you want to delete this aspect?" are_you_sure:
masculine: "Are you sure you want to delete this aspect?"
feminine: "Are you sure you want to delete this aspect?"
neuter: "Are you sure you want to delete this aspect?"
remove_from_aspect: remove_from_aspect:
success: "Successfully removed person from aspect" success: "Successfully removed person from aspect"
failure: "Failed to remove person from aspect" failure: "Failed to remove person from aspect"