kennethreitz / maya

Datetimes for Humans™
MIT License
3.41k stars 196 forks source link

Add Internationalization #84

Open JosXa opened 7 years ago

JosXa commented 7 years ago

So I came across this library listening to your Podcast with Michael Kennedy and immediately loved this addition to your "python for humans" series. What discourages me though, is that there doesn't seem to be a possibility for changing the language. I saw that the humanize module you're using for the slang dates actually supports internationalization via i18n, so what steps would need to be taken to support full internationalization for this great piece of software?

kennethreitz commented 7 years ago

No plans at this time! I'm fine with only supporting English, as it seems to be the "esperanto" of the internet — i think a great approach might to be a wrapper that translates the french/italian/etc/etc into english and then runs it through the parser.

moin18 commented 7 years ago

I think we can utilize the internationalization support from the pendulum library. Anyway maya has a dependency on pendulum

kennethreitz commented 7 years ago

@moin18 have an API proposal?

alxwrd commented 6 years ago

I've had a look into this and it seems dateparser supports parsing different languages, so therefore maya's .when() will too.

>>> import maya
>>> maya.when("2日前").slang_time()
'2 days ago'
>>> maya.when("il y a 2 jours").slang_time()
'2 days ago'
>>> maya.when("Vor 2 Tagen").slang_time()
'2 days ago'

For slang_time/date pendulum does have support for human output in different locales, but only for time. I will open a PR to discuss the changes.

timofurrer commented 6 years ago

@alxwrd Sounds great!

github-actions[bot] commented 5 years ago

This Issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days