lib/tr8n/extensions/action_view_extension.rb in tr8n-3.1.5 vs lib/tr8n/extensions/action_view_extension.rb in tr8n-3.1.6
- old
+ new
@@ -62,24 +62,13 @@
options = desc
tokens = options[:tokens] || {}
desc = options[:context] || ""
end
- begin
- url = request.url
- host = request.env['HTTP_HOST']
- source = "#{controller.class.name.underscore.gsub("_controller", "")}/#{controller.action_name}"
- rescue
- source = self.class.name
- url = nil
- host = 'localhost'
- end
-
- options.merge!(:source => source) unless options[:source]
options.merge!(:caller => caller)
- options.merge!(:url => url)
- options.merge!(:host => host)
+ options.merge!(:url => request.url)
+ options.merge!(:host => request.env['HTTP_HOST'])
unless Tr8n::Config.enabled?
return Tr8n::TranslationKey.substitute_tokens(label, tokens, options)
end
@@ -138,13 +127,10 @@
when :locale then lang.locale
else lang.full_name
end
if linked
- html << link_to(name.html_safe, :controller => "/tr8n/language",
- :action => :switch, :language_action => :switch_language,
- :locale => lang.locale,
- :source_url => opts[:source_url])
+ html << link_to(name.html_safe, "/tr8n/language/switch?locale=#{lang.locale}&language_action=switch_language&source_url=#{CGI.escape(opts[:source_url]||'')}")
else
html << name
end
html << "</span>"