Anybody who can help with a step by step howto in using globalize…
I followed this example:
http://globalize-rails.org/wiki/pages/example
First I’ve created the database for use in my application:
CREATE TABLE products
(
id
bigint(20) unsigned NOT NULL auto_increment,
name
varchar(12) NOT NULL default ‘’,
type
enum(‘Brace’,‘Belt’,‘Belt SoB’) default NULL,
collection
tinyint(3) unsigned default NULL,
statistics
tinyint(3) unsigned default NULL,
quality
enum(‘One layer grain’,‘One layer split’,‘Grain lined with
grain’,‘Split lined with split’,‘Grain lined with split’) default NULL,
sizes
set(‘85’,‘90’,‘95’,‘100’,‘105’,‘110’,‘115’,‘120’,‘130’,‘140’,‘150’,‘160’)
default NULL,
description
text NOT NULL,
comment
text NOT NULL,
image
blob,
PRIMARY KEY (id
),
UNIQUE KEY id
(id
),
KEY id_2
USING BTREE (id
)
) ENGINE=InnoDB;
Then I used a “script/generate scaffold product” to generate a general
template for my beginners application.
Now the description field in the database products should be available
in 3 or more languages. So I found that using Globalize would be a nice
idea.
Then I edited the app/models/product.rb file to be:
class Product < ActiveRecord::Base
translates :description
end
then I used the
script/plugin install
http://svn.globalize-rails.org/svn/globalize/globalize/trunk
and
script/generate globalize tiny
rake migrate
a lot of stuff happened in my mysql database, but know the question is
how to use the globalize plugin.
They give a test-class in the example given, but I don’t really gain any
knowledge from that.
Anybody who can help how to get my “description” multiple language
available - how should the controller look like and how should the view
be handled?
Thanks