mtimkovich / rip_quick_add

Quickly create Google Calendar events from natural language.
https://chrome.google.com/webstore/detail/rip-quick-add/einookkhlkagdckkngcebldmicpilpmk
MIT License
11 stars 3 forks source link

Could we consider other locales for chrono parsing ? #2

Closed Geslain closed 6 months ago

Geslain commented 6 months ago

Hello !

First of all, thank you for your job and maintaining it, your chrome extension is exactly what i was looking for.

But sadly it doesn't work for other locales than english, because your only using chrono's default one. Could you consider adding support for all chrono supported locales ? I would be glad to submit you a pull request with the changes if you're ok !

mtimkovich commented 6 months ago

I'm glad you like it! That would be a good addition. I don't see a straightforward way to do that. Maybe loop through all the locales and see which ones successfully parse? I'd certainly accept a PR for it!

Edit: Or maybe you're suggesting adding an option for which locale to parse for? That could work better.

Geslain commented 6 months ago

Maybe loop through all the locals and see which ones successfully parse

That was my first thought, but actually I stumbled on case that changed my mind:

I'm French so I wanted the following date to be parsed in my language

07:30 vendredi 12 juillet, 2024 - 09:20 vendredi 12 juillet, 2024

Which correspond to 7:30AM Friday July 12th - 9:20AM Friday July 12th in English

Problem is, this is actually parsed by chrono because it detects time. So the JavaScript DateTime object that results from parsing is basically today's date but with respectively time at 7:30am and 9:20am. So we can't just loop on locales like we were thinking.

So I came with another idea which is the one you're talking about in your edit: let the user chose the language he wants to use. I made a prototype just to see I it would work, these are screenshots of a basic example:

image image

This is a simple example but maybe instead of allowing user to select language in popup or context menu we should add a config page for the extension ? What are your thoughts ?

If you want to take a look at my example, i forked your project and made a "wip" pull request or else look at the custom-chrome-extension branch. For development convenience i transformed you server baser architecture into a rollup base architecture to embed all code and avoid API calls, but as you're using this code also on your website maybe you want to keep it that way.

mtimkovich commented 6 months ago

That's a great point. The wip looks good. It would be best to create an options page and set the language there.

Geslain commented 6 months ago

I agree, I'll look into it and make a pull request. Are you interested by the rollup approach or would you like to keep it that way ?

mtimkovich commented 6 months ago

I like the roll up approach, let's do that. 👍

On Tue, Mar 12, 2024, 8:35 PM Gess @.***> wrote:

I agree, I'll look into it and make a pull request. Are you interested by the rollup approach or would you like to keep it that way ?

— Reply to this email directly, view it on GitHub https://github.com/mtimkovich/rip_quick_add/issues/2#issuecomment-1993335121, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE66RN6Y55YJUFHDPXBHWTYX7CPFAVCNFSM6AAAAABEP277V6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJTGMZTKMJSGE . You are receiving this because you commented.Message ID: @.***>

Geslain commented 6 months ago

Oh didn't saw your answer. I just pushed a pull request with your current approach I'll make a second one with new approach