OSDN Git Service

i18n
authornomeu <nomeu@users.sourceforge.jp>
Wed, 6 Jul 2011 10:34:06 +0000 (19:34 +0900)
committernomeu <nomeu@users.sourceforge.jp>
Wed, 6 Jul 2011 10:34:06 +0000 (19:34 +0900)
Gemfile
Gemfile.lock
app/helpers/application_helper.rb
app/views/arcs/index.html.erb
app/views/arcs/show.html.erb
app/views/pmds/index.html.erb
app/views/pmds/show.html.erb
config/application.rb
config/locales/translation_ja.yml [new file with mode: 0644]
spec/views/arcs/show.html.erb_spec.rb [new file with mode: 0644]
spec/views/pmds/show.html.erb_spec.rb [new file with mode: 0644]

diff --git a/Gemfile b/Gemfile
index 3a0b562..75e9719 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -15,3 +15,6 @@ group :development, :test do
   gem 'rspec-rails', '2.6.1'
   # gem 'webrat'
 end
+group :development do
+  gem 'i18n_generators'
+end
index 3e06ca2..c83e1eb 100644 (file)
@@ -34,6 +34,7 @@ GEM
     erubis (2.6.6)
       abstract (>= 1.0.0)
     i18n (0.5.0)
+    i18n_generators (1.0.3)
     mail (2.2.19)
       activesupport (>= 2.3.6)
       i18n (>= 0.4.0)
@@ -84,6 +85,7 @@ PLATFORMS
   ruby
 
 DEPENDENCIES
+  i18n_generators
   pg (= 0.10.1)
   rails (= 3.0.6)
   rspec-rails (= 2.6.1)
index 75eacbf..1e01ea2 100644 (file)
@@ -14,7 +14,7 @@ module ApplicationHelper
   def current_headmenu?(options)
     url = url_for(options)
     re = Regexp.new(Regexp.escape(url) + '($|[/?])')
-    re.match(@controller.request.request_uri)
+    re.match(controller.request.fullpath)
   end
 
   def link_menu_to(name, options = {}, html_options = {}, *parameters_for_method_reference, &block)
@@ -24,4 +24,7 @@ module ApplicationHelper
     end
     link_to name, options, html_options, *parameters_for_method_reference, &block
   end
+  def _(name)
+    t 'activerecord.attributes.' + name.underscore.tr('|', '.')
+  end
 end
index 57e0a3e..bf4e201 100644 (file)
@@ -2,11 +2,11 @@
   <p>
     <%= _'Arc|Code' %> or <%= _'Arc|Summary' %><br />
     <%= f.text_field :text %>
-    <%= f.submit _("Search") %>
+    <%= f.submit t("search") %>
   </p>
 <% end %>
 <p>
-  Total <%=h @arcs.total_entries %>
+  Total <%= @arcs.total_entries %>
 </p>
 <table class="list arcs">
   <thead>
   <tbody>
 <% for arc in @arcs %>
   <tr class="<%= cycle('odd', 'even') %>">
-    <td><%=link_to h(arc.code), arc %></td>
-    <td><%=h arc.extname %></td>
-    <td><%=h arc.location.code %></td>
-    <td><%=h(arc.locked? ? 'yes' : 'no') %></td>
-    <td><%=h arc.summary %></td>
-    <td><%=h arc.origname %></td>
+    <td><%=link_to arc.code, arc %></td>
+    <td><%= arc.extname %></td>
+    <td><%= arc.location.code %></td>
+    <td><%= arc.locked? ? 'yes' : 'no' %></td>
+    <td><%= arc.summary %></td>
+    <td><%= arc.origname %></td>
   </tr>
 <% end %>
   </tbody>
index 3b3db86..fc86cef 100644 (file)
@@ -1,57 +1,57 @@
 <p>
-  <b><%= 'Arc|Code' %>:</b>
-  <%=h @arc.code %>
+  <b><%= _'Arc|Code' %>:</b>
+  <%= @arc.code %>
 </p>
 
 <p>
-  <b><%= 'Arc|Extname' %>:</b>
-  <%=h @arc.extname %>
+  <b><%= _'Arc|Extname' %>:</b>
+  <%= @arc.extname %>
 </p>
 
 <p>
-  <b><%= 'Arc|Location' %>:</b>
-  <%=h @arc.location.code %>
+  <b><%= _'Arc|Location' %>:</b>
+  <%= @arc.location.code %>
 </p>
 
 <p>
-  <b><%= 'Arc|Locked' %>:</b>
-  <%=h(@arc.locked? ? 'yes' : 'no') %>
+  <b><%= _'Arc|Locked' %>:</b>
+  <%= @arc.locked? ? 'yes' : 'no' %>
 </p>
 
 <p>
-  <b><%= 'Arc|Url' %>:</b>
-  <%=h @arc.url %>
+  <b><%= _'Arc|Url' %>:</b>
+  <%= @arc.url %>
 </p>
 
 <p>
-  <b><%= 'Arc|Summary' %>:</b>
-  <%=h @arc.summary %>
+  <b><%= _'Arc|Summary' %>:</b>
+  <%= @arc.summary %>
 </p>
 
 <p>
-  <b><%= 'Arc|Origname' %>:</b>
-  <%=h @arc.origname %>
+  <b><%= _'Arc|Origname' %>:</b>
+  <%= @arc.origname %>
 </p>
 
 <%-unless @arc.thumbs.empty?-%>
 <p>
-  <b><%= 'Arc|Thumbs' %>:</b>
+  <b><%= _'Arc|Thumbs' %>:</b>
 </p>
 <table class="list thumbs">
   <thead>
   <tr>
-    <th><%= 'Thumb|Video' %></th>
-    <th><%= 'Thumb|Title' %></th>
-    <th><%= 'Thumb|Description' %></th>
+    <th><%= _'Thumb|Video' %></th>
+    <th><%= _'Thumb|Title' %></th>
+    <th><%= _'Thumb|Description' %></th>
   </tr>
   </thead>
 
   <tbody>
 <% @arc.thumbs.each do |thumb| %>
   <tr class="<%= cycle('odd', 'even') %>">
-    <td><%=link_to h(thumb.video_id), thumb %></td>
-    <td><%=h thumb.title %></td>
-    <td><%=h truncate(thumb.description) %></td>
+    <td><%=link_to thumb.video_id, thumb %></td>
+    <td><%= thumb.title %></td>
+    <td><%= truncate(thumb.description) %></td>
   </tr>
 <% end %>
   </tbody>
 
 <%-unless @arc.pmds.empty?-%>
 <p>
-  <b><%= 'Arc|Pmds' %>:</b>
+  <b><%= _'Arc|Pmds' %>:</b>
 </p>
 <table class="list pmds">
   <thead>
   <tr>
-    <th><%= 'Pmd|Path' %></th>
+    <th><%= _'Pmd|Path' %></th>
     <th></th>
   </tr>
   </thead>
@@ -73,8 +73,8 @@
   <tbody>
 <% for pmd in @arc.pmds %>
   <tr class="<%= cycle('odd', 'even') %>">
-    <td><%=h pmd.path %></td>
-    <td><%= link_to _('Show'), pmd %></td>
+    <td><%= pmd.path %></td>
+    <td><%= link_to t('show'), pmd %></td>
   </tr>
 <% end %>
   </tbody>
 
 <%-unless @arc.vmds.empty?-%>
 <p>
-  <b><%= 'Arc|Vmds' %>:</b>
+  <b><%= _'Arc|Vmds' %>:</b>
 </p>
 <table class="list vmds">
   <thead>
   <tr>
-    <th><%= 'Vmd|Path' %></th>
+    <th><%= _'Vmd|Path' %></th>
     <th></th>
   </tr>
   </thead>
@@ -96,8 +96,8 @@
   <tbody>
 <% for vmd in @arc.vmds %>
   <tr class="<%= cycle('odd', 'even') %>">
-    <td><%=h vmd.path %></td>
-    <td><%= link_to _('Show'), vmd %></td>
+    <td><%= vmd.path %></td>
+    <td><%= link_to t('show'), vmd %></td>
   </tr>
 <% end %>
   </tbody>
 
 <%-unless @arc.xes.empty?-%>
 <p>
-  <b><%= 'Arc|Xes' %>:</b>
+  <b><%= _'Arc|Xes' %>:</b>
 </p>
 <table class="list xes">
   <thead>
   <tr>
-    <th><%= 'X|Path' %></th>
+    <th><%= _'X|Path' %></th>
     <th></th>
   </tr>
   </thead>
   <tbody>
 <% for x in @arc.xes %>
   <tr class="<%= cycle('odd', 'even') %>">
