yaml_locales_jsonizer 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +34 -7
- data/lib/yaml_locales_jsonizer/version.rb +1 -1
- data/yaml_locales_jsonizer.gemspec +4 -4
- metadata +21 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4eac12e24ee95e92ef1bb5c56a8ccc760ee9357
|
|
4
|
+
data.tar.gz: 612b713dc6db420e452c23e91c343ad4573048ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df8625cd4b461dab9c5a96b7fe8e32c1aef33e0b533b03bb12c4f9ce8bffea71fb5f0541dca1670673f771c9ca277c076aee6c291a5399fe4245d1e4736a742c
|
|
7
|
+
data.tar.gz: 698470a212997db3975df2463811155e67d086769913405b485e0a2c04385863010a9e27748f7d773bba96aad0ab439e385de3d396ed227849fc1f5953494133
|
data/README.md
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
# YamlLocalesJsonizer
|
|
2
2
|
|
|
3
|
-
Simple generation of JSON i18n data for
|
|
3
|
+
Simple generation of JSON i18n data for a frontend from Rails-style YAML
|
|
4
4
|
locales.
|
|
5
5
|
|
|
6
|
-
The gem provides
|
|
7
|
-
but it is quite cumbersome to use in development. Changes in dynamic assets
|
|
8
|
-
derived from other resources are not being detected and picked up by sprockets
|
|
9
|
-
properly, and they require a server restart and cache wipe to get applied.
|
|
6
|
+
The gem provides the following:
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
1. Asset file for the asset pipeline, to be used in production.
|
|
9
|
+
2. View helper, to assist with locale updates in development.
|
|
10
|
+
|
|
11
|
+
The reason we need both an asset file and a view helper is that changes in
|
|
12
|
+
dynamic assets derived from other resources are not being detected and picked
|
|
13
|
+
up by sprockets properly, and they require a full server restart AND cache wipe
|
|
14
|
+
to force the asset cache to be recompiled, and the change to get applied.
|
|
15
|
+
|
|
16
|
+
To provide better development experience, an action view helper allows to
|
|
17
|
+
override the asset file, and inject the correct JSON data into the page
|
|
18
|
+
directly. Of course, due to the increased size of HTML pages, it is not a
|
|
19
|
+
recommended technique for production use.
|
|
13
20
|
|
|
14
21
|
## Compatibility
|
|
15
22
|
|
|
@@ -57,6 +64,26 @@ i18next with this variable as the resource storage:
|
|
|
57
64
|
i18n.init({resStore: yaml_locales_jsonized});
|
|
58
65
|
```
|
|
59
66
|
|
|
67
|
+
## Advanced configuration
|
|
68
|
+
|
|
69
|
+
Gem should be usable out of the box, loading all YAML locales available in
|
|
70
|
+
Rails. Additionally, it can be configured with an initializer, e.g.
|
|
71
|
+
`config/initializers/yaml_locales_jsonizer.rb`. Example:
|
|
72
|
+
|
|
73
|
+
``` ruby
|
|
74
|
+
YamlLocalesJsonizer.configure do
|
|
75
|
+
# Add to or overwrite load path. By default the load path uses Rails' i18n
|
|
76
|
+
# settings available in Rails.configuration.i18n[:load_path]
|
|
77
|
+
load_path << "/some/other/path"
|
|
78
|
+
|
|
79
|
+
# Filter out files discovered via load_path, and jsonize only the ones
|
|
80
|
+
# matching the list. List could contain either file names, or shell-like
|
|
81
|
+
# glob patterns (matched with [File#fnmatch](http://www.ruby-doc.org/core-2.1.0/File.html#method-c-fnmatch))
|
|
82
|
+
only_files %w(ru.yml en.yml)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
60
87
|
## Contributing
|
|
61
88
|
|
|
62
89
|
1. Fork it
|
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.version = YamlLocalesJsonizer::VERSION
|
|
9
9
|
spec.authors = ['Oleg Ivanov']
|
|
10
10
|
spec.email = ['morhekil@morhekil.net']
|
|
11
|
-
spec.description = %q{Simple generation of JSON data for
|
|
12
|
-
spec.summary = %q{Simple generation of JSON data for
|
|
11
|
+
spec.description = %q{Simple generation of JSON data for a frontend from Rails-style YAML locales}
|
|
12
|
+
spec.summary = %q{Simple generation of JSON data for a frontend from Rails-style YAML locales}
|
|
13
13
|
spec.homepage = ''
|
|
14
14
|
spec.license = 'MIT'
|
|
15
15
|
|
|
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.add_development_dependency 'rake'
|
|
23
23
|
spec.add_development_dependency 'rspec'
|
|
24
24
|
|
|
25
|
-
spec.add_runtime_dependency 'actionpack', '
|
|
26
|
-
spec.add_runtime_dependency 'activesupport', '
|
|
25
|
+
spec.add_runtime_dependency 'actionpack', '>= 3.0', '<5.0'
|
|
26
|
+
spec.add_runtime_dependency 'activesupport', '>= 3.0', '<5.0'
|
|
27
27
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yaml_locales_jsonizer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oleg Ivanov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -56,32 +56,43 @@ dependencies:
|
|
|
56
56
|
name: actionpack
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- -
|
|
59
|
+
- - '>='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '3.0'
|
|
62
|
+
- - <
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: '5.0'
|
|
62
65
|
type: :runtime
|
|
63
66
|
prerelease: false
|
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
68
|
requirements:
|
|
66
|
-
- -
|
|
69
|
+
- - '>='
|
|
67
70
|
- !ruby/object:Gem::Version
|
|
68
71
|
version: '3.0'
|
|
72
|
+
- - <
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '5.0'
|
|
69
75
|
- !ruby/object:Gem::Dependency
|
|
70
76
|
name: activesupport
|
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
|
72
78
|
requirements:
|
|
73
|
-
- -
|
|
79
|
+
- - '>='
|
|
74
80
|
- !ruby/object:Gem::Version
|
|
75
81
|
version: '3.0'
|
|
82
|
+
- - <
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: '5.0'
|
|
76
85
|
type: :runtime
|
|
77
86
|
prerelease: false
|
|
78
87
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
88
|
requirements:
|
|
80
|
-
- -
|
|
89
|
+
- - '>='
|
|
81
90
|
- !ruby/object:Gem::Version
|
|
82
91
|
version: '3.0'
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
- - <
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '5.0'
|
|
95
|
+
description: Simple generation of JSON data for a frontend from Rails-style YAML locales
|
|
85
96
|
email:
|
|
86
97
|
- morhekil@morhekil.net
|
|
87
98
|
executables: []
|
|
@@ -128,11 +139,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
128
139
|
version: '0'
|
|
129
140
|
requirements: []
|
|
130
141
|
rubyforge_project:
|
|
131
|
-
rubygems_version: 2.
|
|
142
|
+
rubygems_version: 2.2.2
|
|
132
143
|
signing_key:
|
|
133
144
|
specification_version: 4
|
|
134
|
-
summary: Simple generation of JSON data for
|
|
135
|
-
locales
|
|
145
|
+
summary: Simple generation of JSON data for a frontend from Rails-style YAML locales
|
|
136
146
|
test_files:
|
|
137
147
|
- spec/shared/locale_files.rb
|
|
138
148
|
- spec/spec_helper.rb
|