My app extends this idea even further by allowing different URLs based on the type of input. This demo will open four different URLs depending on the type of input:
- text is English: open English to Korean translation
- text is Korean: open Korean to English translation
- text is a URL: open the translation of the entire web page into English
- no query: open Kagi.com (Just to demonstrate the target URL is completely flexible)
This is accomplished with a configuration like this:
[Translate.Papago]
iflink = "https://papago.naver.net/website?locale=en&source=auto&target=en&url=QUERY"
lang_ko = "https://papago.naver.com/?sk=ko&tk=en&hn=0&st=QUERY"
ifquery = "https://papago.naver.com/?sk=en&tk=ko&hn=0&st=QUERY"
default = "https://kagi.com/"
Basically, it's a list of conditions and a URL to open if that condition is met.
I will expand on this idea further in my bang-centric version of my app.