Nani for Mac and Windows can start a translation when you open a special URL.
This is useful when you want to send text to Nani from a notes app, a launcher, or your own script.
Basic format
Use this URL format:
naniapp://translate?source=Text%20to%20translate
Nani receives the text in source and starts translating it.
URL encoding the text
If your text includes spaces, symbols, Japanese, or other non-Latin characters, encode the source value for URLs.
For example:
naniapp://translate?source=Translate%20this%20text
If you're calling it from JavaScript, encodeURIComponent is the easiest way to do this.
const text = 'Text to translate'
const url = `naniapp://translate?source=${encodeURIComponent(text)}`
window.location.href = url
Target language settings
You can't specify the target language or translation style in this URL. Nani uses the current settings in the desktop app.
In other words, it works the same way as using the app's shortcut. Nani looks at the input text and decides the target language based on your app settings.
Web page URLs are not supported
If you pass a web page URL like https://example.com to source, Nani won't translate the page through this URL scheme.
To translate a web page, enter the URL directly in Nani's input field.
Not a public API
This URL scheme is only for opening the Nani desktop app installed on your computer.
It isn't a public API, so it can't return the translation result to the app or script that opened it.
