Sha256: 212d191a1b50606143f08d820403c310a71bd1e60f8c17f8194307220f2525a9
Contents?: true
Size: 968 Bytes
Versions: 7
Compression:
Stored size: 968 Bytes
Contents
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
Version data entries
7 entries across 7 versions & 4 rubygems