translatable 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rvmrc +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +67 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +118 -0
- data/Rakefile +39 -0
- data/VERSION +1 -0
- data/lib/translatable.rb +210 -0
- data/test/helper.rb +27 -0
- data/test/news.rb +58 -0
- data/test/support/active_record.rb +8 -0
- data/test/support/database_cleaner.rb +13 -0
- data/test/test_translatable.rb +188 -0
- data/translatable.gemspec +88 -0
- metadata +199 -0
data/.document
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create 1.9.2@translatable
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "activerecord", "~> 3.1.0"
|
4
|
+
gem "i18n"
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem "test-spec"
|
8
|
+
gem "yard", "~> 0.6.0"
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.6.4"
|
11
|
+
|
12
|
+
gem "debugger", "~> 1.1.3", :platform => :ruby_19
|
13
|
+
gem "simplecov", "~> 0.6.4", :platform => :ruby_19
|
14
|
+
|
15
|
+
gem 'ruby-debug', :platform => :ruby_18
|
16
|
+
gem "rcov", "~> 1.0.0", :platform => :ruby_18
|
17
|
+
|
18
|
+
gem "database_cleaner", "~> 0.7.2"
|
19
|
+
gem "sqlite3", "~> 1.3.6"
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.1.8)
|
5
|
+
activesupport (= 3.1.8)
|
6
|
+
builder (~> 3.0.0)
|
7
|
+
i18n (~> 0.6)
|
8
|
+
activerecord (3.1.8)
|
9
|
+
activemodel (= 3.1.8)
|
10
|
+
activesupport (= 3.1.8)
|
11
|
+
arel (~> 2.2.3)
|
12
|
+
tzinfo (~> 0.3.29)
|
13
|
+
activesupport (3.1.8)
|
14
|
+
multi_json (>= 1.0, < 1.3)
|
15
|
+
arel (2.2.3)
|
16
|
+
builder (3.0.0)
|
17
|
+
columnize (0.3.6)
|
18
|
+
database_cleaner (0.7.2)
|
19
|
+
debugger (1.1.4)
|
20
|
+
columnize (>= 0.3.1)
|
21
|
+
debugger-linecache (~> 1.1.1)
|
22
|
+
debugger-ruby_core_source (~> 1.1.3)
|
23
|
+
debugger-linecache (1.1.2)
|
24
|
+
debugger-ruby_core_source (>= 1.1.1)
|
25
|
+
debugger-ruby_core_source (1.1.3)
|
26
|
+
git (1.2.5)
|
27
|
+
i18n (0.6.0)
|
28
|
+
jeweler (1.6.4)
|
29
|
+
bundler (~> 1.0)
|
30
|
+
git (>= 1.2.5)
|
31
|
+
rake
|
32
|
+
linecache (0.46)
|
33
|
+
rbx-require-relative (> 0.0.4)
|
34
|
+
multi_json (1.2.0)
|
35
|
+
rake (0.9.2.2)
|
36
|
+
rbx-require-relative (0.0.9)
|
37
|
+
rcov (1.0.0)
|
38
|
+
ruby-debug (0.10.4)
|
39
|
+
columnize (>= 0.1)
|
40
|
+
ruby-debug-base (~> 0.10.4.0)
|
41
|
+
ruby-debug-base (0.10.4)
|
42
|
+
linecache (>= 0.3)
|
43
|
+
simplecov (0.6.4)
|
44
|
+
multi_json (~> 1.0)
|
45
|
+
simplecov-html (~> 0.5.3)
|
46
|
+
simplecov-html (0.5.3)
|
47
|
+
sqlite3 (1.3.6)
|
48
|
+
test-spec (0.10.0)
|
49
|
+
tzinfo (0.3.33)
|
50
|
+
yard (0.6.8)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
activerecord (~> 3.1.0)
|
57
|
+
bundler (~> 1.0.0)
|
58
|
+
database_cleaner (~> 0.7.2)
|
59
|
+
debugger (~> 1.1.3)
|
60
|
+
i18n
|
61
|
+
jeweler (~> 1.6.4)
|
62
|
+
rcov (~> 1.0.0)
|
63
|
+
ruby-debug
|
64
|
+
simplecov (~> 0.6.4)
|
65
|
+
sqlite3 (~> 1.3.6)
|
66
|
+
test-spec
|
67
|
+
yard (~> 0.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 E-Max
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
== Translatable
|
2
|
+
|
3
|
+
{<img src="https://secure.travis-ci.org/kot-begemot/translatable.png" />}[http://travis-ci.org/kot-begemot/translatable]
|
4
|
+
|
5
|
+
Whenever you have to deal with multilingual project, where users may fill the post
|
6
|
+
in different languages, or you have to provide the content in the same way, this
|
7
|
+
gem will save your day.
|
8
|
+
This is ActiveRecord version.
|
9
|
+
|
10
|
+
== What it does?
|
11
|
+
|
12
|
+
This gem interferes heavily with I18n.
|
13
|
+
First you need to do is to define the model that accepts multilingual context (there
|
14
|
+
might me more than one of them). There you have to specify the fields that are translatable
|
15
|
+
and some other details.
|
16
|
+
Well,that is pretty much it. Now you can create a model with translations, and
|
17
|
+
switching current locale you will get different translations.
|
18
|
+
If there is no translation available, you will get nil.
|
19
|
+
|
20
|
+
Check out the examples below.
|
21
|
+
|
22
|
+
== Examples
|
23
|
+
|
24
|
+
Migrations:
|
25
|
+
|
26
|
+
class CreateTables < ActiveRecord::Migration
|
27
|
+
def up
|
28
|
+
create_table(:authors) do |t|
|
29
|
+
t.string :name, :null => false
|
30
|
+
|
31
|
+
t.timestamps
|
32
|
+
end
|
33
|
+
|
34
|
+
create_table(:translatable_news) do |t|
|
35
|
+
t.string :title, :null => false
|
36
|
+
t.string :content, :null => false
|
37
|
+
t.integer :origin_id, :null => false
|
38
|
+
t.string :locale, :null => false, :limit => 2
|
39
|
+
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table(:news) do |t|
|
44
|
+
t.integer :author_id
|
45
|
+
|
46
|
+
t.timestamps
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def down
|
51
|
+
drop_table(:authors)
|
52
|
+
drop_table(:translatable_news)
|
53
|
+
drop_table(:news)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
Models:
|
58
|
+
|
59
|
+
class Author < ActiveRecord::Base
|
60
|
+
validates :name, :presence => true
|
61
|
+
end
|
62
|
+
|
63
|
+
class TranslatableNews < ActiveRecord::Base
|
64
|
+
validates :title, :content, :presence => true
|
65
|
+
validates :title, :uniqueness => true
|
66
|
+
|
67
|
+
attr_accessible :title, :content
|
68
|
+
end
|
69
|
+
|
70
|
+
class News < ActiveRecord::Base
|
71
|
+
|
72
|
+
belongs_to :author
|
73
|
+
|
74
|
+
is :translatable do
|
75
|
+
translatable :title
|
76
|
+
translatable :content
|
77
|
+
translatable_model TranslatedNews
|
78
|
+
translatable_origin :origin_id
|
79
|
+
end
|
80
|
+
|
81
|
+
attr_accessible :author_id, :author
|
82
|
+
end
|
83
|
+
|
84
|
+
An example of application:
|
85
|
+
|
86
|
+
news = News.create :translations => [{title: "Resent News", content: "That is where the text goes", locale: "en"}]
|
87
|
+
news.translations.create title: "Заголовок", content: "Содержание",locale: "ru"
|
88
|
+
|
89
|
+
news.content
|
90
|
+
# => "That is where the text goes"
|
91
|
+
|
92
|
+
::I18n.locale = "ru"
|
93
|
+
news.content
|
94
|
+
# => "Сюди идет текст"
|
95
|
+
|
96
|
+
::I18n.locale = "de"
|
97
|
+
news.content
|
98
|
+
# => nil
|
99
|
+
|
100
|
+
::I18n.locale = ::I18n.default_locale
|
101
|
+
news.content
|
102
|
+
# => "That is where the text goes"
|
103
|
+
|
104
|
+
== Contributing to translatable
|
105
|
+
|
106
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
107
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
108
|
+
* Fork the project
|
109
|
+
* Start a feature/bugfix branch
|
110
|
+
* Commit and push until you are happy with your contribution
|
111
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
112
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
113
|
+
|
114
|
+
== Copyright
|
115
|
+
|
116
|
+
Copyright (c) 2012 E-Max. See LICENSE.txt for
|
117
|
+
further details.
|
118
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "translatable"
|
18
|
+
gem.homepage = "http://github.com/kot-begemot/translatable"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{An esay way to manage the translations for datamapper}
|
21
|
+
gem.description = %Q{This game was build to make whole proccess of working with translation for DM to be almost invisble. That was THE AIM.}
|
22
|
+
gem.email = "max@studentify.nl"
|
23
|
+
gem.authors = ["E-Max"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
require 'yard'
|
38
|
+
YARD::Rake::YardocTask.new
|
39
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/translatable.rb
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'i18n'
|
3
|
+
|
4
|
+
module ActiveRecord
|
5
|
+
###
|
6
|
+
# In order to made the model Translatable, an additional fields should
|
7
|
+
# should be added first to it. Here is an example of it might be implemented:
|
8
|
+
#
|
9
|
+
# Examples:
|
10
|
+
#
|
11
|
+
# class Author < ActiveRecord::Base
|
12
|
+
# validates :name, :presence => true
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# class TranslatableNews < ActiveRecord::Base
|
16
|
+
# validates :title, :content, :presence => true
|
17
|
+
# validates :title, :uniqueness => true
|
18
|
+
#
|
19
|
+
# attr_accessible :title, :content
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# class News < ActiveRecord::Base
|
23
|
+
#
|
24
|
+
# belongs_to :author
|
25
|
+
#
|
26
|
+
# is :translatable do
|
27
|
+
# translatable :title
|
28
|
+
# translatable :content
|
29
|
+
# translatable_model TranslatedNews
|
30
|
+
# translatable_origin :origin_id
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# attr_accessible :author_id, :author
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# An example of application:
|
37
|
+
#
|
38
|
+
# news = News.create :translations_attributes => [{title: "Resent News", content: "That is where the text goes", locale: "en"}]
|
39
|
+
# news.translations.create title: "Заголовок", content: "Содержание",locale: "ru"
|
40
|
+
#
|
41
|
+
# news.content
|
42
|
+
# # => "That is where the text goes"
|
43
|
+
#
|
44
|
+
# ::I18n.locale = "ru"
|
45
|
+
# news.content
|
46
|
+
# # => "Сюди идет текст"
|
47
|
+
#
|
48
|
+
# ::I18n.locale = "de"
|
49
|
+
# news.content
|
50
|
+
# # => nil
|
51
|
+
#
|
52
|
+
# ::I18n.locale = ::I18n.default_locale
|
53
|
+
# news.content
|
54
|
+
# # => "That is where the text goes"
|
55
|
+
#
|
56
|
+
module Translatable
|
57
|
+
|
58
|
+
def translatable
|
59
|
+
extend ActiveRecord::Translatable::ClassMethods
|
60
|
+
include ActiveRecord::Translatable::InstanceMethods
|
61
|
+
|
62
|
+
translatable_define_hash
|
63
|
+
yield
|
64
|
+
translatable_register
|
65
|
+
end
|
66
|
+
|
67
|
+
module ClassMethods
|
68
|
+
|
69
|
+
protected
|
70
|
+
|
71
|
+
###
|
72
|
+
# Fields that are translatable.
|
73
|
+
# Those fields should be defined in the original model including all the related params.
|
74
|
+
# Examples:
|
75
|
+
#
|
76
|
+
# translatable_property :title, String, required: true, unique: true
|
77
|
+
# translatable_property :content, Text
|
78
|
+
#
|
79
|
+
# NB! Will raise an error if there was no fields specified
|
80
|
+
#
|
81
|
+
def translatable *args
|
82
|
+
(@translatable[:properties] ||= []) << args
|
83
|
+
end
|
84
|
+
|
85
|
+
###
|
86
|
+
# Defines model that will be treated as translation handler.
|
87
|
+
# Model can be defined as String, Symbol or Constant.
|
88
|
+
# Examples:
|
89
|
+
#
|
90
|
+
# translated_model TranslatedNews
|
91
|
+
# translated_model "TranslatedNews"
|
92
|
+
# translated_model :TranslatedNews
|
93
|
+
#
|
94
|
+
# Default: Translatable<ModelName>
|
95
|
+
#
|
96
|
+
def translatable_model model_name
|
97
|
+
@translatable[:model] = translatable_model_prepared model_name
|
98
|
+
end
|
99
|
+
|
100
|
+
###
|
101
|
+
# Define the key that the translation will be used for belongs_to association,
|
102
|
+
# to communicate with original model
|
103
|
+
# Example:
|
104
|
+
#
|
105
|
+
# translatable_origin :news
|
106
|
+
#
|
107
|
+
# Default: :origin
|
108
|
+
#
|
109
|
+
def translatable_origin origin_key
|
110
|
+
@translatable[:origin] = translatable_origin_prepared origin_key
|
111
|
+
end
|
112
|
+
|
113
|
+
###
|
114
|
+
# Define the key that the translation will be used for belongs_to association,
|
115
|
+
# to communicate with original model
|
116
|
+
# Example:
|
117
|
+
#
|
118
|
+
# translatable_origin :language
|
119
|
+
#
|
120
|
+
# Default: :locale
|
121
|
+
#
|
122
|
+
def translatable_locale locale_attr
|
123
|
+
@translatable[:locale] = translatable_locale_prepared locale_attr
|
124
|
+
end
|
125
|
+
|
126
|
+
###
|
127
|
+
# Returns Model as a constant that deals with translations
|
128
|
+
def translatable_model_prepared model_name = nil
|
129
|
+
model_constant = model_name
|
130
|
+
model_constant ||= "Translatable#{self.name}"
|
131
|
+
model_constant.to_s.constantize
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
def translatable_origin_prepared origin_key = nil
|
136
|
+
origin_key || "origin"
|
137
|
+
end
|
138
|
+
|
139
|
+
def translatable_locale_prepared locale = nil
|
140
|
+
locale || "locale"
|
141
|
+
end
|
142
|
+
|
143
|
+
###
|
144
|
+
# Define hash that contains all the translations
|
145
|
+
def translatable_define_hash
|
146
|
+
@translatable = {}
|
147
|
+
end
|
148
|
+
|
149
|
+
###
|
150
|
+
# Handles all the registring routine, defining methods,
|
151
|
+
# properties, and everything else
|
152
|
+
def translatable_register
|
153
|
+
raise ArgumentError.new("At least one property should be defined") if [nil, []].include?(@translatable[:properties])
|
154
|
+
[:model,:origin,:locale].each { |hash_key| @translatable[hash_key] ||= send "translatable_#{hash_key}_prepared" }
|
155
|
+
|
156
|
+
translatable_register_properties_for_origin
|
157
|
+
translatable_register_properties_for_translatable
|
158
|
+
end
|
159
|
+
|
160
|
+
###
|
161
|
+
# Handle the routine to define all th required stuff on the original maodel
|
162
|
+
def translatable_register_properties_for_origin
|
163
|
+
has_many :translations, :class_name => @translatable[:model].name, :foreign_key => :"#{@translatable[:origin]}_id"
|
164
|
+
accepts_nested_attributes_for :translations
|
165
|
+
attr_accessible :translations_attributes
|
166
|
+
|
167
|
+
@translatable[:properties].each do |p|
|
168
|
+
self.module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
169
|
+
def #{p.first}
|
170
|
+
current_translation.try(:#{p.first})
|
171
|
+
end
|
172
|
+
RUBY
|
173
|
+
end
|
174
|
+
|
175
|
+
self.module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
176
|
+
def current_translation
|
177
|
+
if translatable_locale_changed?
|
178
|
+
@translatable_locale = ::I18n.locale.to_s
|
179
|
+
@current_translation = translations.where(:#{@translatable[:locale]} => @translatable_locale).first
|
180
|
+
end
|
181
|
+
@current_translation
|
182
|
+
end
|
183
|
+
protected :current_translation
|
184
|
+
RUBY
|
185
|
+
end
|
186
|
+
|
187
|
+
def translatable_register_properties_for_translatable
|
188
|
+
@translatable[:model].module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
189
|
+
validates :#{@translatable[:locale]}, :presence => true
|
190
|
+
validates :#{@translatable[:locale]}, :uniqueness => { :scope => :#{@translatable[:origin]}_id }
|
191
|
+
|
192
|
+
belongs_to :#{@translatable[:origin]}, :class_name => "#{self.name}"
|
193
|
+
|
194
|
+
attr_accessible :#{@translatable[:locale]}, :#{@translatable[:origin]}_id
|
195
|
+
RUBY
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
module InstanceMethods
|
200
|
+
|
201
|
+
protected
|
202
|
+
|
203
|
+
def translatable_locale_changed?
|
204
|
+
@translatable_locale.to_s != ::I18n.locale.to_s
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
ActiveRecord::Base.extend ActiveRecord::Translatable
|
data/test/helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
if RUBY_VERSION >= '1.9.0'
|
4
|
+
require "debugger"
|
5
|
+
else
|
6
|
+
require 'ruby-debug'
|
7
|
+
end
|
8
|
+
|
9
|
+
begin
|
10
|
+
Bundler.setup(:default, :development)
|
11
|
+
rescue Bundler::BundlerError => e
|
12
|
+
$stderr.puts e.message
|
13
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
14
|
+
exit e.status_code
|
15
|
+
end
|
16
|
+
require 'test/unit'
|
17
|
+
|
18
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
19
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
20
|
+
require 'translatable'
|
21
|
+
|
22
|
+
require File.expand_path("support/active_record", File.dirname(__FILE__))
|
23
|
+
require File.expand_path("support/database_cleaner", File.dirname(__FILE__))
|
24
|
+
|
25
|
+
class Test::Unit::TestCase
|
26
|
+
include OrmSetup
|
27
|
+
end
|
data/test/news.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'translatable'
|
3
|
+
|
4
|
+
class CreateTables < ActiveRecord::Migration
|
5
|
+
def up
|
6
|
+
create_table(:authors) do |t|
|
7
|
+
t.string :name, :null => false
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
create_table(:translatable_news) do |t|
|
13
|
+
t.string :title, :null => false
|
14
|
+
t.string :content, :null => false
|
15
|
+
t.integer :origin_id, :null => false
|
16
|
+
t.string :locale, :null => false, :limit => 2
|
17
|
+
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
|
21
|
+
create_table(:news) do |t|
|
22
|
+
t.integer :author_id
|
23
|
+
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def down
|
29
|
+
drop_table(:authors)
|
30
|
+
drop_table(:translatable_news)
|
31
|
+
drop_table(:news)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
CreateTables.migrate(:up)
|
36
|
+
|
37
|
+
class Author < ActiveRecord::Base
|
38
|
+
validates :name, :presence => true
|
39
|
+
end
|
40
|
+
|
41
|
+
class TranslatableNews < ActiveRecord::Base
|
42
|
+
validates :title, :content, :presence => true
|
43
|
+
validates :title, :uniqueness => true
|
44
|
+
|
45
|
+
attr_accessible :title, :content
|
46
|
+
end
|
47
|
+
|
48
|
+
class News < ActiveRecord::Base
|
49
|
+
|
50
|
+
belongs_to :author
|
51
|
+
|
52
|
+
translatable do
|
53
|
+
translatable :title
|
54
|
+
translatable :content
|
55
|
+
end
|
56
|
+
|
57
|
+
attr_accessible :author_id, :author
|
58
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'helper'
|
3
|
+
require 'news'
|
4
|
+
|
5
|
+
class TestDmTranslatable < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
before_setup
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
after_teardown
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_translatable_hash_is_defined
|
16
|
+
th = News.instance_variable_get :@translatable
|
17
|
+
|
18
|
+
assert_kind_of Hash, th
|
19
|
+
assert th.has_key?(:properties)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_translatable_hash_has_default_model
|
23
|
+
assert_equal ::TranslatableNews, News.send(:translatable_model_prepared, 'TranslatableNews')
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_translatable_assepts_constant_as_model
|
27
|
+
assert_equal ::TranslatableNews, News.send(:translatable_model_prepared, ::TranslatableNews)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_translatable_assepts_sting_as_model
|
31
|
+
assert_equal ::TranslatableNews, News.send(:translatable_model_prepared, "TranslatableNews")
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_translatable_assepts_symbol_as_model
|
35
|
+
assert_equal ::TranslatableNews, News.send(:translatable_model_prepared, :TranslatableNews)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_instance_respond_to_translatable_methods
|
39
|
+
news = News.new
|
40
|
+
|
41
|
+
assert news.respond_to?(:title), "title methods is missing for News instance"
|
42
|
+
assert news.respond_to?(:content), "content methods is missing for News instance"
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_translated_instance_has_translatable_methods
|
46
|
+
news = TranslatableNews.new
|
47
|
+
|
48
|
+
assert news.respond_to?(:title), "Title method is missing for TranslatableNews instance"
|
49
|
+
assert news.respond_to?(:content), "Content method is missing for TranslatableNews instance"
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_translated_instance_has_relation_to_origin
|
53
|
+
news = TranslatableNews.new
|
54
|
+
|
55
|
+
assert news.respond_to?(:locale), "Locale method is missing for TranslatableNews instance"
|
56
|
+
assert news.respond_to?(:origin_id), "Origin methods is missing for TranslatableNews instance"
|
57
|
+
assert news.respond_to?(:origin), "Origin methods is missing for TranslatableNews instance"
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_create_without_translation
|
61
|
+
news = News.create
|
62
|
+
|
63
|
+
assert news.persisted?
|
64
|
+
assert_nil TranslatableNews.last
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_create_translated_with_translation
|
68
|
+
news = News.create
|
69
|
+
t_news = TranslatableNews.create :title => "Заголовок", :content => "Содержание", :locale => "ru", :origin_id => news.id
|
70
|
+
|
71
|
+
assert t_news.persisted?
|
72
|
+
|
73
|
+
t_news = TranslatableNews.last
|
74
|
+
assert_equal news.id, t_news.origin_id
|
75
|
+
assert_equal "Заголовок", t_news.title
|
76
|
+
assert_equal "Содержание", t_news.content
|
77
|
+
assert_equal "ru", t_news.locale
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_create_with_translation
|
81
|
+
news = News.create :translations_attributes => [{ :title => "Заголовок", :content => "Содержание", :locale => "ru"}]
|
82
|
+
|
83
|
+
assert news.persisted?
|
84
|
+
|
85
|
+
t_news = TranslatableNews.last
|
86
|
+
assert_equal news.id, t_news.origin_id.to_i
|
87
|
+
assert_equal "Заголовок", t_news.title
|
88
|
+
assert_equal "Содержание", t_news.content
|
89
|
+
assert_equal "ru", t_news.locale
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_create_with_translation_with_multiple_locales
|
93
|
+
news = News.create :translations_attributes => [{ :title => "Заголовок", :content => "Содержание", :locale => "ru"},
|
94
|
+
{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
|
95
|
+
|
96
|
+
assert news.persisted?
|
97
|
+
|
98
|
+
t_news = TranslatableNews.first
|
99
|
+
assert_equal news.id, t_news.origin_id.to_i
|
100
|
+
assert_equal "Заголовок", t_news.title
|
101
|
+
assert_equal "Содержание", t_news.content
|
102
|
+
assert_equal "ru", t_news.locale
|
103
|
+
|
104
|
+
t_news = TranslatableNews.last
|
105
|
+
assert_equal news.id, t_news.origin_id.to_i
|
106
|
+
assert_equal "Resent News", t_news.title
|
107
|
+
assert_equal "That is where the text goes", t_news.content
|
108
|
+
assert_equal "en", t_news.locale
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_access_of_default_translation
|
112
|
+
news = News.create :translations_attributes => [{:title => "Заголовок", :content => "Содержание", :locale => "ru"},
|
113
|
+
{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
|
114
|
+
|
115
|
+
assert news.persisted?
|
116
|
+
|
117
|
+
assert_equal "Resent News", news.title
|
118
|
+
assert_equal "That is where the text goes", news.content
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_access_of_other_translation
|
122
|
+
news = News.create :translations_attributes => [{:title => "Заголовок", :content => "Содержание", :locale => "ru"},
|
123
|
+
{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
|
124
|
+
|
125
|
+
assert news.persisted?
|
126
|
+
|
127
|
+
::I18n.locale = :ru
|
128
|
+
assert_equal "Заголовок", news.title
|
129
|
+
assert_equal "Содержание", news.content
|
130
|
+
::I18n.locale = ::I18n.default_locale
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_adding_the_translation
|
134
|
+
news = News.create :translations_attributes => [{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
|
135
|
+
|
136
|
+
assert news.persisted?
|
137
|
+
|
138
|
+
t_news = news.translations.create :title => "Заголовок", :content => "Содержание",:locale => "ru"
|
139
|
+
|
140
|
+
assert t_news.persisted?
|
141
|
+
assert t_news.persisted?
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_getting_different_translations
|
145
|
+
news = News.create :translations_attributes => [{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
|
146
|
+
|
147
|
+
assert news.persisted?
|
148
|
+
|
149
|
+
t_news = news.translations.create :title => "Заголовок", :content => "Содержание",:locale => "ru"
|
150
|
+
assert t_news.persisted?
|
151
|
+
|
152
|
+
::I18n.locale = ::I18n.default_locale
|
153
|
+
|
154
|
+
assert_equal "Resent News", news.title
|
155
|
+
assert_equal "That is where the text goes", news.content
|
156
|
+
|
157
|
+
::I18n.locale = :ru
|
158
|
+
|
159
|
+
assert_equal "Заголовок", news.title
|
160
|
+
assert_equal "Содержание", news.content
|
161
|
+
::I18n.locale = ::I18n.default_locale
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_access_unexisting_translation
|
165
|
+
news = News.create :translations_attributes => [{:title => "Заголовок", :content => "Содержание", :locale => "ru"},
|
166
|
+
{:title => "Resent News", :content => "That is where the text goes", :locale => "en"}]
|
167
|
+
|
168
|
+
assert news.persisted?
|
169
|
+
|
170
|
+
::I18n.locale = :de
|
171
|
+
assert_nil news.title
|
172
|
+
assert_nil news.content
|
173
|
+
::I18n.locale = ::I18n.default_locale
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_errors_on_translation_creation
|
177
|
+
news = News.create :translations_attributes => [{:title => "Заголовок", :content => "Содержание", :locale => "ru"},
|
178
|
+
{:title => "Resent News", :content => "That is where the text goes", :locale => ""}]
|
179
|
+
|
180
|
+
assert news.new_record?
|
181
|
+
|
182
|
+
assert_equal ["Translations locale can't be blank"], news.errors.full_messages
|
183
|
+
|
184
|
+
news.translations.each do |t|
|
185
|
+
assert t.new_record?
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "translatable"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["E-Max"]
|
12
|
+
s.date = "2012-08-17"
|
13
|
+
s.description = "This game was build to make whole proccess of working with translation for DM to be almost invisble. That was THE AIM."
|
14
|
+
s.email = "max@studentify.nl"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rvmrc",
|
22
|
+
".travis.yml",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/translatable.rb",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/news.rb",
|
32
|
+
"test/support/active_record.rb",
|
33
|
+
"test/support/database_cleaner.rb",
|
34
|
+
"test/test_translatable.rb",
|
35
|
+
"translatable.gemspec"
|
36
|
+
]
|
37
|
+
s.homepage = "http://github.com/kot-begemot/translatable"
|
38
|
+
s.licenses = ["MIT"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = "1.8.10"
|
41
|
+
s.summary = "An esay way to manage the translations for datamapper"
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3.1.0"])
|
48
|
+
s.add_runtime_dependency(%q<i18n>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<test-spec>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
51
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
52
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
53
|
+
s.add_development_dependency(%q<debugger>, ["~> 1.1.3"])
|
54
|
+
s.add_development_dependency(%q<simplecov>, ["~> 0.6.4"])
|
55
|
+
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<rcov>, ["~> 1.0.0"])
|
57
|
+
s.add_development_dependency(%q<database_cleaner>, ["~> 0.7.2"])
|
58
|
+
s.add_development_dependency(%q<sqlite3>, ["~> 1.3.6"])
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<activerecord>, ["~> 3.1.0"])
|
61
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
62
|
+
s.add_dependency(%q<test-spec>, [">= 0"])
|
63
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
64
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
66
|
+
s.add_dependency(%q<debugger>, ["~> 1.1.3"])
|
67
|
+
s.add_dependency(%q<simplecov>, ["~> 0.6.4"])
|
68
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rcov>, ["~> 1.0.0"])
|
70
|
+
s.add_dependency(%q<database_cleaner>, ["~> 0.7.2"])
|
71
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3.6"])
|
72
|
+
end
|
73
|
+
else
|
74
|
+
s.add_dependency(%q<activerecord>, ["~> 3.1.0"])
|
75
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
76
|
+
s.add_dependency(%q<test-spec>, [">= 0"])
|
77
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
78
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
79
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
80
|
+
s.add_dependency(%q<debugger>, ["~> 1.1.3"])
|
81
|
+
s.add_dependency(%q<simplecov>, ["~> 0.6.4"])
|
82
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
83
|
+
s.add_dependency(%q<rcov>, ["~> 1.0.0"])
|
84
|
+
s.add_dependency(%q<database_cleaner>, ["~> 0.7.2"])
|
85
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3.6"])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
metadata
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: translatable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- E-Max
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-17 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activerecord
|
16
|
+
requirement: &80002540 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *80002540
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: i18n
|
27
|
+
requirement: &80002250 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *80002250
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: test-spec
|
38
|
+
requirement: &80001990 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *80001990
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: yard
|
49
|
+
requirement: &80001750 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.6.0
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *80001750
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bundler
|
60
|
+
requirement: &80001510 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.0.0
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *80001510
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: &80001270 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.6.4
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *80001270
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: debugger
|
82
|
+
requirement: &80001030 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.1.3
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *80001030
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: simplecov
|
93
|
+
requirement: &80000790 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 0.6.4
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *80000790
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: ruby-debug
|
104
|
+
requirement: &80000530 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *80000530
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rcov
|
115
|
+
requirement: &80000290 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 1.0.0
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *80000290
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: database_cleaner
|
126
|
+
requirement: &80000040 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.7.2
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *80000040
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: sqlite3
|
137
|
+
requirement: &79999790 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ~>
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.3.6
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *79999790
|
146
|
+
description: This game was build to make whole proccess of working with translation
|
147
|
+
for DM to be almost invisble. That was THE AIM.
|
148
|
+
email: max@studentify.nl
|
149
|
+
executables: []
|
150
|
+
extensions: []
|
151
|
+
extra_rdoc_files:
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.rdoc
|
154
|
+
files:
|
155
|
+
- .document
|
156
|
+
- .rvmrc
|
157
|
+
- .travis.yml
|
158
|
+
- Gemfile
|
159
|
+
- Gemfile.lock
|
160
|
+
- LICENSE.txt
|
161
|
+
- README.rdoc
|
162
|
+
- Rakefile
|
163
|
+
- VERSION
|
164
|
+
- lib/translatable.rb
|
165
|
+
- test/helper.rb
|
166
|
+
- test/news.rb
|
167
|
+
- test/support/active_record.rb
|
168
|
+
- test/support/database_cleaner.rb
|
169
|
+
- test/test_translatable.rb
|
170
|
+
- translatable.gemspec
|
171
|
+
homepage: http://github.com/kot-begemot/translatable
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
post_install_message:
|
175
|
+
rdoc_options: []
|
176
|
+
require_paths:
|
177
|
+
- lib
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
+
none: false
|
180
|
+
requirements:
|
181
|
+
- - ! '>='
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
segments:
|
185
|
+
- 0
|
186
|
+
hash: 75519581
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 1.8.10
|
196
|
+
signing_key:
|
197
|
+
specification_version: 3
|
198
|
+
summary: An esay way to manage the translations for datamapper
|
199
|
+
test_files: []
|