apemanlocale
Message resource for apeman project.
Last updated 3 years ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install apemanlocale 
SYNC missed versions from official npm registry.

apemanlocale

Build Status npm Version JS Standard

Message resource for apeman project.

Installation

$ npm install apemanlocale --save

Usage

Create a directory with name "loc" and put locale files like "en.json" there.

loc/en.json

{
  "keys": {
    "APP_NAME": "hello-world"
  },
  "titles": {
    "WELCOME_TITLE": "Welcome to #{keys.APP_NAME}!"
  }
}

loc/index.js

'use strict'

const apemanlocale = require('apemanlocale')

// Exports locales as module.
let locales = apemanlocale(__dirname, {
  // Options
})

// Print all locales
locales.print()

module.exports = locales

Then,

'use strict'

// Require defined locales
const loc = require('./loc/index.js')

let en = loc('en')
console.log(en.titles.WELCOME_TITLE) // -> "Welcome to hello-world!"

Signature

apemanlocale(dirname, options) -> object

Define locale message resource.

Args
Name Type Default Description
dirname string locales Directory path which contains locale messages.
options object Optional settings.
options.default object en Default lang.
options.fallback boolean Use default lang as fallback
options.buildin boolean Use buildin langs

Build-in messages

Key Message
errors.RESOURCE_DATA_CONFLICT_ERROR RESOURCE_DATA_CONFLICT_ERROR
リソースデータ競合エラー
errors.RESOURCE_DATA_ERROR RESOURCE_DATA_ERROR
リソースデータエラー
errors.RESOURCE_DATA_MISSING_ERROR RESOURCE_DATA_MISSING_ERROR
リソースデータ欠落エラー
errors.RESOURCE_ERROR RESOURCE_ERROR
リソースエラー
errors.RESOURCE_INCLUDE_ERROR RESOURCE_INCLUDE_ERROR
リソースインクルードエラー
errors.RESOURCE_INCLUDE_INVALID_ERROR RESOURCE_INCLUDE_INVALID_ERROR
RESOURCE_INCLUDE_INVALID_ERROR
errors.RESOURCE_NOT_FOUND_ERROR RESOURCE_NOT_FOUND_ERROR
未検出エラー
errors.RESOURCE_TYPE_ERROR RESOURCE_TYPE_ERROR
リソース種別エラー
errors.RESOURCE_TYPE_INVALID_ERROR RESOURCE_TYPE_INVALID_ERROR
リソース種別不正エラー
errors.RESOURCE_TYPE_MISSING_ERROR RESOURCE_TYPE_MISSING_ERROR
リソース種別欠落エラー
errors.RESOURCE_VR_ERROR RESOURCE_VR_ERROR
リソースバージョンエラー
errors.RESOURCE_VR_TYPE_ERROR RESOURCE_VR_TYPE_ERROR
リソースバージョン種別エラー
errors.SIGN_CAPTCHA_WRONG_ERROR SIGN_CAPTCHA_WRONG_ERROR
CAPTCHA照合エラー
errors.SIGN_ERROR SIGN_ERROR
ログインエラー
errors.SIGN_FORM_WRONG_ERROR SIGN_FORM_WRONG_ERROR
ログイン入力内容エラー
errors.SOMETHING_WRONG_ERROR SOMETHING_WRONG_ERROR
不明なエラー
errors.VALUE_DUPLICATE_ERROR VALUE_DUPLICATE_ERROR
文字列重複エラー
errors.VALUE_ERROR VALUE_ERROR
値エラー
errors.VALUE_INVALID_ERROR VALUE_INVALID_ERROR
値不正エラー
errors.VALUE_MISSING_ERROR VALUE_MISSING_ERROR
値欠落エラー
errors.VALUE_NUMBER_ERROR VALUE_NUMBER_ERROR
数値エラー
errors.VALUE_NUMBER_INVALID_ERROR VALUE_NUMBER_INVALID_ERROR
数値不正エラー
errors.VALUE_NUMBER_TOO_LARGE_ERROR VALUE_NUMBER_TOO_LARGE_ERROR
数値上限エラー
errors.VALUE_NUMBER_TOO_SMALL_ERROR VALUE_NUMBER_TOO_SMALL_ERROR
数値下限エラー
errors.VALUE_STRING_ERROR VALUE_STRING_ERROR
文字列エラー
errors.VALUE_STRING_INVALID_ERROR VALUE_STRING_INVALID_ERROR
文字列不正エラー
errors.VALUE_STRING_TOO_LONG_ERROR VALUE_STRING_TOO_LONG_ERROR
文字列長上限エラー
errors.VALUE_STRING_TOO_SHORT_ERROR VALUE_STRING_TOO_SHORT_ERROR
文字列長下限エラー
errors.VALUE_TYPE_ERROR VALUE_TYPE_ERROR
値種別エラー
errors.VALUE_TYPE_INVALID_ERROR VALUE_TYPE_INVALID_ERROR
値種別不正エラー
status.400 Bad Request
不正なリクエスト
status.401 Authentication is required
認証が必要です
status.403 You don't have permissions
権限がありません
status.404 Could not find resource
リソースが見つかりません
status.500 Something wrong with the server
サーバーでエラーが発生しました
status.502 Bad gateway error
ゲートウェイエラー
status.503 Server not available
混雑中

