chronic
chronic copied to clipboard
Add localization support for chronic
Moved all english hardcoded regexes/strings to a locale hash, which is in its separate file.
Created a separate gem to maintain other locales: https://github.com/luan/chronic-l10n
Thanks for all this work. I'm not really sure how I feel about adding this kind of functionality to Chronic but I quite like what you've done. I've merged this into the localization branch as I think it needs a little work and more tests but I'm happy to work towards merging this.
Thanks a ton
I will try to work a little more on this tonight, please le me know more about what do you think could be done better!
+1 for this idea - good if it work in Rails 3.2 - seems not working yet (or I'm wrong?)
It shouldn't depend on Rails version to work, if you want it to work you have to put this lines in your Gemfile (for now):
gem 'chronic', git: 'git://github.com/mojombo/chronic.git', branch: 'localization'
gem 'chronic-l10n', '~> 0.0.1.pre.1'
Ok man, this sounds good, will make some tests, thanks!
+1 for localization. (I am Dutch). If the code is working properly, then I am happy to add a nl-NL localization file.
@luan Now I've refactored master a little I think this might fit. Could you take a shot at rebasing things against master so we can merge and roll this out? Otherwise I'll take a shot at it when I have some spare time. :metal:
Sure thing. Will try to do that today or tomorrow! Thank you.
On Friday, January 18, 2013, Lee Jarvis wrote:
@luan https://github.com/luan Now I've refactored master a little I think this might fit. Could you take a shot at rebasing things against master so we can merge and roll this out? Otherwise I'll take a shot at it when I have some spare time. [image: :metal:]
— Reply to this email directly or view it on GitHubhttps://github.com/mojombo/chronic/pull/113#issuecomment-12412652.
Luan Haddad Ricardo dos Santos
Ping @injekt
@luan Sorry I am planning on finding time for this, I'll rebase the changes against master. I need to fix some of the big bugs on head before this featured is merged upstream. Thanks again for the work on this!
@injekt I don't want to nag but any news on this subject?
Sorry I've been super busy lately. I've merged this locally but I'm having failures I'll need to resolve before merging upstream
i do not want to gar but
+1
+1 (+2 if I could!) I'd be happy to contribute with the italian locale!
Good Luck On 2013年05月22日 04:16, Andrea Vanini wrote:
+1 (+2 if I could!) I'd be happy to contribute with the italian locale!
— Reply to this email directly or view it on GitHub https://github.com/mojombo/chronic/pull/113#issuecomment-18236786.
Ubuntu
I've merged this into the localization branch and fixed the conflicts. It's not yet running green though, as there are issues with the numerizer parsing.
Well, I'd love to contribute with an spanish locale :)
I was working to improve Chronic support for different date/time formats and get rid of all those regexp hacks. It all went well at start until I had to deal with Timezone parsing. Chronic doesn't really have much logic for Timezone parsing and it defers it to Time.parse so you can't parse any Timezone strings that's not supported by Ruby and Ruby have very poor timezone support. So right now I'm creating new separate gem which will parse Timezones and it will support all locales from CLDR out of box. Then later after might also add CLDR support for Chronic and won't be any need for users to translate anything as it's already done by CLDR guys.
Hi @davispuh!
Any updates? :)
Thanks in advance!
yeah, well sorry it's taking quite a lot of time as I've other projects also ongoing and there's never enough time. Anyway I just now pushed TimezoneParser. It's not finished yet and usually I don't like to publish stuff until it's more completed but I had to show :D So basically it's almost done and currently implemented parts are fully working, including tests. Only this is kinda alpha version as I'll change few things and will do various improvements. Also have to write documentation and more tests. Still I would suggest to check it out ;) I'm pretty proud myself lol as it have very good functionality (as example timezone_spec.rb).
I'm not sure when I'll finish TimezoneParser fully, but it probably will be quite soon as there aren't much left to do. Then after I'll continue to work on some Chronic things, but that will take some not so short while. Basically I would say that you should contribute yourself if you need it. My idea about localization is that there would be different gem which uses CLDR data to parse those strings and Chronic uses it. Same like it will be with TimezoneParser.
Great, thanks @davispuh! :)
I've finally finished TimezoneParser yey :) also documented most of methods and pushed gem. It works perfectly and I don't have any plans for new features unless there will be something missing. But there's one bad thing and I'm not sure how to resolve it. It's slow to load timezone data from files to memory. It's only one time cost but for all data files it takes 4-5 seconds and I think that's a lot, it's 6 MiB of text (all languages). Using only abbreviations it still takes 1 second (1 MiB file). I'm using Ruby's marshal which is fastest serialization, but still not enough in this case. Maybe using some custom made binary format would be faster, not sure. Another way would be to create separate files for each locale, but that wouldn't work for abbreviations anyway. Also there can be cases when you've no idea what language you're parsing and then I guess it might be slower to load all files separate. Anyway I would appreciate any reviews, PRs and improvements.