UNPKG

1.48 kBMarkdownView Raw
1## Adding locale
2
3Create locale folder in [src/providers](https://github.com/boo1ean/casual/blob/master/src/providers)
4
5Add locale to locales list [src/casual.js](https://github.com/boo1ean/casual/blob/master/src/casual.js#L53-L56)
6
7Create specific providers inside of locale folder, it should have same name as base provider.
8
9Locale-specific provider will be extended from base provider and will have all its properties.
10
11Keep 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
14provider = {
15 whoop_name: function() {
16 return this.name + '!';
17 }
18}
19
20module.exports = provider;
21```
22
23There 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
29It 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
35To view generator results you can use help util:
36
37> node utils/show.js internet -l ru_RU
38
39For details see [usage](https://github.com/boo1ean/casual/blob/master/utils/usage.txt)