browser-language
Advanced tools
Comparing version 0.0.1 to 1.0.0
13
index.js
@@ -7,3 +7,3 @@ "use strict"; | ||
* @subpackage index | ||
* @version 0.0.1 | ||
* @version 1.0.0 | ||
* @author hex7c0 <0x7c0@teboss.tk> | ||
@@ -119,8 +119,13 @@ * @license GPLv3 | ||
* | ||
* @param string filename: name of log | ||
* @param integer maxsize: max size of log | ||
* @param bollean json: if write data with json format | ||
* @param object dictionary: accepted languages | ||
*/ | ||
var LANG = dictionary || require('./lib/dictionary.js').LANG; | ||
if (dictionary._default == undefined) { | ||
// force | ||
var LANG = require('./lib/dictionary.js').LANG; | ||
} else if (!languageAll[dictionary._default]) { | ||
console.error('language misconfigured'); | ||
var LANG = require('./lib/dictionary.js').LANG; | ||
} | ||
process.env.LANG = LANG._default; | ||
@@ -127,0 +132,0 @@ |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @subpackage lib | ||
* @version 0.0.1 | ||
* @version 1.0.0 | ||
* @author hex7c0 <0x7c0@teboss.tk> | ||
@@ -10,0 +10,0 @@ * @license GPLv3 |
{ | ||
"name": "browser-language", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "simple language middleware for express", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,5 +0,5 @@ | ||
logger-request [![Build Status](https://travis-ci.org/hex7c0/logger-request.svg?branch=master)](https://travis-ci.org/hex7c0/logger-request) [![NPM version](https://badge.fury.io/js/logger-request.svg)](http://badge.fury.io/js/logger-request) | ||
browser-language [![Build Status](https://travis-ci.org/hex7c0/browser-language.svg?branch=master)](https://travis-ci.org/hex7c0/browser-language) [![NPM version](https://badge.fury.io/js/browser-language.svg)](http://badge.fury.io/js/browser-language) | ||
============== | ||
simple logger middleware for express | ||
simple language middleware for express | ||
@@ -10,21 +10,28 @@ ## API | ||
var app = require('express')(); | ||
var logger-request = require('logger-request'); | ||
var cookie = require('cookie-parser'); | ||
var browser-language = require('browser-language'); | ||
app.use(logger-request({filename:'pippo.log'})); | ||
app.use(cookie('pippo')); | ||
app.use(browser-language({_default:'en',en:'en'})); | ||
``` | ||
### logger-request(options) | ||
### browser-language(dictionary) | ||
Setup session store with the given `options`. | ||
Setup accepted languages with the given `dictionary` (object). | ||
#### Options | ||
- `filename` - The filename of the logfile to write output to. | ||
- `maxsize` - Max size in bytes of the logfile, if the size is exceeded then a new file is created. | ||
- `json` - If true, messages will be logged as JSON (default true). | ||
- `_default` - The dafault value, if request from client cannot be evaluated | ||
- `en` - Set cookie with 'en' value | ||
- `it` - Set cookie with 'it' value | ||
- `..` - Set cookie with '..' value | ||
releated to https://github.com/flatiron/winston#file-transport | ||
object with correct value to be added, otherwise using a default dictionary inside /lib/dictionary.js | ||
#### Examples | ||
Take a look at my [examples](https://github.com/hex7c0/browser-language/tree/master/examples) | ||
## License | ||
Copyright (c) 2014 hex7c0 | ||
Licensed under the GPLv3 license. | ||
Licensed under the GPLv3 license. |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
51923
224
0
37