Parent

ActionView::PathSet

Public Instance Methods

_find_template_internal(file_name, format, html_fallback = false) click to toggle source
# File lib/locale_rails/action_view.rb, line 17
def _find_template_internal(file_name, format, html_fallback = false)
  begin
    return find_template_without_locale_rails(file_name, format, html_fallback)
  rescue MissingTemplate => e
  end
  nil
end
find_template_with_locale_rails(original_template_path, format = nil, html_fallback = true) click to toggle source
# File lib/locale_rails/action_view.rb, line 25
 def find_template_with_locale_rails(original_template_path, format = nil, html_fallback = true)
  return original_template_path if original_template_path.respond_to?(:render)

  path = original_template_path.sub(/^\//, '')
  if m = path.match(/(.*)\.(\w+)$/)
    template_file_name, template_file_extension = m[1], m[2]
  else
    template_file_name = path
  end
 
  default = Locale.default.to_common
  Locale.candidates.each do |v|
    file_name = "#{template_file_name}_#{v}"
    ret = _find_template_internal(file_name, format)
    return ret if ret
    if v == default
      # When the user locale is the default locale, find no locale file such as index.html.erb.
      ret = _find_template_internal(template_file_name, format)
    end
    return ret if ret
  end
  find_template_without_locale_rails(original_template_path, format, html_fallback)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.