1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/yesno/helpers.rb', line 1
def yesno(to_validate, options = {})
defaults = {
:type => "default",
:pluralize => false,
:female => false
}
options = defaults.merge(options)
if options[:pluralize] == false
if options[:female] == false
return to_validate ? I18n.t("yesno.#{options[:type]}.smt") : I18n.t("yesno.#{options[:type]}.smf")
else
return to_validate ? I18n.t("yesno.#{options[:type]}.sft") : I18n.t("yesno.#{options[:type]}.sff")
end
else
if options[:female] == false
return to_validate ? I18n.t("yesno.#{options[:type]}.pmt") : I18n.t("yesno.#{options[:type]}.pmf")
else
return to_validate ? I18n.t("yesno.#{options[:type]}.pft") : I18n.t("yesno.#{options[:type]}.pff")
end
end
end
|