New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

locals

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

locals

A Locals Middleware

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

Locals

Locals

A Localization Middleware For NodeJS

#Installing

npm install locals --save

#LOCALS Locals currently only supports translations but in the future will support many more features. (see TODO).

#USING To use locals within your application or module you can use the following javascript example:

var locals = require('locals')({
	localsdir: "../locals",
	baselanguage: "en"
});
locals.init(function() {
	locals.local('es');
	var translatedText = locals.translate("Hello World");
	console.log("Translation:", translatedText);
});

#Introduction Locals utilizes a Folder and Json based hierarchy for loading and translating locale data. Locale data can then be used to translate text from a given language to any other given language. Locals uses the 2 digit ISO standard for language designation. All locals are created manually by the author as only a basic local demonstration set has been added to this release.

#Locals Structure Locals uses folders to load locale data. The follow folder structure is used in creation of a base language to translate from:

./locals/en
./locals/de
./locals/fr

Where each language folder is a 2 digit ISO representation of the main language to translate from.

Each locale folder may contain any other 2 digit ISO representation of a secondary language to translate to represented as a json file:

./locals/en/de.json
./locals/en/en.json
./locals/en/es.json

Where each json file represents the locale to translate to from the parent folders locale.

For direct reference see the examples folder within the package or on github.

#TODO

  • Distance Lookups
  • Geo Targeting
  • Planetary Data Locations
  • Triangulation
  • Currency Conversions

#CONTRIBUTING

We encourage forking. Feel free to fork & pull your new additions, or bug fixes.

##LICENSE MIT

Keywords

local

FAQs

Package last updated on 27 May 2015

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