<commit_before># Local
Beautiful localization library for node.js. 

```js
var Local = require('local')

var local = new Local()
	local.set('hello').to('hola').in('spanish')
	local.get('hello').in('spanish') // -> hola
```

## Install
```
npm install local
```

## Features
- Ships with JSON Memory and FileStorage (for node.js) Drivers
- Simple Get/Set API
- Easy Instantiation for User Level Localization
- Custom Storage Setter/Getter API

## How to Use

### Initialize

#### With Memory Storage
```js
var Local = require('local')
var local = new Local() // leave it empty
```

#### With FileSystem Storage
```js
var Local = require('local')
var local = new Local('/your/file/local.json')
```

#### With Custom Storage
```js
var Local = require('local')

// register custom storage
Local
.storage('myStorage')
.getter(function(parent, query, language, translation, done){
	// ...
	done()
})
.setter(function(parent, query, language, done){
	// ...
	done()
})

// instantiate
var local = new Local('myStorage')
```

### Set
```js
local
.set('hello')
.to('hola')
.in('spanish')
.then(successCallback) // one result argument
.catch(errorCallback) // one error argument
```

### Get
```js
local
.get('hello')
.in('spanish')
.then(successCallback) // one result argument
.catch(errorCallback) // one error argument
```


## Tests
Running the tests (mocha) is as simple as typing in:
```
npm test
```<commit_msg>read me<commit_after># Local
Beautiful localization library for node.js. 

```js
var Local = require('local')

var local = new Local()
	local.set('hello').to('hola').in('spanish')
	local.get('hello').in('spanish') // -> hola
```

## Install
```
npm install local
```

## Features
- Ships with JSON Memory and FileStorage (for node.js) Drivers
- Simple Get/Set API
- Easy Instantiation for User Level Localization
- Custom Storage Setter/Getter API

## How to Use

### Initialize

#### With Memory Storage
```js
var Local = require('local')
var local = new Local() // leave it empty
```

#### With FileSystem Storage
```js
var Local = require('local')
var local = new Local('/your/file/local.json')
```

#### With Custom Storage
```js
var Local = require('local')

// register custom storage
Local
.storage('myStorage')
.getter(function(parent, query, language, translation, done){
	// ...
	done()
})
.setter(function(parent, query, language, done){
	// ...
	done()
})

// instantiate
var local = new Local('myStorage')
```

### Set
```js
local
.set('hello')
.to('hola')
.in('spanish')
.then(successCallback) // one result argument
.catch(errorCallback) // one error argument
```

### Get
```js
local
.get('hello')
.in('spanish')
.then(successCallback) // one result argument
.catch(errorCallback) // one error argument
```


## Tests
Tests are written with Mocha.js. To run the tests install mocha and run the tests with npm test.  
```
npm install mocha -g
npm test
```
{'fraction_non_alphanumeric': 0.17749218478638415, 'fraction_numerical': 0.0, 'mean_word_length': 4.1985559566787005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7601490', 'n_tokens_mistral': 950, 'n_tokens_neox': 897, 'n_words': 297}