Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

sails-hook-i18n

0.1.2 • Public • Published

sails-hook-i18n

Sails JS hook to allow internationalization using the i18n module.

This is essentially a port of the Sails v0.12.x core i18n hook. Sails 1.0 uses the more lightweight i18n-2 module, so if you're missing some of the features from i18n, this hook's for you!

Installation

npm install --save sails-hook-i18n

Usage

See the Sails internationalization docs for the basics of using i18n with Sails.

Configuration

See the i18n module README for full documentation -- any property set on sails.config.i18n (in the config/i18n.js file) will be passed directly in to the i18n module. Below are some common config properties.

Property Type Default Details
locales ((array)) ['en','es','fr','de'] List of supported locale codes
localesDirectory ((string)) '/config/locales' The project-relative path to the folder containing your locale translations (i.e. stringfiles)
defaultLocale ((string)) 'en' The default locale for the site. Note that this setting will be overridden for any request that sends an "Accept-Language" header (i.e. most browsers), but it's still useful if you need to localize the response for requests made by non-browser clients (e.g. cURL).
updateFiles ((boolean)) false Whether to automatically add new keys to locale (translation) files when they are encountered during a request.

Keywords

none

install

npm i sails-hook-i18n

Downloadsweekly downloads

55

version

0.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability