Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

josepoo

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

josepoo

i18n error translation plugin

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

josepoo

A HAPI plugin for i18n of error messages, leveraging the i18n module

Install hapi and josepoo and have it saved to your package.json dependencies:

npm install hapi --save
npm install josepoo --save

Add plugin to server


var Hapi = require('hapi');

// Create a server with a host and port
var server = Hapi.createServer('localhost', 8000);

// Add the route
server.route({
    method: 'GET',
    path: '/hello',
    handler: function (request, reply) {

        reply('hello world');
    }
});

//  Josepoo options
var josepooOptions = {
  // setup some locales - other locales default to en silently
  locales:['en', 'es'],
  // where to store json files - defaults to './locales' relative to modules directory
  directory: './locales',
  // whether to write new locale information to disk - defaults to true
  updateFiles: false
}

//  Add the plugin
server.pack.require('josepoo', josepooOptions, function (err) {
  if (!err && err !== null) {
    server.log(['error'], 'Plugin "josepoo" load error: ' + err);
  } else {
    server.log(['start'], 'josepoo loaded');
  }
});

// Start the server
server.start();

Create you locales

Example ./locales/es.json

{
  "Hello" : "Hola",
  "Not good" : "No esta bien"
}

FAQs

Package last updated on 23 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc