franciscop / translate

:sa: Translate text on node.js and the browser with promises
MIT License
288 stars 44 forks source link

Contributing vs Building new #42

Closed geoguide closed 1 year ago

geoguide commented 1 year ago

Hello, I was adding some features to your translate repository and ended up changing it quite a bit (the API changed) I haven't contributed a lot to open-source projects and was wondering if I should open a PR or split off into a different tool that is based on yours? Just trying to do the right thing!

franciscop commented 1 year ago

Well I don't know without more information, what's the proposed new API? What are the reason for the changes? Certainly individual changes/improvements are preferred than to clump them all together into a single PR, since some might be welcome and some might not. But I would prefer not to use TS, so if that's part of the PR please split it into a different tool/project.

geoguide commented 1 year ago

TS was the main reason I needed to change the API, TS did not really like the way that the functions were structured so the path of least resistance was to change it so that you had a static class function rather than have the object you set properties on be the same as the function you call so instead of

translate.engine = 'deepl'
translate('hola')

It becomes

Translation.engine = 'deepl'
Translation.translate('hola')

prior to that I just started to add a simple feature that allowed you to utilize the auto-detect language from google. I could make a smaller pr that does that if you'd like - it's super simple. I also don't want to feel like I'm stealing your work for a new tool if that will bother you, I just really like having things be type-safe, it helped me a lot.

franciscop commented 1 year ago

That API is def worse, where you can just have a translate('a') why have Translation.translate('a')? For Typescript? If the tool is getting in the way of a better design then maybe it's best not to use the tool. That said, it seems it's definitely possible to do that in TS: https://stackoverflow.com/q/12766528/938236

But again, I don't want TS in my projects. Type definitions might be okay (index.d.ts on its own) if there was a way to validate them, but there doesn't seem to be.

I also don't want to feel like I'm stealing your work

That's easy, there's a LICENSE in this repo, just follow it if you use my work :)

geoguide commented 1 year ago

Thank you!