1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
Ruby-GetText Sample blog for Ruby on Rails and Ruby-GetText-Package.
Requirement
-----------
* ruby-1.8.3 or later
* rails-1.0.0 or later
* rake
* mysql
Installation
------------
1. Setup rails and mysql, Ruby-GetText-Package.
2. Create DB and a table
* using db/mysql.sql.
a) $ mysqladmin -u <root> create blog
b) $ mysql -u <root> blog < db/mysql.sql
* using db/postgresql.sql.
a) $ su - postgres
b) $ createdb blog
c) $ psql blog < db/postgresql.sql
* for testing, change the dbname: blog => blog_test.
3. Edit config/database.xml
4. Create mofiles using rake.
$ rake makemo
5. (One click ruby installer for Windonws user only)
On command prompt:
> set PATH=c:\ruby\bin;%PATH%
(If you have GTK+ and Ruby/GTK2)
> set PATH=c:\gtk\bin;%PATH%
6. Then run the http server.
$ ruby script/server
Access the http server from WWW browser:
http://localhost:3000/blog
Files
-----
* lib/tasks/gettext.rake
- a rake file for Ruby-GetText-Package.
You need to modify this for your application.
":makemo" task which creates mo files from po files.
":updatepo" task which updates pot/po files from po files.
If there is no po/*pot files, it creates po/*.pot.
* app/controllers/application.rb
- Bind a textdomain to your application.
The most important file in this sample.
* app/controllers/blog_controller.rb
- The main controller which localized.
* app/models/article.rb
- a model which localized.
* app/helpers/blog_helper.rb
- a localized helper.
* app/views/**/*.rhtml
- Localized rhtml files.
* vendor/plugins/gettext/*
- a localized "Vendor plugin". It has its own textdomain.
- See vendor/plugins/gettext/README for more details.
* po/* (blog.po[t])
- Catalog files which translators edit. They are convert to
mofiles by "rake makemo".
- blog.po[t] is for blog_controller and its views.
* db/mysql.sql
- a sql to create a database table for mysql.
* db/postgresql.sql
- a sql to create a database table for postgresql.
* public/stylesheets/blog.css
- a CSS file for this sample.
* test/functional/blog_controller_test.rb
- a test script.
* others
- Generated by rails and I've not touched them.
|