0.8.1 • Published 9 months ago

@http-util/status-i18n v0.8.1

Weekly downloads
605
License
MIT
Repository
github
Last release
9 months ago

status-i18n

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

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! 🎉

Installation

$ npm install @http-util/status-i18n

API

import status from '@http-util/status-i18n'
// or
var status = require('@http-util/status-i18n')

status.BROWSER_LANG

Returns a lowercase string of default browser language set by user.

status.codes

Returns an array of all the status codes as Integers.

statuscode

Map of code to status message, in the same format as the Node.js http module. undefined for invalid codes. The language has been set to default en-us.

status[404] // => 'Not Found'
status[700] // => undefined

status(code, language)

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'
0.8.1

9 months ago

0.8.0

9 months ago

0.7.0

12 months ago

0.6.2

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.3.0

4 years ago

0.2.0

4 years ago