This package has been deprecated

Author message:

move to @the-/loc ( https://github.com/the-labo/the/tree/master/packages/loc#readme )

the-loc

5.0.1 • Public • Published

the-loc

Build Status npm Version JS Standard

Locale resolver for the-framework

Installation

$ npm install the-loc --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 {create: theLoc} = require('the-loc')
 
const env = theLoc({
  en: require('./en')
})
 
module.exports = env
 

Then,

'use strict'
 
// Require defined locales
const loc = require('./loc/index.js')
 
let en = loc.bind('en')
console.log(en('titles.WELCOME_TITLE')) // -> "Welcome to hello-world!"
 

API Guide

License

This software is released under the MIT License.

Links

Readme

Keywords

Package Sidebar

Install

npm i the-loc

Weekly Downloads

0

Version

5.0.1

License

MIT

Unpacked Size

110 kB

Total Files

56

Last publish

Collaborators

  • okunishinishi