https://github.com/luan/chronic-l10n
Pack of locales for localizing Chronics date parsing.
https://github.com/luan/chronic-l10n
Last synced: 3 months ago
JSON representation
Pack of locales for localizing Chronics date parsing.
- Host: GitHub
- URL: https://github.com/luan/chronic-l10n
- Owner: luan
- License: mit
- Created: 2012-07-31T19:12:52.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2013-01-31T21:20:09.000Z (over 13 years ago)
- Last Synced: 2025-02-23T02:43:08.397Z (over 1 year ago)
- Language: Ruby
- Homepage: https://github.com/mojombo/chronic
- Size: 131 KB
- Stars: 8
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
Chronic
=======
## DESCRIPTION
[Chronic](https://github.com/mojombo/chronic) is a natural language date/time parser written in pure Ruby.
Chronic L10n aims to add translations to [Chronics](https://github.com/mojombo/chronic) abilities.
## INSTALLATION
*WARNING*: This gem will only work when and **IF** [this fork](https://github.com/luan/chronic) of chronic gets merged and released.
Meanwhile you can install the [chronic](https://github.com/luan/chronic) gem from the forks source to get it going.
### RubyGems
$ [sudo] gem install chronic-l10n
### GitHub
$ git clone git://github.com/luan/chronic-l10n.git
$ cd chronic-l10n && gem build chronic-l10n.gemspec
$ gem install chronic-l10n-.gem
## USAGE
You can parse strings containing a natural language date using the
`Chronic.parse` method.
require 'chronic'
require 'chronic-l10n'
Time.now #=> Sun Aug 27 23:18:25 PDT 2006
Chronic.locale = :'pt-BR'
Chronic.parse('amanhã')
#=> Mon Aug 28 12:00:00 PDT 2006
Chronic.parse('segunda', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006
Chronic.parse('essa terça 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
Chronic.parse('essa terça 5:00', :ambiguous_time_range => :none)
#=> Tue Aug 29 05:00:00 PDT 2006
Chronic.parse('27 de maio', :now => Time.local(2000, 1, 1))
#=> Sat May 27 12:00:00 PDT 2000
Chronic.parse('27 de maio', :guess => false)
#=> Sun May 27 00:00:00 PDT 2007..Mon May 28 00:00:00 PDT 2007
Chronic.parse('6/4/2012', :endian_precedence => :little)
#=> Fri Apr 06 00:00:00 PDT 2012
See `Chronic.parse` for detailed usage instructions.
## CONTRIBUTE
You might like to add your language or improve some already available language, start by forking the repo on GitHub:
https://github.com/luan/chronic-l10n
The best way to get your changes merged back into core is as follows:
1. Clone down your fork
1. Create a thoughtfully named topic branch to contain your change
1. Hack away
1. Add tests and make sure everything still passes by running `rake`
1. Ensure your tests pass in multiple timezones. ie `TZ=utc rake` `TZ=BST rake`
1. If you are adding new functionality, document it in the README
1. Do not change the version number, we will do that on our end
1. If necessary, rebase your commits into logical chunks, without errors
1. Push the branch up to GitHub
1. Send a pull request for your branch