3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/rails-localization/url_options.rb', line 3
def self.formatter opts
if opts[:_recall] && opts[:_recall].has_key?(:locale)
opts[:locale] = ::I18n.locale.to_s if opts[:locale].blank?
if !opts[:script_name].blank?
locale = opts.delete(:locale).to_s
affect_script_name(opts, locale) unless opts[:locale].to_s == ::I18n.default_locale.to_s
else
opts[:locale] = nil if opts[:locale].to_s == ::I18n.default_locale.to_s
end
end
if opts.has_key?(:_positional_keys) && opts[:_positional_keys].first == :locale
i = opts[:_positional_keys].index(:locale)
opts[:_positional_args].insert i, (opts.delete(:locale) || ::I18n.locale.to_s)
end
opts
end
|