wintersmith-l10n

0.5.0 • Public • Published

wintersmith-l10n Build Status Dependency Status

A Wintersmith plugin to localize dates and times

Installation

Install globally or locally using npm:

npm install [-g] wintersmith-l10n

Add wintersmith-l10n to your config.json:

{
  "plugins": [
    "wintersmith-l10n"
  ]
}

Define the locale property:

{
  "locale": "en"
}

Usage

Get the current locale:

env.helpers.l10n.get();

Set a new locale:

env.helpers.l10n.set('en-GB');

Localize a date:

env.helpers.l10n.localize(new Date(), 'LL');

Localize a time:

env.helpers.l10n.localize(new Date(), 'HH:mm');

Please note that wintersmith-l10n relies on moment to format dates and times. So, any format supported by moment is also supported by wintersmith-l10n.

License

wintersmith-l10n is released under the MIT license.

Package Sidebar

Install

npm i wintersmith-l10n

Weekly Downloads

0

Version

0.5.0

License

MIT

Last publish

Collaborators

  • xavierdutreilh