tolk 5.0.2 → 6.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/tolk/locales_controller.rb +1 -1
- data/app/helpers/tolk/application_helper.rb +1 -1
- data/app/models/tolk/translation.rb +2 -2
- data/lib/tolk/export.rb +1 -1
- data/lib/tolk/import.rb +1 -1
- data/lib/tolk/sync.rb +1 -1
- data/lib/tolk/version.rb +1 -1
- data/lib/tolk.rb +0 -2
- metadata +10 -25
- data/lib/tolk/yaml.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 147970ccfb4a24e0ee2dd1ebf6388cedf15e1905198fea1f17b0e3ba9607f3c8
|
4
|
+
data.tar.gz: 3dafeb77b4910b6d015c4b33ac4b037a9ca2b2457b72d0027cb5bb1687e96ae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30bb529018c5c8f3cb8950bd09ed654e64a2553c383d8c2ae9a3893607a3d848d8f7fb0b8238dae83b35f233f2751fcbb9a58438c4f0cd55e3d6040211f70190
|
7
|
+
data.tar.gz: 2adc6357331643ab3b9f83ca2dd742d8cd67d97456a57ec0d727a3e7b7ecc1c3ba7087c1d640b0348f4a135314d0e1fc892b4e048b6288f70f711e8b70a29c1b
|
@@ -4,8 +4,8 @@ module Tolk
|
|
4
4
|
|
5
5
|
scope :containing_text, lambda {|query| where("tolk_translations.text LIKE ?", "%#{query}%") }
|
6
6
|
|
7
|
-
serialize :text
|
8
|
-
serialize :previous_text
|
7
|
+
serialize :text, coder: YAML, yaml: { permitted_classes: [Symbol, Time, nil, String, Array, Hash] }
|
8
|
+
serialize :previous_text, coder: YAML, yaml: { permitted_classes: [Symbol, Time, nil, String, Array, Hash] }
|
9
9
|
validate :validate_text_not_nil, :if => proc {|r| r.primary.blank? && !r.explicit_nil && !r.boolean?}
|
10
10
|
validate :check_matching_variables, :if => proc { |tr| tr.primary_translation.present? }
|
11
11
|
|
data/lib/tolk/export.rb
CHANGED
data/lib/tolk/import.rb
CHANGED
@@ -53,7 +53,7 @@ module Tolk
|
|
53
53
|
|
54
54
|
puts "[INFO] Reading #{locale_file} for locale #{self.name}"
|
55
55
|
begin
|
56
|
-
self.class.flat_hash(
|
56
|
+
self.class.flat_hash(YAML.load_file(locale_file)[self.name])
|
57
57
|
rescue
|
58
58
|
puts "[ERROR] File #{locale_file} expected to declare #{self.name} locale, but it does not. Skipping this file."
|
59
59
|
nil
|
data/lib/tolk/sync.rb
CHANGED
@@ -47,7 +47,7 @@ module Tolk
|
|
47
47
|
def read_primary_locale_file
|
48
48
|
primary_file = "#{self.locales_config_path}/#{self.primary_locale_name}.yml"
|
49
49
|
if File.exist?(primary_file)
|
50
|
-
flat_hash(
|
50
|
+
flat_hash(YAML.load_file(primary_file)[self.primary_locale_name])
|
51
51
|
else
|
52
52
|
{}
|
53
53
|
end
|
data/lib/tolk/version.rb
CHANGED
data/lib/tolk.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
|
+
version: 6.0.0.alpha1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -20,20 +20,20 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '7.0'
|
24
24
|
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '7.
|
26
|
+
version: '7.3'
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '7.0'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '7.
|
36
|
+
version: '7.3'
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sprockets-rails
|
39
39
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,20 +48,6 @@ dependencies:
|
|
48
48
|
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '3.4'
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: safe_yaml
|
53
|
-
requirement: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 0.8.6
|
58
|
-
type: :runtime
|
59
|
-
prerelease: false
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 0.8.6
|
65
51
|
- !ruby/object:Gem::Dependency
|
66
52
|
name: sqlite3
|
67
53
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,16 +136,16 @@ dependencies:
|
|
150
136
|
name: puma
|
151
137
|
requirement: !ruby/object:Gem::Requirement
|
152
138
|
requirements:
|
153
|
-
- - "
|
139
|
+
- - "~>"
|
154
140
|
- !ruby/object:Gem::Version
|
155
|
-
version: '
|
141
|
+
version: '6.0'
|
156
142
|
type: :development
|
157
143
|
prerelease: false
|
158
144
|
version_requirements: !ruby/object:Gem::Requirement
|
159
145
|
requirements:
|
160
|
-
- - "
|
146
|
+
- - "~>"
|
161
147
|
- !ruby/object:Gem::Version
|
162
|
-
version: '
|
148
|
+
version: '6.0'
|
163
149
|
- !ruby/object:Gem::Dependency
|
164
150
|
name: appraisal
|
165
151
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,7 +212,6 @@ files:
|
|
226
212
|
- lib/tolk/pagination.rb
|
227
213
|
- lib/tolk/sync.rb
|
228
214
|
- lib/tolk/version.rb
|
229
|
-
- lib/tolk/yaml.rb
|
230
215
|
homepage: https://github.com/tolk/tolk
|
231
216
|
licenses:
|
232
217
|
- MIT
|
@@ -239,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
224
|
requirements:
|
240
225
|
- - ">="
|
241
226
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
227
|
+
version: 3.0.0
|
243
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
229
|
requirements:
|
245
230
|
- - ">="
|
data/lib/tolk/yaml.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Tolk
|
2
|
-
module YAML
|
3
|
-
SAFE_YAML_OPTIONS = SafeYAML::Deep.freeze({
|
4
|
-
:default_mode => :safe,
|
5
|
-
:deserialize_symbols => true
|
6
|
-
})
|
7
|
-
|
8
|
-
def self.load(yaml)
|
9
|
-
# SafeYAML.load has different arity depending on the YAML engine used.
|
10
|
-
if SafeYAML::YAML_ENGINE == "psych"
|
11
|
-
SafeYAML.load(yaml, nil, SAFE_YAML_OPTIONS)
|
12
|
-
else # syck
|
13
|
-
SafeYAML.load(yaml, SAFE_YAML_OPTIONS)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.load_file(filename)
|
18
|
-
SafeYAML.load_file(filename, SAFE_YAML_OPTIONS)
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.dump(payload)
|
22
|
-
if payload.respond_to?(:ya2yaml)
|
23
|
-
payload.ya2yaml(:syck_compatible => true)
|
24
|
-
else
|
25
|
-
::YAML.dump(payload, line_width: Tolk::Config.yaml_line_width)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|