Sha256: 73fd20103a93380839d1f3e8fac76f2f0c149b41c5b040873aeca3390c619a8d
Contents?: true
Size: 828 Bytes
Versions: 9
Compression:
Stored size: 828 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}}.{{action}}.{{attribute}}', '{{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
9 entries across 9 versions & 5 rubygems