1 | ## Adding locale
|
2 |
|
3 | Create locale folder in [src/providers](https://github.com/boo1ean/casual/blob/master/src/providers)
|
4 |
|
5 | Add locale to locales list [src/casual.js](https://github.com/boo1ean/casual/blob/master/src/casual.js#L53-L56)
|
6 |
|
7 | Create specific providers inside of locale folder, it should have same name as base provider.
|
8 |
|
9 | Locale-specific provider will be extended from base provider and will have all its properties.
|
10 |
|
11 | Keep in mind that all provider methods will be bound to the casual object, so you can use other generators for your generator:
|
12 |
|
13 | ```javascript
|
14 | provider = {
|
15 | whoop_name: function() {
|
16 | return this.name + '!';
|
17 | }
|
18 | }
|
19 |
|
20 | module.exports = provider;
|
21 | ```
|
22 |
|
23 | There are three things you can override/add:
|
24 |
|
25 | - dictionaries (leave formats and algorithms, just change dictionaries)
|
26 | - formats (leave dictionaries and algorithms, just change formats)
|
27 | - generators (change generator algorithm at all)
|
28 |
|
29 | It should be pretty straightforward after looking at examples:
|
30 |
|
31 | - [Add locale specific generators](https://github.com/boo1ean/casual/blob/master/src/providers/en_US/address.js)
|
32 | - [Just override dictionaries](https://github.com/boo1ean/casual/blob/master/src/providers/ru_RU/text.js#L2)
|
33 | - [Tweak most of the stuff!](https://github.com/boo1ean/casual/blob/master/src/providers/ru_RU/address.js)
|
34 |
|
35 | To view generator results you can use help util:
|
36 |
|
37 | > node utils/show.js internet -l ru_RU
|
38 |
|
39 | For details see [usage](https://github.com/boo1ean/casual/blob/master/utils/usage.txt)
|