fractual_i18n 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/fractual_i18n/backend.rb +12 -2
- data/lib/fractual_i18n/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93973ed14052dc7838096589ba14a8a9df64aec2ccc9dbcbbaa4af772d8042c5
|
4
|
+
data.tar.gz: bd05da1a510e772a97fa79309b6d23e301893bf738c91855e166fff9eb8fcce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b5bdb966bd270f157678c4bb9eb879c0489d4c8b0923eaacb4aadf9e7d95e7fa48fa4ef43360b629acb981167482ebf63216768a4716d8a10d4fe0c42e115a9
|
7
|
+
data.tar.gz: a2cc062386cceb7d85492a361f7b3bb1c1a9c1e26cce2c1d01cb9673d286709359ade856df010f185f7e6cb6e08db1bf9454b1043c690da548b975a5416acf0e
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fractual_i18n (0.
|
4
|
+
fractual_i18n (0.4.0)
|
5
5
|
i18n
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
concurrent-ruby (1.1.9)
|
11
|
-
i18n (1.
|
11
|
+
i18n (1.10.0)
|
12
12
|
concurrent-ruby (~> 1.0)
|
13
|
-
minitest (5.
|
13
|
+
minitest (5.15.0)
|
14
14
|
rake (12.3.3)
|
15
15
|
|
16
16
|
PLATFORMS
|
@@ -22,4 +22,4 @@ DEPENDENCIES
|
|
22
22
|
rake (~> 12.0)
|
23
23
|
|
24
24
|
BUNDLED WITH
|
25
|
-
2.
|
25
|
+
2.3.4
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module FractualI18n::Backend
|
4
4
|
def load_yml(filename)
|
5
5
|
if (fractual_path = FractualI18n.configuration.fractual_paths.find { |path| filename.starts_with?(path) })
|
6
|
-
content =
|
6
|
+
content = load_yml_file_unsafely(filename)
|
7
7
|
keys = filename.delete_prefix(fractual_path).delete_prefix("/").split("/")
|
8
8
|
last_key = keys.pop.delete_suffix(".yml")
|
9
9
|
keys << last_key
|
@@ -14,9 +14,19 @@ module FractualI18n::Backend
|
|
14
14
|
translations[locale] = keys.reverse.inject(content[locale.to_s]) { |translation, key| { key => translation } }
|
15
15
|
end
|
16
16
|
else # default
|
17
|
-
|
17
|
+
load_yml_file_unsafely(filename)
|
18
18
|
end
|
19
19
|
rescue TypeError, ScriptError, StandardError => e
|
20
20
|
raise I18n::InvalidLocaleData.new(filename, e.inspect)
|
21
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def load_yml_file_unsafely(filename)
|
26
|
+
if YAML.respond_to?(:unsafe_load_file) # Psych 4.0 way
|
27
|
+
YAML.unsafe_load_file(filename)
|
28
|
+
else
|
29
|
+
YAML.load_file(filename)
|
30
|
+
end
|
31
|
+
end
|
22
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fractual_i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Sęk
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.3.4
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: Supports loading translation files from views folder
|