diff --git a/src/info.plist b/src/info.plist
index 442cfe3..2965330 100644
--- a/src/info.plist
+++ b/src/info.plist
@@ -6,18 +6,21 @@
com.skynetua.alfred-qtranslate
connections
- 94EED11C-93A9-4FF4-8F28-14E546743485
+ 4D336543-B533-47A4-841C-4CD4A8E413D4
destinationuid
- 7F6DE136-5E1D-4A3A-84E8-269B076CE825
+ 94EED11C-93A9-4FF4-8F28-14E546743485
modifiers
- 1048576
+ 0
modifiersubtext
vitoclose
+
+ 94EED11C-93A9-4FF4-8F28-14E546743485
+
destinationuid
ECA3047F-8C4F-4C35-AA1F-36F3E4FF3ADD
@@ -28,6 +31,36 @@
vitoclose
+
+ destinationuid
+ 267B3A49-0770-47BA-811F-74D9C1EB3B43
+ modifiers
+ 524288
+ modifiersubtext
+
+ vitoclose
+
+
+
+ destinationuid
+ 7F6DE136-5E1D-4A3A-84E8-269B076CE825
+ modifiers
+ 1048576
+ modifiersubtext
+
+ vitoclose
+
+
+
+ destinationuid
+ B02D8943-4DFC-48D6-9AD9-DE3926ED57C4
+ modifiers
+ 262144
+ modifiersubtext
+
+ vitoclose
+
+
E59094FA-7C50-4B18-8B4D-518D96B0966F
@@ -56,17 +89,21 @@
config
- browser
-
- searcher
- 1635218546
+ autopaste
+
+ clipboardtext
+ {query}
+ ignoredynamicplaceholders
+
+ transient
+
type
- alfred.workflow.action.systemwebsearch
+ alfred.workflow.output.clipboard
uid
- 7F6DE136-5E1D-4A3A-84E8-269B076CE825
+ ECA3047F-8C4F-4C35-AA1F-36F3E4FF3ADD
version
- 1
+ 3
config
@@ -99,6 +136,25 @@
version
2
+
+ config
+
+ autopaste
+
+ clipboardtext
+ {query}
+ ignoredynamicplaceholders
+
+ transient
+
+
+ type
+ alfred.workflow.output.clipboard
+ uid
+ 267B3A49-0770-47BA-811F-74D9C1EB3B43
+ version
+ 3
+
config
@@ -127,13 +183,13 @@
runningsubtext
Translating
script
- python3 ./translate.py "$1" $lang $alt;
+ /usr/bin/python3 ./translate.py "$1" $lang $alt;
scriptargtype
1
scriptfile
subtext
- en-{var:lang}, {var:lang}-en
+ {var:lang}-{var:alt}, {var:alt}-{var:lang}
title
Translate
type
@@ -151,54 +207,99 @@
config
- autopaste
-
- clipboardtext
- {query}
- ignoredynamicplaceholders
-
- transient
+ text
+ Translate 'query'
+
+ type
+ alfred.workflow.trigger.fallback
+ uid
+ 4D336543-B533-47A4-841C-4CD4A8E413D4
+ version
+ 1
+
+
+ config
+
+ browser
+
+ searcher
+ 1635218546
+
+ type
+ alfred.workflow.action.systemwebsearch
+ uid
+ 7F6DE136-5E1D-4A3A-84E8-269B076CE825
+ version
+ 1
+
+
+ config
+
+ argument
+ t {query}
+ leftcursor
type
- alfred.workflow.output.clipboard
+ alfred.workflow.utility.showalfred
uid
- ECA3047F-8C4F-4C35-AA1F-36F3E4FF3ADD
+ B02D8943-4DFC-48D6-9AD9-DE3926ED57C4
version
- 3
+ 1
readme
uidata
+ 267B3A49-0770-47BA-811F-74D9C1EB3B43
+
+ xpos
+ 560
+ ypos
+ 185
+
+ 4D336543-B533-47A4-841C-4CD4A8E413D4
+
+ xpos
+ 35
+ ypos
+ 250
+
7F6DE136-5E1D-4A3A-84E8-269B076CE825
xpos
- 435
+ 560
ypos
- 15
+ 300
94EED11C-93A9-4FF4-8F28-14E546743485
xpos
210
ypos
- 95
+ 185
+
+ B02D8943-4DFC-48D6-9AD9-DE3926ED57C4
+
+ xpos
+ 425
+ ypos
+ 360
E59094FA-7C50-4B18-8B4D-518D96B0966F
xpos
- 45
+ 30
ypos
- 95
+ 120
ECA3047F-8C4F-4C35-AA1F-36F3E4FF3ADD
xpos
- 620
+ 560
ypos
- 95
+ 70
userconfigurationconfig
diff --git a/src/translate.py b/src/translate.py
index 3f87a20..c7ea8a1 100644
--- a/src/translate.py
+++ b/src/translate.py
@@ -6,16 +6,18 @@
import json
import feedback
import sys
+import re
def is_ascii(s):
- """http://stackoverflow.com/questions/196345/how-to-check-if-a-string-in-python-is-in-ascii"""
+ s = re.sub(r'\W+', '', s)
return all(ord(c) < 128 for c in s)
def get_translation_direction(text):
"""Returns direction of translation."""
lang = sys.argv[2]
- return f'en-{lang}' if is_ascii(text) else f'{lang}-en'
+ alt = sys.argv[3]
+ return f'{lang}-{alt}' if is_ascii(text) else f'{alt}-{lang}'
async def process_requests(urls):
async with aiohttp.ClientSession() as session: