OSDN Git Service

installed gettext
authornomeu <nomeu@nomeu.org>
Tue, 8 Jun 2010 15:51:13 +0000 (00:51 +0900)
committernomeu <nomeu@nomeu.org>
Tue, 8 Jun 2010 15:51:13 +0000 (00:51 +0900)
15 files changed:
app/controllers/application_controller.rb
app/controllers/welcome_controller.rb [new file with mode: 0644]
app/helpers/welcome_helper.rb [new file with mode: 0644]
app/views/arcs/index.html.erb
app/views/layouts/arcs.html.erb
app/views/welcome/index.html.erb [new file with mode: 0644]
config/environment.rb
config/routes.rb
lib/tasks/gettext.rake [new file with mode: 0644]
locale/ja/LC_MESSAGES/nimono.mo [new file with mode: 0644]
po/ja/nimono.po [new file with mode: 0644]
po/nimono.pot [new file with mode: 0644]
public/index.html [deleted file]
test/functional/welcome_controller_test.rb [new file with mode: 0644]
test/unit/helpers/welcome_helper_test.rb [new file with mode: 0644]

index 6635a3f..711a909 100644 (file)
@@ -7,4 +7,5 @@ class ApplicationController < ActionController::Base
 
   # Scrub sensitive parameters from your log
   # filter_parameter_logging :password
+  init_gettext "nimono"
 end
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
new file mode 100644 (file)
index 0000000..f197c70
--- /dev/null
@@ -0,0 +1,7 @@
+class WelcomeController < ApplicationController
+  layout 'arcs'
+
+  def index
+  end
+
+end
diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb
new file mode 100644 (file)
index 0000000..eeead45
--- /dev/null
@@ -0,0 +1,2 @@
+module WelcomeHelper
+end
index e776fd4..a644157 100644 (file)
 <table class="list arcs">
   <thead>
   <tr>
-    <th>Code</th>
-    <th>Extname</th>
-    <th>Location</th>
-    <th>Summary</th>
-    <th>Origname</th>
+    <th><%= _'Arc|Code' %></th>
+    <th><%= _'Arc|Extname' %></th>
+    <th><%= _'Arc|Location' %></th>
+    <th><%= _'Arc|Summary' %></th>
+    <th><%= _'Arc|Origname' %></th>
   </tr>
   </thead>
 
index 34597e0..ea1dcb0 100644 (file)
@@ -9,14 +9,19 @@
 </head>
 <body>
 <div id="wrapper">
+  <div id="top-menu">
+    <div id="account">
+      <%= link_to "Home", root_path %>
+    </div>
+  </div>
   <div id="header">
     <h1>Miku Miku Dance Database</h1>
     <div id="main-menu">
       <ul>
-        <li><%= link_menu_to "arc", arcs_path %></li>
-        <li><%= link_menu_to "pmd", pmds_path %></li>
-        <li><%= link_menu_to "vmd", vmds_path %></li>
-        <li><%= link_menu_to "x", xes_path %></li>
+        <li><%= link_menu_to _("arc"), arcs_path %></li>
+        <li><%= link_menu_to _("pmd"), pmds_path %></li>
+        <li><%= link_menu_to _("vmd"), vmds_path %></li>
+        <li><%= link_menu_to _("x"), xes_path %></li>
       </ul>
     </div>
   </div>
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
new file mode 100644 (file)
index 0000000..0a01a01
--- /dev/null
@@ -0,0 +1,2 @@
+<h1>Welcome#index</h1>
+<p>Find me in app/views/welcome/index.html.erb</p>
index 7092a6f..554590c 100644 (file)
@@ -16,6 +16,11 @@ Rails::Initializer.run do |config|
 
   # Specify gems that this application depends on and have them installed with rake gems:install
   config.gem "will_paginate", :lib => "will_paginate"
+  config.gem "locale"
+  config.gem "locale_rails", :version => "2.0.5"
+  config.gem "gettext"
+  config.gem "gettext_activerecord", :version => "2.1.0"
+  config.gem "gettext_rails", :version => "2.1.0"
 
   # Only load the plugins named here, in the order given (default is alphabetical).
   # :all can be used as a placeholder for all plugins not explicitly named
index 7e67518..1ba33d7 100644 (file)
@@ -41,7 +41,7 @@ ActionController::Routing::Routes.draw do |map|
   #   end
 
   # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
