Translate and Clipboard Text Function

Would it be possible to add a translate function? Maybe something like $tr("text", "country code")$ so $tr("Japan", "JP")$ would display "日本."

Additionally, it would also be helpful to display text that is copied to the clipboard. This way, with the translate function, it would be fast and simple understand something that was copied just by looking at KLWP.

As a traveler and foreign language fanatic it would be a great resource to display texts more flexibly.

...or is there already a way with Tasker?

Thanks for entertaining the idea. :)

I have the Microsoft Translator app installed, and when I select text like for clipboard functions, an option to translate is there along with the usual copy/paste options and a pop-up shows the translation.

No idea how to use that here.

Then, on Touch actions and "activity" I see M.S. translator has an activity for "in app translation" but when I set it up and touch.. I get a small pop-up saying "no text to translate". I thought maybe this activity can somehow be used with a Shell Command in a "formula" but don't know if or how that's possible... maybe the developer knows?

A search about "translate from shell" tells me about a "trans" command on github that runs on linux and uses Google translate to do translation from a shell command but don't know if this will install on Android without rooting, idk. But KWGT does support shell commands.

?