Sha256: a246de70cf61c1d83990e8fac77a9bb6138395e8da39af1408969ca5724ef85d
Contents?: true
Size: 841 Bytes
Versions: 11
Compression:
Stored size: 841 Bytes
Contents
# encoding: utf-8 module Formtastic module I18n DEFAULT_SCOPE = [:formtastic].freeze DEFAULT_VALUES = YAML.load_file(File.expand_path("../../locale/en.yml", __FILE__))["en"]["formtastic"].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
11 entries across 11 versions & 1 rubygems