summaryrefslogtreecommitdiff
path: root/vendor/plugins/globalize2/README.textile
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
commit9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch)
tree8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /vendor/plugins/globalize2/README.textile
parent85a01e35274b8d4d4165a7b26bd7986e211246bb (diff)
parent1853082fcd8c067390c246f9daa01a9b47387497 (diff)
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'vendor/plugins/globalize2/README.textile')
-rw-r--r--vendor/plugins/globalize2/README.textile65
1 files changed, 0 insertions, 65 deletions
diff --git a/vendor/plugins/globalize2/README.textile b/vendor/plugins/globalize2/README.textile
deleted file mode 100644
index 7155a7c..0000000
--- a/vendor/plugins/globalize2/README.textile
+++ /dev/null
@@ -1,65 +0,0 @@
1h1. Globalize2
2
3Globalize2 is the successor of Globalize for Rails.
4
5It is compatible with and builds on the new "I18n api in Ruby on Rails":http://guides.rubyonrails.org/i18n.html. and adds model translations to ActiveRecord.
6
7Globalize2 is much more lightweight and compatible than its predecessor was. Model translations in Globalize2 use default ActiveRecord features and do not limit any ActiveRecord functionality any more.
8
9h2. Requirements
10
11ActiveRecord
12I18n
13
14(or Rails > 2.2)
15
16h2. Installation
17
18To install Globalize2 with its default setup just use:
19
20<pre><code>
21script/plugin install git://github.com/joshmh/globalize2.git
22</code></pre>
23
24h2. Model translations
25
26Model translations allow you to translate your models' attribute values. E.g.
27
28<pre><code>
29class Post < ActiveRecord::Base
30 translates :title, :text
31end
32</code></pre>
33
34Allows you to values for the attributes :title and :text per locale:
35
36<pre><code>
37I18n.locale = :en
38post.title # => Globalize2 rocks!
39
40I18n.locale = :he
41post.title # => גלובאלייז2 שולט!
42</code></pre>
43
44In order to make this work, you'll need to add the appropriate translation tables. Globalize2 comes with a handy helper method to help you do this. It's called @create_translation_table!@. Here's an example:
45
46<pre><code>
47class CreatePosts < ActiveRecord::Migration
48 def self.up
49 create_table :posts do |t|
50 t.timestamps
51 end
52 Post.create_translation_table! :title => :string, :text => :text
53 end
54 def self.down
55 drop_table :posts
56 Post.drop_translation_table!
57 end
58end
59</code></pre>
60
61Note that the ActiveRecord model @Post@ must already exist and have a @translates@ directive listing the translated fields.
62
63h2. Migration from Globalize
64
65See this script by Tomasz Stachewicz: http://gist.github.com/120867