apemanlocale
==========

<!---
This file is generated by ape-tmpl. Do not update manually.
--->

<!-- Badge Start -->
<a name="badges"></a>

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/apeman-labo/apemanlocale
[bd_travis_url]: http://travis-ci.org/apeman-labo/apemanlocale
[bd_travis_shield_url]: http://img.shields.io/travis/apeman-labo/apemanlocale.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/apeman-labo/apemanlocale
[bd_travis_com_shield_url]: https://api.travis-ci.com/apeman-labo/apemanlocale.svg?token=
[bd_license_url]: https://github.com/apeman-labo/apemanlocale/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/apeman-labo/apemanlocale
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/apeman-labo/apemanlocale.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/apeman-labo/apemanlocale.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/apeman-labo/apemanlocale
[bd_gemnasium_shield_url]: https://gemnasium.com/apeman-labo/apemanlocale.svg
[bd_npm_url]: http://www.npmjs.org/package/apemanlocale
[bd_npm_shield_url]: http://img.shields.io/npm/v/apemanlocale.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

<!-- Badge End -->


<!-- Description Start -->
<a name="description"></a>

Message resource for apeman project.

<!-- Description End -->


<!-- Overview Start -->
<a name="overview"></a>



<!-- Overview End -->


<!-- Sections Start -->
<a name="sections"></a>

<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->

<a name="section-doc-guides-01-installation-md"></a>

Installation
-----

```bash
$ npm install apemanlocale --save
```


<!-- Section from "doc/guides/01.Installation.md.hbs" End -->

<!-- Section from "doc/guides/02.Usage.md.hbs" Start -->

<a name="section-doc-guides-02-usage-md"></a>

Usage
---------

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


**loc/en.json**
```json
{
  "keys": {
    "APP_NAME": "hello-world"
  },
  "titles": {
    "WELCOME_TITLE": "Welcome to #{keys.APP_NAME}!"
  }
}
```

**loc/index.js**

```javascript
'use strict'

const apemanlocale = require('apemanlocale')

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

// Print all locales
locales.print()

module.exports = locales

```


Then,

```javascript
'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!"

```


<!-- Section from "doc/guides/02.Usage.md.hbs" End -->

<!-- Section from "doc/guides/03.Signature.md.hbs" Start -->

<a name="section-doc-guides-03-signature-md"></a>

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 |


<!-- Section from "doc/guides/03.Signature.md.hbs" End -->

<!-- Section from "doc/guides/04.Build in.md.hbs" Start -->

<a name="section-doc-guides-04-build-in-md"></a>

Build-in messages
----------------

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


<!-- Section from "doc/guides/04.Build in.md.hbs" End -->


<!-- Sections Start -->


<!-- LICENSE Start -->
<a name="license"></a>

License
-------
This software is released under the [MIT License](https://github.com/apeman-labo/apemanlocale/blob/master/LICENSE).

<!-- LICENSE End -->


<!-- Links Start -->
<a name="links"></a>

Links
------

+ [apeman][apeman_url]

[apeman_url]: https://www.npmjs.com/package/apeman

<!-- Links End -->
