i18n_lazy_scope 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/lib/i18n_lazy_scope/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5e67ec5de312b21a673e53902fff73d8c84e530
|
4
|
+
data.tar.gz: 1aff50f53d882e35d29f4ee010a103888a96d864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4690adadb569a8b6934dc8ee65a447f286d1fe58fe5a4e5762b4c74e59eed64094a0c6d8690f22cdc1739a7a0b847870e86f75885abc545bc1612dd2812422a
|
7
|
+
data.tar.gz: 129fee9d22594e02023389a934e7e34417da4e260ce2f558a2a9841617054688ca1345570ccaca611cd6ed54d6445673ab437dd1d3de3283a333e123980cbfb0
|
data/README.md
CHANGED
@@ -98,7 +98,7 @@ Or install it yourself as:
|
|
98
98
|
Call the `t_scoped` method instead of `t`, or `translate`, and make sure you have the corresponding keys in your locale file. Say you are in `app/views/users/show.html.erb`.
|
99
99
|
|
100
100
|
```erb
|
101
|
-
<%= t_scoped '
|
101
|
+
<%= t_scoped 'greeting' %>
|
102
102
|
```
|
103
103
|
|
104
104
|
```yaml
|
@@ -109,12 +109,18 @@ en:
|
|
109
109
|
greeting: "Hello!"
|
110
110
|
```
|
111
111
|
|
112
|
+
The library inserts a top level name in the scope for you. You will be able to customise this in future releases, but for now, the scopes default to:
|
113
|
+
|
114
|
+
1. Conrollers: `locale.controllers.controller_name.action_name.key`
|
115
|
+
2. Mailers: `locale.mailers.mailer_name.action_name.key`
|
116
|
+
3. Views: `locale.views.template_or_partial_path.key`
|
117
|
+
|
112
118
|
### Interpolation
|
113
119
|
|
114
120
|
It works exactly as it would if you call `t` or `translate`.
|
115
121
|
|
116
122
|
```erb
|
117
|
-
<%= t_scoped '
|
123
|
+
<%= t_scoped 'greeting', name: @user.name %>
|
118
124
|
```
|
119
125
|
|
120
126
|
```yaml
|
@@ -127,7 +133,9 @@ en:
|
|
127
133
|
|
128
134
|
### Scoping
|
129
135
|
|
130
|
-
If you have to customise the scope on individual basis, then you should use `t` and `translate` that ship with the [I18n][3] gem. Scoping on individual basis defeates the point of this gem. This gem isn't meant to replace the I18n; it's a tiny wrapper that depends on it.
|
136
|
+
If you have to customise the scope on individual basis, then you should use `t` and `translate` that ship with Rails or the [I18n][3] gem. Scoping on individual basis defeates the point of this gem. This gem isn't meant to replace the I18n; it's a tiny wrapper that depends on it.
|
137
|
+
|
138
|
+
In future releases you will be able to customise top level namespaces, such as `views`, `controllers`, `mailers`, etc.
|
131
139
|
|
132
140
|
## API
|
133
141
|
|