acts_as_localizable 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,2 +1,56 @@
1
- acts_as_localizable README
1
+ =====================
2
+ Acts As Localizable
3
+ =====================
4
+ Acts As Localizable is an alternative to the globalize series of plugins. It enables the ability to localize fields in an ActiveRecord model.
2
5
 
6
+ It has the ability to be used with I18n or independently of it and is compatible with Rails 3.
7
+
8
+ ==============
9
+ Requirements
10
+ ==============
11
+ ActiveRecord
12
+ I18n
13
+ Rails( > 3.0.0beta4)
14
+
15
+ To install Acts As Localizable you can either install it as a plugin or a gem.
16
+
17
+ rails plugin install git://git@github.com:just1word/acts_as_localizable.git
18
+
19
+
20
+ Or you can use the acts_as_localizable gem in your Gemfile or just install it.
21
+
22
+
23
+ gem install acts_as_localizable
24
+
25
+
26
+ Once the plugin or gem is installed you need to create the LocalizedField table in your project. To do this run:
27
+
28
+
29
+ rails generate localized_fields
30
+ rake db:migrate
31
+
32
+ =====================
33
+ Translating Fields
34
+ =====================
35
+
36
+ In order for Acts As Localizable to work you must first notify the plugin which models you would like to localize. You can do this by simply adding a line to the top of your model:
37
+
38
+ class Post < ActiveRecord::Base
39
+ acts_as_localizable
40
+ end
41
+
42
+ This allows you to look at fields or set fields by using a localized property:
43
+
44
+
45
+ post.localized.title # => "Love"
46
+ post.localized(:es).title # => "Amor"
47
+
48
+ I18n.locale = :es
49
+ post.localized.title # => "Amor"
50
+
51
+ As can be seen above, you can specify which language you are requesting as an argument to the localized method, or if none is specified, it will use the locale set in the I18n gem.
52
+
53
+ To set a local title:
54
+
55
+ post.localized(:es).title = "Amor"
56
+ post.save
data/README.textile ADDED
@@ -0,0 +1,56 @@
1
+ h1. Acts As Localizable
2
+ Acts As Localizable is an alternative to the globalize series of plugins. It enables the ability to localize fields in an ActiveRecord model.
3
+
4
+ It has the ability to be used with I18n or independently of it and is compatible with Rails 3.
5
+
6
+ h2. Requirements
7
+
8
+ ActiveRecord
9
+ I18n
10
+ Rails( > 3.0.0beta4)
11
+
12
+ To install Acts As Localizable you can either install it as a plugin or a gem.
13
+ <pre><code>
14
+ rails plugin install git://git@github.com:just1word/acts_as_localizable.git
15
+ </code></pre>
16
+
17
+ Or you can use the acts_as_localizable gem in your Gemfile or just install it.
18
+
19
+ <pre><code>
20
+ gem install acts_as_localizable
21
+ </code></pre>
22
+
23
+ Once the plugin or gem is installed you need to create the LocalizedField table in your project. To do this run:
24
+
25
+ <pre><code>
26
+ rails generate localized_fields
27
+ rake db:migrate
28
+ </code></pre>
29
+
30
+ h2. Translating Fields
31
+
32
+ In order for Acts As Localizable to work you must first notify the plugin which models you would like to localize. You can do this by simply adding a line to the top of your model:
33
+ <pre><code>
34
+ class Post < ActiveRecord::Base
35
+ acts_as_localizable
36
+ end
37
+ </code></pre>
38
+
39
+ This allows you to look at fields or set fields by using a localized property:
40
+
41
+ <pre><code>
42
+ post.localized.title # => "Love"
43
+ post.localized(:es).title # => "Amor"
44
+
45
+ I18n.locale = :es
46
+ post.localized.title # => "Amor"
47
+ </code></pre>
48
+
49
+ As can be seen above, you can specify which language you are requesting as an argument to the localized method, or if none is specified, it will use the locale set in the I18n gem.
50
+
51
+ To set a local title:
52
+ <pre><code>
53
+ post.localized(:es).title = "Amor"
54
+ post.save
55
+ </code></pre>
56
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -5,17 +5,18 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_localizable}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["davydotcom"]
12
- s.date = %q{2010-11-10}
12
+ s.date = %q{2010-11-11}
13
13
  s.description = %q{Set ActiveRecord field values or retrieve them based on the I18n current locale or by manually specifying}
14
14
  s.email = %q{david.estes@just1word.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README",
18
- "README.rdoc"
18
+ "README.rdoc",
19
+ "README.textile"
19
20
  ]
20
21
  s.files = [
21
22
  ".document",
@@ -23,6 +24,7 @@ Gem::Specification.new do |s|
23
24
  "LICENSE",
24
25
  "README",
25
26
  "README.rdoc",
27
+ "README.textile",
26
28
  "Rakefile",
27
29
  "VERSION",
28
30
  "acts_as_localizable.gemspec",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_localizable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - davydotcom
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-10 00:00:00 -05:00
18
+ date: 2010-11-11 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,12 +42,14 @@ extra_rdoc_files:
42
42
  - LICENSE
43
43
  - README
44
44
  - README.rdoc
45
+ - README.textile
45
46
  files:
46
47
  - .document
47
48
  - .gitignore
48
49
  - LICENSE
49
50
  - README
50
51
  - README.rdoc
52
+ - README.textile
51
53
  - Rakefile
52
54
  - VERSION
53
55
  - acts_as_localizable.gemspec