0.5.0 • Published 8 years ago
wintersmith-l10n v0.5.0
wintersmith-l10n
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.