rails_i18n_record 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- metadata +18 -130
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -44
- data/Rakefile +0 -38
- data/lib/generators/i18n_generator.rb +0 -26
- data/lib/generators/templates/migration.erb +0 -19
- data/lib/generators/templates/model.erb +0 -13
- data/lib/rails_i18n_record.rb +0 -6
- data/lib/rails_i18n_record/active_record/base.rb +0 -79
- data/lib/rails_i18n_record/railtie.rb +0 -9
- data/lib/rails_i18n_record/version.rb +0 -5
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/model.rb +0 -4
- data/test/dummy/app/models/model_translation.rb +0 -13
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120831205714_create_models.rb +0 -7
- data/test/dummy/db/migrate/20130404161713_create_models_i18n.rb +0 -19
- data/test/dummy/db/schema.rb +0 -35
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -499
- data/test/dummy/log/test.log +0 -2397
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/generators_test.rb +0 -24
- data/test/rails_i18n_record_test.rb +0 -9
- data/test/records_test.rb +0 -27
- data/test/test_helper.rb +0 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 71128b925bee279669fb738741a2ad80494887cf
|
4
|
+
data.tar.gz: 0a3cdf74207432351ee4381e84f5b9e4a8e745ee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 109acb2a2fa67c1d3f3466c04fbb76bfbfbf1c3eff746c22e631ad63a4e6729c0d7a022b2072b7a523094af4709c2024490411fbed6e5cf33ddea644d47caec4
|
7
|
+
data.tar.gz: 798684c21947d09f52e550eedd1945d77ed7ad5d52bc280c73287179462b85487b81eda40fa5ff6715e09a94853c9fa2ab769481ac22b93027baa46e65350444
|
metadata
CHANGED
@@ -1,170 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_i18n_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mattways
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: translatable_records
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.8
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.8
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: sqlite3
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
17
|
+
- - '>='
|
36
18
|
- !ruby/object:Gem::Version
|
37
19
|
version: '0'
|
38
|
-
type: :
|
20
|
+
type: :runtime
|
39
21
|
prerelease: false
|
40
22
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
23
|
requirements:
|
43
|
-
- -
|
24
|
+
- - '>='
|
44
25
|
- !ruby/object:Gem::Version
|
45
26
|
version: '0'
|
46
|
-
description:
|
47
|
-
translations.
|
27
|
+
description: This gem has been renamed to just "translatable_records".
|
48
28
|
email:
|
49
29
|
- contact@mattways.com
|
50
30
|
executables: []
|
51
31
|
extensions: []
|
52
32
|
extra_rdoc_files: []
|
53
|
-
files:
|
54
|
-
|
55
|
-
|
56
|
-
-
|
57
|
-
|
58
|
-
- lib/rails_i18n_record/railtie.rb
|
59
|
-
- lib/rails_i18n_record/version.rb
|
60
|
-
- lib/rails_i18n_record.rb
|
61
|
-
- MIT-LICENSE
|
62
|
-
- Rakefile
|
63
|
-
- README.rdoc
|
64
|
-
- test/dummy/app/assets/javascripts/application.js
|
65
|
-
- test/dummy/app/assets/stylesheets/application.css
|
66
|
-
- test/dummy/app/controllers/application_controller.rb
|
67
|
-
- test/dummy/app/helpers/application_helper.rb
|
68
|
-
- test/dummy/app/models/model.rb
|
69
|
-
- test/dummy/app/models/model_translation.rb
|
70
|
-
- test/dummy/app/views/layouts/application.html.erb
|
71
|
-
- test/dummy/config/application.rb
|
72
|
-
- test/dummy/config/boot.rb
|
73
|
-
- test/dummy/config/database.yml
|
74
|
-
- test/dummy/config/environment.rb
|
75
|
-
- test/dummy/config/environments/development.rb
|
76
|
-
- test/dummy/config/environments/production.rb
|
77
|
-
- test/dummy/config/environments/test.rb
|
78
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
79
|
-
- test/dummy/config/initializers/inflections.rb
|
80
|
-
- test/dummy/config/initializers/mime_types.rb
|
81
|
-
- test/dummy/config/initializers/secret_token.rb
|
82
|
-
- test/dummy/config/initializers/session_store.rb
|
83
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
84
|
-
- test/dummy/config/locales/en.yml
|
85
|
-
- test/dummy/config/routes.rb
|
86
|
-
- test/dummy/config.ru
|
87
|
-
- test/dummy/db/development.sqlite3
|
88
|
-
- test/dummy/db/migrate/20120831205714_create_models.rb
|
89
|
-
- test/dummy/db/migrate/20130404161713_create_models_i18n.rb
|
90
|
-
- test/dummy/db/schema.rb
|
91
|
-
- test/dummy/db/test.sqlite3
|
92
|
-
- test/dummy/log/development.log
|
93
|
-
- test/dummy/log/test.log
|
94
|
-
- test/dummy/public/404.html
|
95
|
-
- test/dummy/public/422.html
|
96
|
-
- test/dummy/public/500.html
|
97
|
-
- test/dummy/public/favicon.ico
|
98
|
-
- test/dummy/Rakefile
|
99
|
-
- test/dummy/README.rdoc
|
100
|
-
- test/dummy/script/rails
|
101
|
-
- test/generators_test.rb
|
102
|
-
- test/rails_i18n_record_test.rb
|
103
|
-
- test/records_test.rb
|
104
|
-
- test/test_helper.rb
|
105
|
-
homepage: https://github.com/mattways/rails_i18n_record
|
106
|
-
licenses: []
|
33
|
+
files: []
|
34
|
+
homepage: https://github.com/mattways/translatable_records
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
107
38
|
post_install_message:
|
108
39
|
rdoc_options: []
|
109
40
|
require_paths:
|
110
41
|
- lib
|
111
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
43
|
requirements:
|
114
|
-
- -
|
44
|
+
- - '>='
|
115
45
|
- !ruby/object:Gem::Version
|
116
46
|
version: '0'
|
117
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
48
|
requirements:
|
120
|
-
- -
|
49
|
+
- - '>='
|
121
50
|
- !ruby/object:Gem::Version
|
122
51
|
version: '0'
|
123
52
|
requirements: []
|
124
53
|
rubyforge_project:
|
125
|
-
rubygems_version:
|
54
|
+
rubygems_version: 2.0.3
|
126
55
|
signing_key:
|
127
|
-
specification_version:
|
128
|
-
summary:
|
129
|
-
test_files:
|
130
|
-
- test/dummy/app/assets/javascripts/application.js
|
131
|
-
- test/dummy/app/assets/stylesheets/application.css
|
132
|
-
- test/dummy/app/controllers/application_controller.rb
|
133
|
-
- test/dummy/app/helpers/application_helper.rb
|
134
|
-
- test/dummy/app/models/model.rb
|
135
|
-
- test/dummy/app/models/model_translation.rb
|
136
|
-
- test/dummy/app/views/layouts/application.html.erb
|
137
|
-
- test/dummy/config/application.rb
|
138
|
-
- test/dummy/config/boot.rb
|
139
|
-
- test/dummy/config/database.yml
|
140
|
-
- test/dummy/config/environment.rb
|
141
|
-
- test/dummy/config/environments/development.rb
|
142
|
-
- test/dummy/config/environments/production.rb
|
143
|
-
- test/dummy/config/environments/test.rb
|
144
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
145
|
-
- test/dummy/config/initializers/inflections.rb
|
146
|
-
- test/dummy/config/initializers/mime_types.rb
|
147
|
-
- test/dummy/config/initializers/secret_token.rb
|
148
|
-
- test/dummy/config/initializers/session_store.rb
|
149
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
150
|
-
- test/dummy/config/locales/en.yml
|
151
|
-
- test/dummy/config/routes.rb
|
152
|
-
- test/dummy/config.ru
|
153
|
-
- test/dummy/db/development.sqlite3
|
154
|
-
- test/dummy/db/migrate/20120831205714_create_models.rb
|
155
|
-
- test/dummy/db/migrate/20130404161713_create_models_i18n.rb
|
156
|
-
- test/dummy/db/schema.rb
|
157
|
-
- test/dummy/db/test.sqlite3
|
158
|
-
- test/dummy/log/development.log
|
159
|
-
- test/dummy/log/test.log
|
160
|
-
- test/dummy/public/404.html
|
161
|
-
- test/dummy/public/422.html
|
162
|
-
- test/dummy/public/500.html
|
163
|
-
- test/dummy/public/favicon.ico
|
164
|
-
- test/dummy/Rakefile
|
165
|
-
- test/dummy/README.rdoc
|
166
|
-
- test/dummy/script/rails
|
167
|
-
- test/generators_test.rb
|
168
|
-
- test/rails_i18n_record_test.rb
|
169
|
-
- test/records_test.rb
|
170
|
-
- test/test_helper.rb
|
56
|
+
specification_version: 4
|
57
|
+
summary: Renamed to just "translatable_records"
|
58
|
+
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2012 Mattways
|
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
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
{<img src="https://codeclimate.com/github/mattways/rails_i18n_record.png" />}[https://codeclimate.com/github/mattways/rails_i18n_record] {<img src="https://secure.travis-ci.org/mattways/rails_i18n_record.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mattways/rails_i18n_record] {<img src="https://gemnasium.com/mattways/rails_i18n_record.png" alt="Dependency Status" />}[https://gemnasium.com/mattways/rails_i18n_record]
|
2
|
-
|
3
|
-
= Rails I18n Record
|
4
|
-
|
5
|
-
Adds models, migrations and handy methods to ActiveRecord to deal with translations.
|
6
|
-
|
7
|
-
= Install
|
8
|
-
|
9
|
-
Put this line in your Gemfile:
|
10
|
-
gem 'rails_i18n_record'
|
11
|
-
|
12
|
-
Then bundle:
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
= Usage
|
16
|
-
|
17
|
-
First define the model and set the name of the fields you want to translate with the attr_translatable method:
|
18
|
-
attr_translatable :prop
|
19
|
-
|
20
|
-
Generate the translation model and migration for that model:
|
21
|
-
rails g i18n Model
|
22
|
-
|
23
|
-
Update the migration with the column for that field:
|
24
|
-
t.string :prop
|
25
|
-
|
26
|
-
Update your db:
|
27
|
-
rake db:migrate
|
28
|
-
|
29
|
-
(Now you can use that field of the model as usual and any change would be saved using the current I18n.locale)
|
30
|
-
|
31
|
-
If you want to get another translation:
|
32
|
-
model_instance.translation_by_locale :es
|
33
|
-
|
34
|
-
If you want to change the locale to something different than I18n.locale:
|
35
|
-
model_instance.with_locale :es
|
36
|
-
|
37
|
-
If you want to save multiple translations:
|
38
|
-
- f.object.translations.each do |t|
|
39
|
-
= f.fields_for 'translations_attributes[]', t do |ff|
|
40
|
-
= field_set_tag t("languages.#{t.locale}") do
|
41
|
-
%ul
|
42
|
-
%li
|
43
|
-
= ff.label :prop
|
44
|
-
= ff.text_field :prop
|
data/Rakefile
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
begin
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'RailsI18nRecord'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Bundler::GemHelper.install_tasks
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
|
30
|
-
Rake::TestTask.new(:test) do |t|
|
31
|
-
t.libs << 'lib'
|
32
|
-
t.libs << 'test'
|
33
|
-
t.pattern = 'test/**/*_test.rb'
|
34
|
-
t.verbose = false
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
task :default => :test
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
class I18nGenerator < Rails::Generators::NamedBase
|
4
|
-
|
5
|
-
include Rails::Generators::Migration
|
6
|
-
|
7
|
-
source_root File.expand_path('../templates', __FILE__)
|
8
|
-
|
9
|
-
def create_model
|
10
|
-
begin
|
11
|
-
@model = Object.const_get(class_name)
|
12
|
-
rescue NameError
|
13
|
-
@model = false
|
14
|
-
end
|
15
|
-
template 'model.erb', "app/models/#{file_name}_translation.rb"
|
16
|
-
end
|
17
|
-
|
18
|
-
def create_migration
|
19
|
-
migration_template 'migration.erb', "db/migrate/create_#{table_name}_i18n.rb"
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.next_migration_number(path)
|
23
|
-
Time.now.utc.strftime '%Y%m%d%H%M%S'
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class <%= "Create#{plural_name.camelize}I18n" %> < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
create_table <%= ":#{table_name}_i18n" %> do |t|
|
4
|
-
t.integer <%= ":#{singular_table_name}_id" %>, :null => false
|
5
|
-
t.string :locale, :null => false
|
6
|
-
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
add_index <%= ":#{table_name}_i18n" %>, <%= ":#{singular_table_name}_id" %>
|
10
|
-
add_index <%= ":#{table_name}_i18n" %>, :locale
|
11
|
-
|
12
|
-
add_index <%= ":#{table_name}_i18n" %>, :created_at
|
13
|
-
add_index <%= ":#{table_name}_i18n" %>, :updated_at
|
14
|
-
end
|
15
|
-
|
16
|
-
def down
|
17
|
-
drop_table <%= ":#{table_name}_i18n" %>
|
18
|
-
end
|
19
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class <%= "#{class_name}Translation" %> < ActiveRecord::Base
|
2
|
-
|
3
|
-
self.table_name = <%= ":#{table_name}_i18n" %>
|
4
|
-
|
5
|
-
attr_accessible :locale, <%= ":#{singular_table_name}_id" %>, <%= @model ? @model.instance_variable_get('@translatable_attrs').map{|a|":#{a}"}.join(', ') : '' %>
|
6
|
-
|
7
|
-
belongs_to <%= ":#{table_name}" %>
|
8
|
-
|
9
|
-
validates :locale, :presence => true
|
10
|
-
validates :locale, :inclusion => { :in => I18n.available_locales.map{|l|l.to_s} }
|
11
|
-
validates <%= ":#{singular_table_name}_id" %>, :uniqueness => { :scope => :locale }
|
12
|
-
|
13
|
-
end
|
data/lib/rails_i18n_record.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
module RailsI18nRecord
|
2
|
-
module ActiveRecord
|
3
|
-
module Base
|
4
|
-
module NonTranslatable
|
5
|
-
|
6
|
-
def translatable?
|
7
|
-
not defined?(@translatable_attrs).nil?
|
8
|
-
end
|
9
|
-
|
10
|
-
def attr_translatable(*args)
|
11
|
-
make_translatable unless translatable?
|
12
|
-
args.each do |name|
|
13
|
-
define_translatable_attribute_methods(name)
|
14
|
-
@translatable_attrs << name
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
protected
|
19
|
-
|
20
|
-
def make_translatable
|
21
|
-
send :include, RailsI18nRecord::ActiveRecord::Base::Translatable
|
22
|
-
default_scope :include => :translations
|
23
|
-
attr_accessible :translations_attributes
|
24
|
-
has_many :translations, :class_name => "#{name}Translation", :autosave => true, :dependent => :destroy
|
25
|
-
accepts_nested_attributes_for :translations
|
26
|
-
@translatable_attrs = []
|
27
|
-
end
|
28
|
-
|
29
|
-
def define_translatable_attribute_methods(attr)
|
30
|
-
['set', 'get'].each do |method|
|
31
|
-
send "define_translatable_attribute_method_#{method}", attr
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def define_translatable_attribute_method_set(attr)
|
36
|
-
define_method "#{attr}=" do |value|
|
37
|
-
t = translation_by_locale(current_locale)
|
38
|
-
t ? t.send("#{attr}=".to_sym, value) : translations.build(:locale => current_locale.to_s, attr.to_sym => value)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def define_translatable_attribute_method_get(attr)
|
43
|
-
['', '_was', '_changed?'].each do |suffix|
|
44
|
-
define_method "#{attr}#{suffix}" do
|
45
|
-
t = translation_by_locale(current_locale)
|
46
|
-
t ? t.send("#{attr}#{suffix}".to_sym) : nil
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
module Translatable
|
53
|
-
|
54
|
-
def with_locale(locale)
|
55
|
-
@locale = locale
|
56
|
-
end
|
57
|
-
|
58
|
-
def build_translations
|
59
|
-
I18n.available_locales.each do |locale|
|
60
|
-
t = translations.find_by_locale(locale)
|
61
|
-
translations.build :locale => locale.to_s unless t
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
protected
|
66
|
-
|
67
|
-
def current_locale
|
68
|
-
defined?(@locale).nil? ? I18n.locale.to_s : @locale
|
69
|
-
end
|
70
|
-
|
71
|
-
def translation_by_locale(locale)
|
72
|
-
t = translations.find { |t| t.locale == locale.to_s }
|
73
|
-
t ? t : translations.find_by_locale(locale)
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|