name: translate-small
about: Translate text or files to another language
notify: true
args:
- name: text
short: 't'
input: string
default: '{system_clipboard}'
help: Text to translate
- name: file
short: 'f'
input: string
default: ''
help: File or URL to translate
- name: to
short: 'l'
input: string
default: 'Russian'
help: Target language (e.g., Russian, English, Chinese)
api:
output: replace
args:
text: selection
actions:
- tag: tag_content
run: cmd
expect: string
check: .+
action:
- when: '{file|empty}'
then: echo "{text}"
- when: '{file|empty:not}'
then: cat "{file|load}"
- tag: tag_translated
run: small
expect: string
action: |
[Task]
Translate the entire [Text] to the language specified in [User].
Do not translate proper names, code, or comments inside code blocks.
Reply with the full translated text.
[User]
{to}
[Text]
{tag_content}
- tag: tag_clipboard
run: value
expect: string
action: '{tag_translated|clipboard}'