Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 32 lines (25 sloc) 0.841 kb
433dae2 @yabawock Whitespace Cleanup
yabawock authored
1 # encoding: utf-8
2
382c552 @grimen Refactored I18n stuff to Formtastic::I18n with specs. Cleaner. Closes…
grimen authored
3 module Formtastic
4 module I18n
433dae2 @yabawock Whitespace Cleanup
yabawock authored
5
382c552 @grimen Refactored I18n stuff to Formtastic::I18n with specs. Cleaner. Closes…
grimen authored
6 DEFAULT_SCOPE = [:formtastic].freeze
da1fe0e @dbackeus Have I18n load default values from en.yml file.
dbackeus authored
7 DEFAULT_VALUES = YAML.load_file(File.expand_path("../../locale/en.yml", __FILE__))["en"]["formtastic"].freeze
f22b7a1 @grimen I18N_SCOPES => I18n::SCOPES
grimen authored
8 SCOPES = [
743b26b @yabawock Revert "Reverting two i18n patches pulled in from the rails3 branch w…
yabawock authored
9 '%{model}.%{nested_model}.%{action}.%{attribute}',
10 '%{model}.%{action}.%{attribute}',
11 '%{model}.%{nested_model}.%{attribute}',
12 '%{model}.%{attribute}',
13 '%{nested_model}.%{attribute}',
14 '%{attribute}'
f22b7a1 @grimen I18N_SCOPES => I18n::SCOPES
grimen authored
15 ]
433dae2 @yabawock Whitespace Cleanup
yabawock authored
16
382c552 @grimen Refactored I18n stuff to Formtastic::I18n with specs. Cleaner. Closes…
grimen authored
17 class << self
433dae2 @yabawock Whitespace Cleanup
yabawock authored
18
382c552 @grimen Refactored I18n stuff to Formtastic::I18n with specs. Cleaner. Closes…
grimen authored
19 def translate(*args)
20 key = args.shift.to_sym
21 options = args.extract_options!
22 options.reverse_merge!(:default => DEFAULT_VALUES[key])
23 options[:scope] = [DEFAULT_SCOPE, options[:scope]].flatten.compact
24 ::I18n.translate(key, *(args << options))
25 end
26 alias :t :translate
433dae2 @yabawock Whitespace Cleanup
yabawock authored
27
382c552 @grimen Refactored I18n stuff to Formtastic::I18n with specs. Cleaner. Closes…
grimen authored
28 end
433dae2 @yabawock Whitespace Cleanup
yabawock authored
29
382c552 @grimen Refactored I18n stuff to Formtastic::I18n with specs. Cleaner. Closes…
grimen authored
30 end
433dae2 @yabawock Whitespace Cleanup
yabawock authored
31 end
Something went wrong with that request. Please try again.