HTTP status and message mapping, internationalized.
Currently supported locales: de-de
, en-us
, ja-jp
, ko-kr
, zh-cn
. Add your locale like this now! π
$ npm install @http-util/status-i18n
import status from '@http-util/status-i18n'
// or
var status = require('@http-util/status-i18n')
Returns a lowercase string of default browser language set by user.
Returns an array of all the status codes as Integer
s.
Map of code
to status message
, in the same format as the Node.js http module. undefined
for invalid code
s. The language has been set to default en-us
.
status[404] // => 'Not Found'
status[700] // => undefined
Map of code
to status message
with specific language. The default browser language is assumed to be en-us
.
status(401, 'zh-cn') // => 'ζ ζι'
status(401, 'zh-CN') // => 'ζ ζι'
status(401, 'zh') // => 'ζ ζι'
status(401, status.BROWSER_LANG) // => 'Unauthorized'
status(401) // => 'Unauthorized'