WICG / translation-api

A proposal for translator and language detector APIs
Other
123 stars 6 forks source link

Should we include translation with an unknown source language? #1

Closed domenic closed 4 months ago

domenic commented 7 months ago

This is an open question discussed in this part of the explainer. The current proposal includes the ability to translate without specifying a source language, in which case the return type of translate() and translateStreaming() will change to include the detected language.

The alternative API is to require the web developer to specify the source language. If they don't know it, they can use the language detection part of the API first, and then separately use the translation API.

Both approaches have some precedents:

One factor to note is that bundling together language detection with translation requires the implementation to make a single best-guess at the source language. Whereas, separating the steps allows the detection step to return multiple possibilities, and then the developer can choose what to do with that information.

MuraraAllan commented 4 months ago

My opinion is do both ahhaha

I'm working with this right now, but using the window.ai modus operandis.

and from a dev perspective it is interesting to :


const translator = await translator.create({
  sourceLanguage: <strlang || languageList><translator.identifiedSourceLanguage><browser.language><browser.intlLanguage>
  targetLanguage: <strlang || languageList><browser.languageOption2>
});
Which would allow : 
.translate("browsers have so many interesting stuff going on this days")
outputs "browsers tem tanta coisa interessante acontecendo nesses dias".
.translate("text", {
  sourceLanguage: <opt><translator.identifiedSourceLanguage><browser.language><browser.intlLanguage>
  targetLanguage: <opt><browser.languageOption2>,
})

I would also suggest personification as a parameter for the translator agent.

.translate("text", {
  sourceLanguage: <opt><translator.identifiedSourceLanguage><browser.language><browser.intlLanguage>,
  targetLanguage: <opt><browser.language>, \n
  outputs: "adopt awesome_translation_agent; reproc(<awesome_translation_agent outputs exclusively in JSON;" - inference over the inference. Totally just "shots there"
})
domenic commented 4 months ago

I can't really understand your examples, as they seem to be using some syntax other than JavaScript.

domenic commented 4 months ago

Closed by #15.