Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (30 sloc) 0.968 kB
module Formtastic
module I18n
DEFAULT_SCOPE = [:formtastic].freeze
DEFAULT_VALUES = {
:required => 'required',
:yes => 'Yes',
:no => 'No',
:create => 'Create %{model}',
:update => 'Update %{model}'
}.freeze
SCOPES = [
'%{model}.%{nested_model}.%{action}.%{attribute}',
'%{model}.%{action}.%{attribute}',
'%{model}.%{nested_model}.%{attribute}',
'%{model}.%{attribute}',
'%{nested_model}.%{attribute}',
'%{attribute}'
]
class << self
def translate(*args)
key = args.shift.to_sym
options = args.extract_options!
options.reverse_merge!(:default => DEFAULT_VALUES[key])
options[:scope] = [DEFAULT_SCOPE, options[:scope]].flatten.compact
::I18n.translate(key, *(args << options))
end
alias :t :translate
end
end
end
Jump to Line
Something went wrong with that request. Please try again.