class Middleman::CoreExtensions::Internationalization

def url_for(path_or_resource, options={})

def url_for(path_or_resource, options={})
  locale = options.delete(:locale) || ::I18n.locale
  opts = options.dup
  should_relativize = opts.key?(:relative) ? opts[:relative] : config[:relative_links]
  opts[:relative] = false
  href = super(path_or_resource, opts)
  final_path = if result = extensions[:i18n].localized_path(href, locale)
    result
  else
    # Should we log the missing file?
    href
  end
  opts[:relative] = should_relativize
  begin
    super(final_path, opts)
  rescue RuntimeError
    super(path_or_resource, options)
  end
end