rails_config_i18n 0.3.1.1 → 0.3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +23 -13
- data/lib/generators/rails_config/templates/rails_config.rb +0 -1
- data/lib/rails_config/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
# RailsConfig
|
1
|
+
# RailsConfig I18N
|
2
2
|
|
3
3
|
## Summary
|
4
4
|
|
5
|
-
RailsConfig
|
5
|
+
RailsConfig I18N helps you manage environment and locale specific Rails settings in an easy and usable manner
|
6
6
|
|
7
7
|
<del>RailsConfig helps you easily manage environment specific Rails settings in an easy and usable manner</del>
|
8
8
|
|
9
9
|
## Features
|
10
10
|
|
11
11
|
* simple YAML config files
|
12
|
-
* Support locales with
|
12
|
+
* Support locales with i18n
|
13
13
|
* config files support ERB
|
14
14
|
* config files support inheritance
|
15
15
|
* access config information via convenient object member notation
|
@@ -27,7 +27,7 @@ For older versions of Rails and other Ruby apps, use [AppConfig](http://github.c
|
|
27
27
|
Add this to your `Gemfile`:
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
gem "
|
30
|
+
gem "rails_config_i18n"
|
31
31
|
```
|
32
32
|
|
33
33
|
## Installing on Padrino
|
@@ -35,7 +35,7 @@ gem "rails_config"
|
|
35
35
|
Add this to your `Gemfile`:
|
36
36
|
|
37
37
|
```ruby
|
38
|
-
gem "
|
38
|
+
gem "rails_config_i18n"
|
39
39
|
```
|
40
40
|
|
41
41
|
in your app.rb, you'll also need to register RailsConfig
|
@@ -49,7 +49,7 @@ register RailsConfig
|
|
49
49
|
Add this to your `Gemfile`:
|
50
50
|
|
51
51
|
```ruby
|
52
|
-
gem "
|
52
|
+
gem "rails_config_i18n"
|
53
53
|
```
|
54
54
|
|
55
55
|
in your app, you'll need to register RailsConfig. You'll also need to give it a root so it can find the config files.
|
@@ -195,18 +195,24 @@ Consider the two following config files.
|
|
195
195
|
#{Rails.root}/config/settings.yml:
|
196
196
|
|
197
197
|
```yaml
|
198
|
-
|
199
|
-
|
198
|
+
en:
|
199
|
+
size: 1
|
200
|
+
server: google.com
|
201
|
+
|
202
|
+
zh-CN:
|
203
|
+
size: '一'
|
204
|
+
server: '谷歌'
|
200
205
|
```
|
201
206
|
|
202
207
|
#{Rails.root}/config/environments/development.yml:
|
203
208
|
|
204
209
|
```yaml
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
+
en:
|
211
|
+
size: 2
|
212
|
+
computed: <%= 1 + 2 + 3 %>
|
213
|
+
section:
|
214
|
+
size: 3
|
215
|
+
servers: [ {name: yahoo.com}, {name: amazon.com} ]
|
210
216
|
```
|
211
217
|
|
212
218
|
Notice that the environment specific config entries overwrite the common entries.
|
@@ -214,6 +220,10 @@ Notice that the environment specific config entries overwrite the common entries
|
|
214
220
|
```ruby
|
215
221
|
Settings.size # => 2
|
216
222
|
Settings.server # => google.com
|
223
|
+
|
224
|
+
I18n.locale = 'zh-CN'
|
225
|
+
Settings.size # => '一'
|
226
|
+
Settings.server # => '谷歌'
|
217
227
|
```
|
218
228
|
|
219
229
|
Notice the embedded Ruby.
|
data/lib/rails_config/version.rb
CHANGED