tolk 4.1.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/tolk/locale.rb +19 -11
- data/app/views/tolk/{_blank_canva.svg → _blank_canva.html.erb} +0 -0
- data/app/views/tolk/{_empty.svg → _empty.html.erb} +0 -0
- data/app/views/tolk/{_houra.svg → _houra.html.erb} +0 -0
- data/app/views/tolk/{_no_data.svg → _no_data.html.erb} +0 -0
- data/app/views/tolk/locales/all.html.erb +1 -1
- data/app/views/tolk/locales/index.html.erb +1 -1
- data/app/views/tolk/locales/show.html.erb +1 -1
- data/app/views/tolk/searches/show.html.erb +1 -1
- data/lib/tolk/config.rb +3 -0
- data/lib/tolk/sync.rb +10 -0
- data/lib/tolk/version.rb +1 -1
- metadata +68 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16e13f007c1439906c3231b8f392450bb0a5537b6ef7b9f04b6ecc33475131b2
|
4
|
+
data.tar.gz: 90014d2dde967571b20d112584ff2bb5b69e4e75f0ba45eff8e24cbe9746e461
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f66f126b8023ed812ee3f1a5e8a28a9f7392a77b7cf6af9b5a58b2e1e3e87081a1eef484939833424acdb18e2bf0992d8214be56fbb199f8f536b259cd966704
|
7
|
+
data.tar.gz: 66d9c79259a92f84cdbcea223142ebce7ae445ceb350119c751a6e9070ea1610baf3e5d611b9b8d0d3fcb4207a61975a9553545edda2169edf9f0effd1531aeb
|
data/app/models/tolk/locale.rb
CHANGED
@@ -107,7 +107,9 @@ module Tolk
|
|
107
107
|
phrases = phrases.where('tolk_phrases.id NOT IN (?)', existing_ids) if existing_ids.present?
|
108
108
|
|
109
109
|
result = phrases.public_send(pagination_method, page)
|
110
|
-
if Rails.version
|
110
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
|
111
|
+
ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
|
112
|
+
elsif Rails.version =~ /^4\.0/
|
111
113
|
ActiveRecord::Associations::Preloader.new result, :translations
|
112
114
|
else
|
113
115
|
ActiveRecord::Associations::Preloader.new().preload(result, :translations)
|
@@ -143,7 +145,9 @@ module Tolk
|
|
143
145
|
# phrases = phrases.scoped(:conditions => ['tolk_phrases.id NOT IN (?) AND tolk_phrases.id IN(?)', existing_ids, found_translations_ids]) if existing_ids.present?
|
144
146
|
phrases = phrases.where(['tolk_phrases.id NOT IN (?) AND tolk_phrases.id IN(?)', existing_ids, found_translations_ids]) if existing_ids.present?
|
145
147
|
result = phrases.public_send(pagination_method, page)
|
146
|
-
if Rails.version
|
148
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
|
149
|
+
ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
|
150
|
+
elsif Rails.version =~ /^4\.0/
|
147
151
|
ActiveRecord::Associations::Preloader.new result, :translations
|
148
152
|
else
|
149
153
|
ActiveRecord::Associations::Preloader.new().preload(result, :translations)
|
@@ -153,14 +157,14 @@ module Tolk
|
|
153
157
|
end
|
154
158
|
|
155
159
|
def to_hash
|
156
|
-
data = translations.
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
160
|
+
data = translations.includes(:phrase).references(:phrases).order(phrases.arel_table[:key]).
|
161
|
+
each_with_object({}) do |translation, locale|
|
162
|
+
if translation.phrase.key.include?(".")
|
163
|
+
locale.deep_merge!(unsquish(translation.phrase.key, translation.value))
|
164
|
+
else
|
165
|
+
locale[translation.phrase.key] = translation.value
|
166
|
+
end
|
162
167
|
end
|
163
|
-
end
|
164
168
|
{ name => data }
|
165
169
|
end
|
166
170
|
|
@@ -186,7 +190,9 @@ module Tolk
|
|
186
190
|
def translations_with_html
|
187
191
|
translations = self.translations.all(:conditions => "tolk_translations.text LIKE '%>%' AND
|
188
192
|
tolk_translations.text LIKE '%<%' AND tolk_phrases.key NOT LIKE '%_html'", :joins => :phrase)
|
189
|
-
if Rails.version
|
193
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
|
194
|
+
ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
|
195
|
+
elsif Rails.version =~ /^4\.0/
|
190
196
|
ActiveRecord::Associations::Preloader.new translations, :phrase
|
191
197
|
else
|
192
198
|
ActiveRecord::Associations::Preloader.new().preload(translations, :phrase)
|
@@ -230,7 +236,9 @@ module Tolk
|
|
230
236
|
phrase.translation = phrase.translations.for(self)
|
231
237
|
end
|
232
238
|
|
233
|
-
if Rails.version
|
239
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7')
|
240
|
+
ActiveRecord::Associations::Preloader.new(records: result, associations: :translations).call
|
241
|
+
elsif Rails.version =~ /^4\.0/
|
234
242
|
ActiveRecord::Associations::Preloader.new result, :translations
|
235
243
|
else
|
236
244
|
ActiveRecord::Associations::Preloader.new().preload(result, :translations)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/tolk/config.rb
CHANGED
@@ -20,6 +20,9 @@ module Tolk
|
|
20
20
|
# reject files of type xxx.en.yml when syncing locales
|
21
21
|
attr_accessor :block_xxx_en_yml_locale_files
|
22
22
|
|
23
|
+
# specify an array of files to skip ["devise"] will skip devise.<locale>.yml when syncing locales.
|
24
|
+
attr_accessor :ignore_locale_files
|
25
|
+
|
23
26
|
# strip translation texts automatically
|
24
27
|
attr_accessor :strip_texts
|
25
28
|
|
data/lib/tolk/sync.rb
CHANGED
@@ -25,6 +25,16 @@ module Tolk
|
|
25
25
|
translations_files = translations_files.reject(&locale_block_filter)
|
26
26
|
end
|
27
27
|
|
28
|
+
if Tolk.config.ignore_locale_files.present?
|
29
|
+
locale_block_filter = Proc.new do |file_name|
|
30
|
+
directory_path = Rails.root.join('config', 'locales', 'final_separator').to_s.gsub("final_separator", "")
|
31
|
+
normalized_file_name = file_name.gsub(directory_path, "").split('.').first
|
32
|
+
Tolk.config.ignore_locale_files.include?(normalized_file_name)
|
33
|
+
end
|
34
|
+
translations_files = translations_files.reject(&locale_block_filter)
|
35
|
+
end
|
36
|
+
|
37
|
+
|
28
38
|
I18n.backend.load_translations(translations_files)
|
29
39
|
else
|
30
40
|
I18n.backend.send :init_translations unless I18n.backend.initialized? # force load
|
data/lib/tolk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tolk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
- Emilio Tagua
|
10
10
|
- Thomas Darde
|
11
11
|
- Ferran Basora
|
12
|
-
autorequire:
|
12
|
+
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -29,47 +29,47 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '5.0'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: sprockets-rails
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- - "
|
35
|
+
- - "~>"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: '3.4'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- - "
|
42
|
+
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
44
|
+
version: '3.4'
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
46
|
+
name: safe_yaml
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version:
|
51
|
+
version: 0.8.6
|
52
52
|
type: :runtime
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
58
|
+
version: 0.8.6
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
60
|
+
name: sassc
|
61
61
|
requirement: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
|
-
- - "
|
63
|
+
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: '
|
66
|
-
type: :
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- - "
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
72
|
+
version: '0'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: sqlite3
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,7 +105,7 @@ dependencies:
|
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '1.0'
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
|
-
name:
|
108
|
+
name: will_paginate
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - ">="
|
@@ -119,7 +119,49 @@ dependencies:
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
|
-
name:
|
122
|
+
name: capybara
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '3.14'
|
128
|
+
type: :development
|
129
|
+
prerelease: false
|
130
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - "~>"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '3.14'
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: cuprite
|
137
|
+
requirement: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
type: :development
|
143
|
+
prerelease: false
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: puma
|
151
|
+
requirement: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - "~>"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '5.5'
|
156
|
+
type: :development
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - "~>"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '5.5'
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: appraisal
|
123
165
|
requirement: !ruby/object:Gem::Requirement
|
124
166
|
requirements:
|
125
167
|
- - ">="
|
@@ -157,11 +199,11 @@ files:
|
|
157
199
|
- app/models/tolk/phrase.rb
|
158
200
|
- app/models/tolk/translation.rb
|
159
201
|
- app/views/layouts/tolk/application.html.erb
|
160
|
-
- app/views/tolk/_blank_canva.
|
161
|
-
- app/views/tolk/_empty.
|
162
|
-
- app/views/tolk/_houra.
|
202
|
+
- app/views/tolk/_blank_canva.html.erb
|
203
|
+
- app/views/tolk/_empty.html.erb
|
204
|
+
- app/views/tolk/_houra.html.erb
|
163
205
|
- app/views/tolk/_nav.html.erb
|
164
|
-
- app/views/tolk/_no_data.
|
206
|
+
- app/views/tolk/_no_data.html.erb
|
165
207
|
- app/views/tolk/locales/all.html.erb
|
166
208
|
- app/views/tolk/locales/index.html.erb
|
167
209
|
- app/views/tolk/locales/show.atom.builder
|
@@ -189,7 +231,7 @@ homepage: https://github.com/tolk/tolk
|
|
189
231
|
licenses:
|
190
232
|
- MIT
|
191
233
|
metadata: {}
|
192
|
-
post_install_message:
|
234
|
+
post_install_message:
|
193
235
|
rdoc_options: []
|
194
236
|
require_paths:
|
195
237
|
- lib
|
@@ -204,8 +246,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
246
|
- !ruby/object:Gem::Version
|
205
247
|
version: '0'
|
206
248
|
requirements: []
|
207
|
-
rubygems_version: 3.
|
208
|
-
signing_key:
|
249
|
+
rubygems_version: 3.3.10
|
250
|
+
signing_key:
|
209
251
|
specification_version: 4
|
210
252
|
summary: Rails engine providing web interface for managing i18n yaml files
|
211
253
|
test_files: []
|