i18n_page_title - Auto generation some page title.

i18n_page_title is page title generator by i18n.
You can write all page title by the yaml file for i18n if you use this pulgin.
Page title is generated by an action name.
 
Example here.
 

# app/helper/application_helper.rb
module ApplicationHelper
  include I18nPageTitleHelper
end

 

# app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
  <head>
    <title><%= page_title %> - Kint</title>
    <%= stylesheet_link_tag :all %>
    <%= javascript_include_tag :defaults %>
    <%= csrf_meta_tag %>
  </head>
  <body>

    <h1><%= page_title %></h1>
    <p id="notice"><%= notice %></p>

    <%= yield %>

  </body>
</html>

 

# config/locals/en.yml
en:
  page_titles:
    defaults:
      show: show
      new: create
      create: create
      edit: update
      update: update
      destory: destroy
    user_sessions_title: user session
    user_sessions:
      new: login
    users_title: account info

 
Generation rule here.

Action name: Page title
User#show: account info show
User#create: account info create
UserSession#new: login

Ruby Advent Calendar 2010 jp-en

This entry is for Ruby Advent Calendar jp-en: 2010 : ATND.
The previous post was from ujihisa(Sorry not to write the entry that related to GC).