README.md in i18n-tasks-0.5.0 vs README.md in i18n-tasks-0.5.1
- old
+ new
@@ -16,11 +16,11 @@
## Installation
Add to Gemfile:
```ruby
-gem 'i18n-tasks', '~> 0.5.0'
+gem 'i18n-tasks', '~> 0.5.1'
```
## Usage
@@ -171,19 +171,26 @@
- "<%= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml"
# default
- 'config/locales/%{locale}.yml'
```
+#### Key pattern syntax
+
+| syntax | description |
+|:------------:|:----------------------------------------------------------|
+| `*` | matches everything |
+| `:` | matches a single key |
+| `{a, b.c}` | match any in set, can use `:` and `*`, match is captured |
+
For writing to locale files i18n-tasks provides 2 options.
##### Pattern router
Pattern router organizes keys based on a list of key patterns, as in the example below:
```
data:
- # pattern_router is default
router: pattern_router
# a list of {key pattern => file} routes, matched top to bottom
write:
# write models.* and views.* keys to the respective files
- ['{models,views}.*', 'config/locales/\1.%{locale}.yml']
@@ -195,24 +202,17 @@
##### Conservative router
Conservative router keeps the keys where they are found, or infers the path from base locale.
If the key is completely new, conservative router will fall back to the pattern router behaviour.
+Conservative router is the default router.
```
data:
router: conservative_router
write:
- 'config/locales/%{locale}.yml'
```
-
-#### Key pattern syntax
-
-| syntax | description |
-|:------------:|:----------------------------------------------------------|
-| `*` | matches everything |
-| `:` | matches a single key |
-| `{a, b.c}` | match any in set, can use `:` and `*`, match is captured |
#### Custom adapters
If you store data somewhere but in the filesystem, e.g. in the database or mongodb, you can implement a custom adapter.
Implement [a handful of methods][adapter-example], then set `data.adapter` to the class name; the rest of the `data` config is passed to the initializer.