]> git.openstreetmap.org Git - rails.git/blob - app/helpers/title_helper.rb
Quote translations to stop them looking like numbers
[rails.git] / app / helpers / title_helper.rb
1 require "htmlentities"
2
3 module TitleHelper
4   def self.coder
5     @coder ||= HTMLEntities.new
6   end
7
8   def set_title(title = nil)
9     if title
10       @title = TitleHelper.coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
11       response.headers["X-Page-Title"] = ERB::Util.u(@title + " | " + t("layouts.project_name.title"))
12     else
13       @title = title
14       response.headers["X-Page-Title"] = ERB::Util.u(t("layouts.project_name.title"))
15     end
16   end
17 end