soerenuhrbach/vscode-deepl

add support for formality

Closed this issue · 5 comments

The API knows a lot more settings than your addon can configure. It would be helpful to be able to configure the formality of the translated text, e.g.formality=less

$ curl https://api-free.deepl.com/v2/translate -d auth_key=xxx -d "text=Hello, how are you?" -d "target_lang=DE" -d "formality=less"

{"translations":[{"detected_source_language":"EN","text":"Hallo, wie geht es dir?"}]}

VS

$ curl https://api-free.deepl.com/v2/translate -d auth_key=xxx -d "text=Hello, how are you?" -d "target_lang=DE" -d "formality=more"

{"translations":[{"detected_source_language":"EN","text":"Hallo, wie geht es Ihnen?"}]}

Oh and split_sentences would be nice too ☺️

luto commented

@soerenuhrbach I'd like to tackle this, but am a bit lost on the UI. Where would you like to see these settings?

A) prompt the user like for source / target lang. This seems cumbersome because it will prompt for four things (worst case) on any translation.

B) set globally / per workspace in the settings, like the API key. This makes using the extension very snappy, but removes flexibility. However, I think each project will mostly use just one writing style. It would be possible to extend this later with path matching, e.g. "use formality=less in **/de.json, but formality=more in **/de_formal.json.".

I think B) is better. Which of those (or a totally different solution) do you prefer?

Hi @luto,

Glad to hear you want to contribute to the project. :)
I agree with you! Its fine the set the formality as setting, like the api key!

I will publish the new version soon!

Hi @nichtmax and @luto,

thanks for your participation. I just triggered a release for version 1.0.2 with the recent changes!
I hope you enjoy the extension. Happy Coding!