-  map.root :controller => "welcome"
+  map.root :controller => "welcome"
 
   # See how all your routes lay out with "rake routes"
 
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake
new file mode 100644 (file)
index 0000000..eb54f7b
--- /dev/null
@@ -0,0 +1,11 @@
+desc "Update pot/po files."
+task :updatepo do
+  require 'gettext_rails/tools'
+  GetText.update_pofiles("nimono", Dir.glob("{app,config,lib}/**/*.{rb,erb}"), "nimono 1.0.0")
+end
+
+desc "Create mo-files"
+task :makemo do
+  require 'gettext_rails/tools'
+  GetText.create_mofiles
+end
diff --git a/locale/ja/LC_MESSAGES/nimono.mo b/locale/ja/LC_MESSAGES/nimono.mo
new file mode 100644 (file)
index 0000000..1bada4b
Binary files /dev/null and b/locale/ja/LC_MESSAGES/nimono.mo differ
diff --git a/po/ja/nimono.po b/po/ja/nimono.po
new file mode 100644 (file)
index 0000000..eaaf238
--- /dev/null
@@ -0,0 +1,133 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: nimono 1.0.0\n"
+"POT-Creation-Date: 2010-06-09 00:47+0900\n"
+"PO-Revision-Date: 2010-06-09 00:40+0900\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: app/models/arc.rb:-
+msgid "arc"
+msgstr "書庫"
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:14
+msgid "Arc|Code"
+msgstr "Code"
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:15
+msgid "Arc|Extname"
+msgstr "拡張子"
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:16
+msgid "Arc|Location"
+msgstr "所在"
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:17
+msgid "Arc|Summary"
+msgstr "要約"
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:18
+msgid "Arc|Origname"
+msgstr "Origname"
+
+#: app/models/arc.rb:-
+msgid "Arc|Created at"
+msgstr "作成日時"
+
+#: app/models/arc.rb:-
+msgid "Arc|Updated at"
+msgstr "更新日時"
+
+#: app/models/location.rb:-
+msgid "location"
+msgstr "所在"
+
+#: app/models/location.rb:-
+msgid "Location|Code"
+msgstr "Code"
+
+#: app/models/location.rb:-
+msgid "Location|Site"
+msgstr "Site"
+
+#: app/models/location.rb:-
+msgid "Location|Summary"
+msgstr "要約"
+
+#: app/models/location.rb:-
+msgid "Location|Created at"
+msgstr "作成日時"
+
+#: app/models/location.rb:-
+msgid "Location|Updated at"
+msgstr "更新日時"
+
+#: app/models/pmd.rb:-
+msgid "pmd"
+msgstr "pmd"
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Arc"
+msgstr "書庫"
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Path"
+msgstr "Path"
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Created at"
+msgstr "作成日時"
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Updated at"
+msgstr "更新日時"
+
+#: app/models/vmd.rb:-
+msgid "vmd"
+msgstr "vmd"
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Arc"
+msgstr "書庫"
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Path"
+msgstr "Path"
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Created at"
+msgstr "作成日時"
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Updated at"
+msgstr "更新日時"
+
+#: app/models/x.rb:-
+msgid "x"
+msgstr "x"
+
+#: app/models/x.rb:-
+msgid "X|Arc"
+msgstr "書庫"
+
+#: app/models/x.rb:-
+msgid "X|Path"
+msgstr "Path"
+
+#: app/models/x.rb:-
+msgid "X|Created at"
+msgstr "作成日時"
+
+#: app/models/x.rb:-
+msgid "X|Updated at"
+msgstr "更新日時"
diff --git a/po/nimono.pot b/po/nimono.pot
new file mode 100644 (file)
index 0000000..9f2fb04
--- /dev/null
@@ -0,0 +1,133 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: nimono 1.0.0\n"
+"POT-Creation-Date: 2010-06-09 00:47+0900\n"
+"PO-Revision-Date: 2010-06-09 00:40+0900\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: app/models/arc.rb:-
+msgid "arc"
+msgstr ""
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:14
+msgid "Arc|Code"
+msgstr ""
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:15
+msgid "Arc|Extname"
+msgstr ""
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:16
+msgid "Arc|Location"
+msgstr ""
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:17
+msgid "Arc|Summary"
+msgstr ""
+
+#: app/models/arc.rb:- app/views/arcs/index.html.erb:18
+msgid "Arc|Origname"
+msgstr ""
+
+#: app/models/arc.rb:-
+msgid "Arc|Created at"
+msgstr ""
+
+#: app/models/arc.rb:-
+msgid "Arc|Updated at"
+msgstr ""
+
+#: app/models/location.rb:-
+msgid "location"
+msgstr ""
+
+#: app/models/location.rb:-
+msgid "Location|Code"
+msgstr ""
+
+#: app/models/location.rb:-
+msgid "Location|Site"
+msgstr ""
+
+#: app/models/location.rb:-
+msgid "Location|Summary"
+msgstr ""
+
+#: app/models/location.rb:-
+msgid "Location|Created at"
+msgstr ""
+
+#: app/models/location.rb:-
+msgid "Location|Updated at"
+msgstr ""
+
+#: app/models/pmd.rb:-
+msgid "pmd"
+msgstr ""
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Arc"
+msgstr ""
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Path"
+msgstr ""
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Created at"
+msgstr ""
+
+#: app/models/pmd.rb:-
+msgid "Pmd|Updated at"
+msgstr ""
+
+#: app/models/vmd.rb:-
+msgid "vmd"
+msgstr ""
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Arc"
+msgstr ""
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Path"
+msgstr ""
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Created at"
+msgstr ""
+
+#: app/models/vmd.rb:-
+msgid "Vmd|Updated at"
+msgstr ""
+
+#: app/models/x.rb:-
+msgid "x"
+msgstr ""
+
+#: app/models/x.rb:-
+msgid "X|Arc"
+msgstr ""
+
+#: app/models/x.rb:-
+msgid "X|Path"
+msgstr ""
+
+#: app/models/x.rb:-
+msgid "X|Created at"
+msgstr ""
+
+#: app/models/x.rb:-
+msgid "X|Updated at"
+msgstr ""
diff --git a/public/index.html b/public/index.html
deleted file mode 100644 (file)
index 0dd5189..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-  <head>
-    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-    <title>Ruby on Rails: Welcome aboard</title>
-    <style type="text/css" media="screen">
-      body {
-        margin: 0;
-        margin-bottom: 25px;
-        padding: 0;
-        background-color: #f0f0f0;
-        font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
-        font-size: 13px;
-        color: #333;
-      }
-      
-      h1 {
-        font-size: 28px;
-        color: #000;
-      }
-      
-      a  {color: #03c}
-      a:hover {
-        background-color: #03c;
-        color: white;
-        text-decoration: none;
-      }
-      
-      
-      #page {
-        background-color: #f0f0f0;
-        width: 750px;
-        margin: 0;
-        margin-left: auto;
-        margin-right: auto;
-      }
-      
-      #content {
-        float: left;
-        background-color: white;
-        border: 3px solid #aaa;
-        border-top: none;
-        padding: 25px;
-        width: 500px;
-      }
-      
-      #sidebar {
-        float: right;
-        width: 175px;
-      }
-
-      #footer {
-        clear: both;
-      }
-      
-
-      #header, #about, #getting-started {
-        padding-left: 75px;
-        padding-right: 30px;
-      }
-
-
-      #header {
-        background-image: url("images/rails.png");
-        background-repeat: no-repeat;
-        background-position: top left;
-        height: 64px;
-      }
-      #header h1, #header h2 {margin: 0}
-      #header h2 {
-        color: #888;
-        font-weight: normal;
-        font-size: 16px;
-      }
-      
-      
-      #about h3 {
-        margin: 0;
-        margin-bottom: 10px;
-        font-size: 14px;
-      }
-      
-      #about-content {
-        background-color: #ffd;
-        border: 1px solid #fc0;
-        margin-left: -11px;
-      }
-      #about-content table {
-        margin-top: 10px;
-        margin-bottom: 10px;
-        font-size: 11px;
-        border-collapse: collapse;
-      }
-      #about-content td {
-        padding: 10px;
-        padding-top: 3px;
-        padding-bottom: 3px;
-      }
-      #about-content td.name  {color: #555}
-      #about-content td.value {color: #000}
-      
-      #about-content.failure {
-        background-color: #fcc;
-        border: 1px solid #f00;
-      }
-      #about-content.failure p {
-        margin: 0;
-        padding: 10px;
-      }
-      
-      
-      #getting-started {
-        border-top: 1px solid #ccc;
-        margin-top: 25px;
-        padding-top: 15px;
-      }
-      #getting-started h1 {
-        margin: 0;
-        font-size: 20px;
-      }
-      #getting-started h2 {
-        margin: 0;
-        font-size: 14px;
-        font-weight: normal;
-        color: #333;
-        margin-bottom: 25px;
-      }
-      #getting-started ol {
-        margin-left: 0;
-        padding-left: 0;
-      }
-      #getting-started li {
-        font-size: 18px;
-        color: #888;
-        margin-bottom: 25px;
-      }
-      #getting-started li h2 {
-        margin: 0;
-        font-weight: normal;
-        font-size: 18px;
-        color: #333;
-      }
-      #getting-started li p {
-        color: #555;
-        font-size: 13px;
-      }
-      
-      
-      #search {
-        margin: 0;
-        padding-top: 10px;
-        padding-bottom: 10px;
-        font-size: 11px;
-      }
-      #search input {
-        font-size: 11px;
-        margin: 2px;
-      }
-      #search-text {width: 170px}
-      
-      
-      #sidebar ul {
-        margin-left: 0;
-        padding-left: 0;
-      }
-      #sidebar ul h3 {
-        margin-top: 25px;
-        font-size: 16px;
-        padding-bottom: 10px;
-        border-bottom: 1px solid #ccc;
-      }
-      #sidebar li {
-        list-style-type: none;
-      }
-      #sidebar ul.links li {
-        margin-bottom: 5px;
-      }
-      
-    </style>
-    <script type="text/javascript" src="javascripts/prototype.js"></script>
-    <script type="text/javascript" src="javascripts/effects.js"></script>
-    <script type="text/javascript">
-      function about() {
-        if (Element.empty('about-content')) {
-          new Ajax.Updater('about-content', 'rails/info/properties', {
-            method:     'get',
-            onFailure:  function() {Element.classNames('about-content').add('failure')},
-            onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
-          });
-        } else {
-          new Effect[Element.visible('about-content') ? 
-            'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
-        }
-      }
-      
-      window.onload = function() {
-        $('search-text').value = '';
-        $('search').onsubmit = function() {
-          $('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
-        }
-      }
-    </script>
-  </head>
-  <body>
-    <div id="page">
-      <div id="sidebar">
-        <ul id="sidebar-items">
-          <li>
-            <form id="search" action="http://www.google.com/search" method="get">
-              <input type="hidden" name="hl" value="en" />
-              <input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
-              <input type="submit" value="Search" /> the Rails site
-            </form>
-          </li>
-        
-          <li>
-            <h3>Join the community</h3>
-            <ul class="links">
-              <li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
-              <li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
-              <li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
-            </ul>
-          </li>
-          
-          <li>
-            <h3>Browse the documentation</h3>
-            <ul class="links">
-              <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
-              <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
-              <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
-              <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
-            </ul>
-          </li>
-        </ul>
-      </div>
-
-      <div id="content">
-        <div id="header">
-          <h1>Welcome aboard</h1>
-          <h2>You&rsquo;re riding Ruby on Rails!</h2>
-        </div>
-
-        <div id="about">
-          <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3>
-          <div id="about-content" style="display: none"></div>
-        </div>
-        
-        <div id="getting-started">
-          <h1>Getting started</h1>
-          <h2>Here&rsquo;s how to get rolling:</h2>
-          
-          <ol>          
-            <li>
-              <h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
-              <p>To see all available options, run it without parameters.</p>
-            </li>
-            
-            <li>
-              <h2>Set up a default route and remove or rename this file</h2>
-              <p>Routes are set up in config/routes.rb.</p>
-            </li>
-
-            <li>
-              <h2>Create your database</h2>
-              <p>Run <tt>rake db:migrate</tt> to create your database. If you're not using SQLite (the default), edit <tt>config/database.yml</tt> with your username and password.</p>
-            </li>
-          </ol>
-        </div>
-      </div>
-      
-      <div id="footer">&nbsp;</div>
-    </div>
-  </body>
-</html>
\ No newline at end of file
diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb
new file mode 100644 (file)
index 0000000..92c7f5a
--- /dev/null
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class WelcomeControllerTest < ActionController::TestCase
+  # Replace this with your real tests.
+  test "the truth" do
+    assert true
+  end
+end
diff --git a/test/unit/helpers/welcome_helper_test.rb b/test/unit/helpers/welcome_helper_test.rb
new file mode 100644 (file)
index 0000000..d6ded59
--- /dev/null
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class WelcomeHelperTest < ActionView::TestCase
+end