XapaJIaMnu / translateLocally

Fast and secure translation on your local machine, powered by marian and Bergamot.
MIT License
507 stars 29 forks source link

Distribute models with their own extension & mime-type #57

Open jelmervdl opened 3 years ago

jelmervdl commented 3 years ago

From #38:

For windows at least it's better to manufacture our own file extension so the application can be launched for that extension.

I love the idea of being able to double-click a blob you've downloaded, and translateLocally just importing & selecting it.

To implement this, I think we'll need to do the following:

  1. Come up with an extension.
    • .translationmodel
    • .languagemodel
    • .tlmodel
    • .tllanguage
    • something unique, not too long, possibly understandable
  2. Per platform…
    1. Add proper metadata to tell OS that TranslateLocally can open these files
    2. Implement message handlers that trigger when the OS wants to open a file (macOS, don't know about win & linux at the moment)

Then, we'll need to decide what to do when someone does open a model file:

  1. As a macOS user, I would expect that double-clicking a model file will import it into my local library of models, and probably switch the interface to use that newly imported model. TranslateLocally should come to the foreground when this happens, and probably also give some confirmation that it completed. (This is how apps like iTunes and various apps with plugins behave.)
  2. Another possible behaviour might be to just load the model once, but at next start-up not know about it anymore. As if the model is a ephemeral file. (This is more how something like Apple Preview would behave if you open a PDF).

I think the first makes more sense for downloaded models.

For distributing, best solution would probably be to host the files with the extension. Short-term work-around would be to allow people to download models from the website (we need to make that an option anyway) and use the a[download] attribute to force it to have the right extension.

XapaJIaMnu commented 2 years ago

We also want to distribute repositories as a mime type, moving this here from #84