-    <td><%=h x.path %></td>
-    <td><%= link_to _('Show'), x %></td>
+    <td><%= x.path %></td>
+    <td><%= link_to t('show'), x %></td>
   </tr>
 <% end %>
   </tbody>
index 80c8d68..ebdd4c6 100644 (file)
@@ -2,11 +2,11 @@
   <p>
     <%= _'Pmd|Path' %><br />
     <%= f.text_field :path %>
-    <%= f.submit _("Search") %>
+    <%= f.submit t("search") %>
   </p>
 <% end %>
 <p>
-  Total <%=h @pmds.total_entries %>
+  Total <%= @pmds.total_entries %>
 </p>
 <table class="list pmds">
   <thead>
@@ -19,8 +19,8 @@
   <tbody>
 <% for pmd in @pmds %>
   <tr class="<%= cycle('odd', 'even') %>">
-    <td><%=pmd.arc ? link_to(h(pmd.arc.code), pmd.arc) : '(none)' %></td>
-    <td><%=h pmd.path %></td>
+    <td><%= pmd.arc ? link_to(pmd.arc.code, pmd.arc) : '(none)' %></td>
+    <td><%= pmd.path %></td>
   </tr>
 <% end %>
   </tbody>
index 370b3ef..993658f 100644 (file)
@@ -1,9 +1,9 @@
 <p>
   <b><%= _'Pmd|Path' %>:</b>
-  <%=h @pmd.path %>
+  <%= @pmd.path %>
 </p>
 
 <p>
   <b>含まれる<%= _'Pmd|Arc' %>:</b>
-  <%=link_to h(@pmd.arc.code), @pmd.arc %>
+  <%=link_to @pmd.arc.code, @pmd.arc %>
 </p>
index 4e554a1..55363f9 100644 (file)
@@ -40,6 +40,6 @@ module Nimono
   
     # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
     # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
-    # config.i18n.default_locale = :de
+    config.i18n.default_locale = :ja
   end
 end
diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml
new file mode 100644 (file)
index 0000000..4db7112
--- /dev/null
@@ -0,0 +1,59 @@
+ja:
+  activerecord:
+    models:
+      arc: "書庫"
+      arc_thumb: "書庫動画関連"
+      location: "ロダ"
+      pmd: "モデル"
+      thumb: "動画"
+      user: "User"
+      vmd: "モーション"
+      x: "アクセサリ"
+
+    attributes:
+      arc:
+        code: "Code"
+        extname: "拡張子"
+        summary: "要約"
+        origname: "Origname"
+        locked: "Locked"
+        pmds: Pmds
+        location: "ロダ"
+        vmds: Vmds
+        xes: Xes
+        thumbs: "動画"
+        arc_thumbs: "書庫動画関連"
+
+      arc_thumb:
+        thumb: "動画"
+        arc: "書庫"
+
+      location:
+        code: "Code"
+        site: "Site"
+        summary: "要約"
+
+      pmd:
+        path: "Path"
+        arc: "書庫"
+
+      thumb:
+        title: "タイトル"
+        description: "説明文"
+        arcs: Arcs
+        arc_thumbs: "書庫動画関連"
+
+      user:
+        login: "ログイン"
+        password: "パスワード"
+
+      vmd:
+        path: "Path"
+        arc: "書庫"
+
+      x:
+        path: "Path"
+        arc: "書庫"
+
+  search: "検索"
+  show: "詳細"
diff --git a/spec/views/arcs/show.html.erb_spec.rb b/spec/views/arcs/show.html.erb_spec.rb
new file mode 100644 (file)
index 0000000..c24aa42
--- /dev/null
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe "arcs/show.html.erb" do
+  before do
+    @location = stub_model(Location)
+    @arc = stub_model(Arc, :location => @location)
+    assign :arc, @arc
+  end
+  it do
+    render
+  end
+end
diff --git a/spec/views/pmds/show.html.erb_spec.rb b/spec/views/pmds/show.html.erb_spec.rb
new file mode 100644 (file)
index 0000000..6f0afb7
--- /dev/null
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe "pmds/show.html.erb" do
+  before do
+    @arc = stub_model(Arc)
+    @pmd = stub_model(Pmd, :arc => @arc)
+    assign :pmd, @pmd
+  end
+  it do
+    render
+  end
+end