chronic icon indicating copy to clipboard operation
chronic copied to clipboard

Add localization support for chronic

Open luan opened this issue 13 years ago • 23 comments

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

luan avatar Aug 01 '12 19:08 luan

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

leejarvis avatar Aug 02 '12 12:08 leejarvis

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!

luan avatar Aug 02 '12 14:08 luan

+1 for this idea - good if it work in Rails 3.2 - seems not working yet (or I'm wrong?)

andreydjason avatar Aug 19 '12 22:08 andreydjason

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'

luan avatar Aug 20 '12 12:08 luan

Ok man, this sounds good, will make some tests, thanks!

andreydjason avatar Aug 21 '12 00:08 andreydjason

+1 for localization. (I am Dutch). If the code is working properly, then I am happy to add a nl-NL localization file.

metbril avatar Nov 09 '12 10:11 metbril

@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:

leejarvis avatar Jan 18 '13 08:01 leejarvis

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

luan avatar Jan 18 '13 16:01 luan

Ping @injekt

luan avatar Jan 29 '13 21:01 luan

@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!

leejarvis avatar Jan 30 '13 12:01 leejarvis

@injekt I don't want to nag but any news on this subject?

mperice avatar Mar 02 '13 01:03 mperice

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

leejarvis avatar Mar 05 '13 16:03 leejarvis

i do not want to gar but

abdirixman avatar Mar 13 '13 13:03 abdirixman

+1

guyisra avatar Mar 22 '13 17:03 guyisra

+1 (+2 if I could!) I'd be happy to contribute with the italian locale!

apuntovanini avatar May 21 '13 20:05 apuntovanini

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

double12gzh avatar May 22 '13 03:05 double12gzh

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.

leejarvis avatar May 22 '13 07:05 leejarvis

Well, I'd love to contribute with an spanish locale :)

dgilperez avatar Nov 01 '13 22:11 dgilperez

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.

davispuh avatar Nov 01 '13 22:11 davispuh

Hi @davispuh!

Any updates? :)

Thanks in advance!

scanferla avatar Feb 09 '14 22:02 scanferla

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.

davispuh avatar Feb 10 '14 17:02 davispuh

Great, thanks @davispuh! :)

scanferla avatar Feb 13 '14 18:02 scanferla

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.

davispuh avatar Feb 21 '14 19:02 davispuh