date-names-ex
v0.0.3
Published
JavaScript repository of localized month and day names for single or separate files use. Based on Martin Andert code https://github.com/martinandert/date-names
Downloads
2
Maintainers
Readme
date-names-ex
Repository of localized month and day names. Usable for sites, have minified version and separate minified locale files.
Installation
Install via npm:
% npm install date-names-ex
Usage
Add script to you webpage
<script src="../build/date-names-ex.min.js" type="text/javascript"></script>
Now to get locale you can use date_names
variable.
var en_date_locale = date_names.en;
en_date_locale.months // => ['January', 'February', 'March', ...]
en_date_locale.abbreviated_months // => ['Jan', 'Feb', 'Mar', 'Apr', ...]
en_date_locale.days // => ['Sunday', 'Monday', 'Tuesday', ...]
en_date_locale.abbreviated_days // => ['Sun', 'Mon', 'Tue', 'Wed', ...]
en_date_locale.am // => 'AM'
en_date_locale.pm // => 'PM'
You can fetch a different translation like that:
var de_date_locale = date_names.de;
de_date_locale.months // => ['Januar', 'Februar', 'März', ...]
de_date_locale.abbreviated_months // => ['Jan', 'Feb', 'Mär', 'Apr', ...]
de_date_locale.days // => ['Sonntag', 'Montag', 'Dienstag', ...]
de_date_locale.abbreviated_days // => ['So', 'Mo', 'Di', 'Mi', ...]
de_date_locale.am // => 'vormittags'
de_date_locale.pm // => 'nachmittags'
If you need only Ru
locale, for example, you can use just this local file like that:
<script src="../build/date-names-ex.ru.min.js" type="text/javascript"></script>
Adn then use it like that:
date_names_ru.months // => ['Январь', 'Февраль', 'Март', ...]
date_names_ru.abbreviated_months // => ['Янв', 'Фев', 'Мар', 'Апр', ...]
date_names_ru.days // => ['Воскресенье', 'Понедельник', 'Вторник', ...]
date_names_ru.abbreviated_days // => ['Вс', 'Пн', 'Вт', 'Ср', ...]
date_names_ru.am // => 'до полудня'
date_names_ru.pm // => 'после полудня'
English (en), German (de), Finnish (fi), Brazilian Portuguese (pt-br), Russian (ru) and Spanish (es) are currently the only supported locales. Pull requests welcome.
Contributing
Here's a quick guide:
Fork the repo
npm install
grunt
Make you changes and add test for you functionality if you add new language. Look into
/test
folder.Check that all test passed by running
grunt
Push to your fork and submit a pull request.
Licence
Released under Mozilla Public License Version 2.0