License

This software is released under the MIT License.

Links

Current Tags

  • 6.0.2                                ...           latest (3 years ago)

90 Versions

  • 6.0.2                                ...           3 years ago
  • 6.0.1                                ...           3 years ago
  • 5.1.6                                ...           4 years ago
  • 5.1.5                                ...           4 years ago
  • 5.1.4                                ...           4 years ago
  • 5.1.3                                ...           4 years ago
  • 5.1.2                                ...           4 years ago
  • 5.1.1                                ...           4 years ago
  • 5.1.0                                ...           4 years ago
  • 5.0.21                                ...           4 years ago
  • 5.0.20                                ...           4 years ago
  • 5.0.19                                ...           4 years ago
  • 5.0.18                                ...           4 years ago
  • 5.0.17                                ...           4 years ago
  • 5.0.16                                ...           4 years ago
  • 5.0.15                                ...           4 years ago
  • 5.0.14                                ...           4 years ago
  • 5.0.13                                ...           4 years ago
  • 5.0.12                                ...           4 years ago
  • 5.0.11                                ...           4 years ago
  • 5.0.10                                ...           4 years ago
  • 5.0.9                                ...           4 years ago
  • 5.0.8                                ...           4 years ago
  • 5.0.7                                ...           4 years ago
  • 5.0.6                                ...           4 years ago
  • 5.0.5                                ...           4 years ago
  • 5.0.4                                ...           4 years ago
  • 5.0.3                                ...           4 years ago
  • 5.0.2                                ...           4 years ago
  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.0.2                                ...           4 years ago
  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.5.23                                ...           4 years ago
  • 2.5.22                                ...           4 years ago
  • 2.5.21                                ...           4 years ago
  • 2.5.20                                ...           4 years ago
  • 2.5.19                                ...           4 years ago
  • 2.5.18                                ...           4 years ago
  • 2.5.17                                ...           4 years ago
  • 2.5.16                                ...           4 years ago
  • 2.5.15                                ...           4 years ago
  • 2.5.14                                ...           4 years ago
  • 2.5.13                                ...           4 years ago
  • 2.5.12                                ...           4 years ago
  • 2.5.11                                ...           4 years ago
  • 2.5.10                                ...           4 years ago
  • 2.5.9                                ...           4 years ago
  • 2.5.8                                ...           4 years ago
  • 2.5.7                                ...           4 years ago
  • 2.5.6                                ...           4 years ago
  • 2.5.5                                ...           4 years ago
  • 2.5.4                                ...           4 years ago
  • 2.5.3                                ...           4 years ago
  • 2.5.2                                ...           4 years ago
  • 2.5.1                                ...           4 years ago
  • 2.4.5                                ...           4 years ago
  • 2.4.4                                ...           4 years ago
  • 2.4.3                                ...           4 years ago
  • 2.4.2                                ...           4 years ago
  • 2.4.1                                ...           4 years ago
  • 2.4.0                                ...           4 years ago
  • 2.3.4                                ...           4 years ago
  • 2.3.3                                ...           4 years ago
  • 2.3.2                                ...           4 years ago
  • 2.3.1                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.9                                ...           4 years ago
  • 2.1.8                                ...           4 years ago
  • 2.1.7                                ...           4 years ago
  • 2.1.6                                ...           4 years ago
  • 2.1.5                                ...           4 years ago
  • 2.1.4                                ...           4 years ago
  • 2.1.3                                ...           4 years ago
  • 2.1.2                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.2.2                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 180
Dependencies (11)
Dev Dependencies (12)

Copyright 2014 - 2016 © taobao.org |