From c4a3d72751d1c2e68dc5fb2a1d08c9ee8eccb3f9 Mon Sep 17 00:00:00 2001 From: Quang Lam Date: Mon, 27 Aug 2018 15:51:32 -0500 Subject: [PATCH] Add PopClip Extension (#46) --- docs/popclip.html | 20 +++++++++++++ packager.js | 5 ++++ popclip/README.md | 1 + popclip/Translatium.popclipextz | Bin 0 -> 9709 bytes popclip/Translatium/Config.plist | 40 +++++++++++++++++++++++++ popclip/Translatium/translatium.png | Bin 0 -> 7499 bytes public/electron.js | 26 +++++++++++++++- src/components/app.js | 24 ++++++++++++++- src/components/pages/home/index.js | 12 +------- src/components/pages/settings/index.js | 8 +++++ src/strings/de.app.json | 4 ++- src/strings/en.app.json | 4 ++- src/strings/pl.app.json | 4 ++- src/strings/pt_BR.app.json | 4 ++- src/strings/vi.app.json | 4 ++- src/strings/zh-CN.app.json | 4 ++- 16 files changed, 141 insertions(+), 19 deletions(-) create mode 100644 docs/popclip.html create mode 100644 popclip/README.md create mode 100644 popclip/Translatium.popclipextz create mode 100755 popclip/Translatium/Config.plist create mode 100755 popclip/Translatium/translatium.png diff --git a/docs/popclip.html b/docs/popclip.html new file mode 100644 index 00000000..19c4a74a --- /dev/null +++ b/docs/popclip.html @@ -0,0 +1,20 @@ +--- +title: PopClip Extension +layout: default +--- +
+
+
+

Back to Home

+

PopClip Extension

+

Open Translatium with the selected text.

+

+ + Download + +

+

The extension requires Translatium v8.6.0 or higher.

+

The extension is also available on PilotMoon's website when it is approved by the developer.

+
+
+
\ No newline at end of file diff --git a/packager.js b/packager.js index 92d22591..4503b197 100644 --- a/packager.js +++ b/packager.js @@ -27,10 +27,15 @@ builder.build({ productName, files: [ '!docs/**/*', + '!popclip/**/*', ], directories: { buildResources: 'build-resources', }, + protocols: { + name: 'Translatium', + schemes: ['translatium'], + }, afterPack: ({ appOutDir }) => new Promise((resolve, reject) => { console.log('afterPack', appOutDir, process.platform); diff --git a/popclip/README.md b/popclip/README.md new file mode 100644 index 00000000..a5916e1a --- /dev/null +++ b/popclip/README.md @@ -0,0 +1 @@ +A pull request has also been created at https://github.com/pilotmoon/PopClip-Extensions/pull/1063. \ No newline at end of file diff --git a/popclip/Translatium.popclipextz b/popclip/Translatium.popclipextz new file mode 100644 index 0000000000000000000000000000000000000000..333df818c34a73d6d325c7d48e763b99d913d0e9 GIT binary patch literal 9709 zcmd6NWl&rT)-CRC!QDN$L*s6Zy99R$5F|(-xVt+9cemi~?k>Syf_=%IH#5xC+?o6H zol|X9eb%Smr*|MIAS#ZAwocZD&K4hS813!sjjb*0 zP28NBR5cJlB8~jD0}cJPZ$L3X6n}wWfWZ7Z{~d(*&p{YPf%-saJ4ch>Xx?woP7+(B zdxS8)z6JwG;R-OUm9;)uVOV!HWBDxvwc#;^V#|%>k00H~xyL-H-x?wKH8y7;Q|hxg zjmduXmxc2A5zp!2gZ%wVU5y{|g@&p9feB5)k8MH`Ycer@haLG&VCZGB}r$RXayk z3sUp}i^2w{Lcs&A!bACTk0~?)0^B72?gP&C)gJkwlZ3ZEV z2&vBGE0#Dkj@Ux4cT0IJ zTn|7g5586yb8R6QPGwY^QJpq_=$gSr zFW#eD*~JuZEoxFo2y?Hol58-SX! zR3KCD5e~;EQHfp)rA4L@r-70nB=6fs(ZPtz;gK^OKA4)A1y9O#%|J9&PQ?}Meye*O zD{k&3mUBvgBZk9pxi*#yPELP5GfSLme`uc^IeLF-8KkWJ@ zS2L0LI;#nKX0cmfMb8mMEz=aI;jZW)w(#5n;b9*{BE{ zA?q&%{-`93DQTG{i5iMgvBl~dDH?G}>M_ZQLyF(*3=9m-ZBjlM8l}WoTb!gR#bu^i z+8F*YGTgDW&ayJ!F)Fay+OjUUGBn)$W@T$(bZBI5XmEV+q33V=AX&bz5cq2sX8!9w zQ2zNoIKTbzur>Sll{j&|15QuY+)|NT>xuFJET-b*sYy^!;lcda@;Q}$z+l6W`}inB zfCAiesO137*NS=4sL`|(#BGok*?X7iclvJLjdx@GHD)fR`^o8ME@O+U`|(xT0<7Rf z;2ow!?_pC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SLs-H}BOEhgh-a9y zXBB)94xI(UZFWV+;hdt{@MXZq@!7{kNkz|YqO?*P_E?Lho0rk+7UAC`$$;*|hv>s% zK8P_4r&%C9j*87zw)Ca24F~ki67sSwn3@Yij){G zoBNP2m3c(KHm|pK) zGD>FxbiVQ)LnU<$*vXzSBK@#~8XITe?>?evzTNzrw8r2(EdhZG0wP23-=wwoe@R;V zAClAm_v+fe+b2lgR?VpYpSAVh!rEIm#-CT|K=4Ze$HNW+iy$EZC{jxHgArp10lR`w z5~at+XJzQA2c%|)rRW)H806)or0Atokzk-`W~42Hp(a;ZxkiN8{t(KQ0LTeCzeK^x zKZHS0Fih}2Gms$s`ownJwm(u{|9|b7N{097|GvKXpff(eUfO)=Re-8M@ z902nVYsue`|FeSu_6_ng;Odvq`wu_E-;?{@;r|BlHo0d2E!Z1~|55fok^fotTQdUP zo8^4r(&R@5eY6Xe7f>z9K1Ct3fidi^)>-!6x@gZmBsRz7BY z1D@y03i-c#!>IpPUjSKKhHOU_^;IQ7eoEt{I`om i@-LzMN#2C|^ZUTtHG=$AJqQTguQTb_Fa=3}fBHX`k@+V8 literal 0 HcmV?d00001 diff --git a/popclip/Translatium/Config.plist b/popclip/Translatium/Config.plist new file mode 100755 index 00000000..539f32a0 --- /dev/null +++ b/popclip/Translatium/Config.plist @@ -0,0 +1,40 @@ + + + + + Extension Name + Translatium + Extension Identifier + com.translatium.extension + Extension Description + Open Translatium with the selected text. + Actions + + + URL + translatium://?text={popclip text} + Image File + translatium.png + Title + Translatium + Regular Expression + (?s)^.{1,1900}$ + + + Apps + + + Bundle Identifiers + + com.moderntranslator.app + + Check Installed + + Link + https://translatiumapp.com/ + Name + Translatium + + + + \ No newline at end of file diff --git a/popclip/Translatium/translatium.png b/popclip/Translatium/translatium.png new file mode 100755 index 0000000000000000000000000000000000000000..1fecba2cc1293e047f6832a0c5a7706f751f186a GIT binary patch literal 7499 zcmeHsXH(PBxAiX}^j<_dL21&IPADM|5eou>G^ICD=?EAI5I{g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w1uXyW { createWindow(); } }); + +app.on('open-url', (e, urlStr) => { + e.preventDefault(); + + if (urlStr.startsWith('translatium://')) { + const urlObj = url.parse(urlStr, true); + const text = decodeURIComponent(urlObj.query.text || ''); + + if (mainWindow) { + mainWindow.send('set-input-lang', 'auto'); + mainWindow.send('set-input-text', text); + } + + if (mb && mb.window) { + mb.window.send('set-input-lang', 'auto'); + mb.window.send('set-input-text', text); + } + } +}); diff --git a/src/components/app.js b/src/components/app.js index 198a200a..90a53b97 100644 --- a/src/components/app.js +++ b/src/components/app.js @@ -1,3 +1,4 @@ +/* global ipcRenderer */ import React from 'react'; import PropTypes from 'prop-types'; import { replace, goBack } from 'react-router-redux'; @@ -15,8 +16,9 @@ import ToggleStar from '@material-ui/icons/Star'; import connectComponent from '../helpers/connect-component'; import { screenResize } from '../state/root/screen/actions'; -import { updateImeMode } from '../state/pages/home/actions'; +import { updateImeMode, updateInputText } from '../state/pages/home/actions'; import { closeSnackbar } from '../state/root/snackbar/actions'; +import { updateInputLang } from '../state/root/settings/actions'; import colorPairs from '../constants/colors'; @@ -74,6 +76,8 @@ class App extends React.Component { const { primaryColorId, onBackClick, + onUpdateInputText, + onUpdateInputLang, } = this.props; this.setAppTitleBar(primaryColorId); @@ -92,6 +96,16 @@ class App extends React.Component { } window.addEventListener('resize', this.props.onResize); + + if (getPlatform() === 'electron') { + ipcRenderer.on('set-input-text', (e, text) => { + onUpdateInputText(text); + }); + + ipcRenderer.on('set-input-lang', (e, value) => { + onUpdateInputLang(value); + }); + } } componentWillUpdate(nextProps) { @@ -220,6 +234,8 @@ App.propTypes = { onBottomNavigationActionClick: PropTypes.func.isRequired, onRequestCloseSnackbar: PropTypes.func.isRequired, onResize: PropTypes.func.isRequired, + onUpdateInputLang: PropTypes.func.isRequired, + onUpdateInputText: PropTypes.func.isRequired, primaryColorId: PropTypes.string, shouldShowBottomNav: PropTypes.bool.isRequired, snackbarMessage: PropTypes.string, @@ -267,6 +283,12 @@ const mapDispatchToProps = dispatch => ({ onBottomNavigationActionClick: pathname => dispatch(replace(pathname)), onBackClick: () => dispatch(goBack()), onRequestCloseSnackbar: () => dispatch(closeSnackbar()), + onUpdateInputText: (inputText) => { + dispatch(updateInputText(inputText, 0, 0)); + }, + onUpdateInputLang: (value) => { + dispatch(updateInputLang(value)); + }, }); export default connectComponent( diff --git a/src/components/pages/home/index.js b/src/components/pages/home/index.js index f66a1b27..7587d939 100644 --- a/src/components/pages/home/index.js +++ b/src/components/pages/home/index.js @@ -1,4 +1,4 @@ -/* global Windows ipcRenderer */ +/* global Windows */ import React from 'react'; import PropTypes from 'prop-types'; import { push } from 'react-router-redux'; @@ -190,7 +190,6 @@ class Home extends React.Component { onSwapButtonClick, onTogglePhrasebookClick, onWriteButtonClick, - onUpdateInputText, cameraShortcut, clearInputShortcut, @@ -204,11 +203,6 @@ class Home extends React.Component { swapLanguagesShortcut, } = this.props; - if (getPlatform() === 'electron') { - ipcRenderer.on('set-input-text', (e, text) => { - onUpdateInputText(text); - }); - } Mousetrap.bind(openInputLangListShortcut, (e) => { e.preventDefault(); @@ -793,7 +787,6 @@ Home.propTypes = { onTogglePhrasebookClick: PropTypes.func.isRequired, onTranslateButtonClick: PropTypes.func.isRequired, onWriteButtonClick: PropTypes.func.isRequired, - onUpdateInputText: PropTypes.func.isRequired, output: PropTypes.object, outputLang: PropTypes.string, preventScreenLock: PropTypes.bool, @@ -863,9 +856,6 @@ const mapDispatchToProps = dispatch => ({ dispatch(updateInputText(inputText, e.target.selectionStart, e.target.selectionEnd)); }, - onUpdateInputText: (inputText) => { - dispatch(updateInputText(inputText, 0, 0)); - }, onClearButtonClick: () => dispatch(updateInputText('')), onInsertText: text => dispatch(insertInputText(text)), onListenButtonClick: (toStop, lang, text) => { diff --git a/src/components/pages/settings/index.js b/src/components/pages/settings/index.js index dbbb49ee..2c3dd0ac 100644 --- a/src/components/pages/settings/index.js +++ b/src/components/pages/settings/index.js @@ -368,6 +368,14 @@ const Settings = (props) => { /> + {getPlatform() === 'electron' && ( + openUri('https://translatiumapp.com/popclip')} + > + + + )} diff --git a/src/strings/de.app.json b/src/strings/de.app.json index 1f1391f0..72576207 100644 --- a/src/strings/de.app.json +++ b/src/strings/de.app.json @@ -138,5 +138,7 @@ "pasteFromClipboard": "Von Zwischenablage einfügen", "translateClipboardOnShortcut": "Übersetze Zwischenablage mit Tastaturkürzel", - "translateClipboardOnShortcutDesc": "WEnn du Translatium mit einem Tastenkürzel öffnest, wird es automatisch den Inhalt deiner Zwischenablage übersetzen." + "translateClipboardOnShortcutDesc": "WEnn du Translatium mit einem Tastenkürzel öffnest, wird es automatisch den Inhalt deiner Zwischenablage übersetzen.", + + "popclipExtension": "PopClip Extension" } diff --git a/src/strings/en.app.json b/src/strings/en.app.json index 58ec635b..5b729018 100755 --- a/src/strings/en.app.json +++ b/src/strings/en.app.json @@ -138,5 +138,7 @@ "pasteFromClipboard": "Paste from Clipboard", "translateClipboardOnShortcut": "Translate clipboard on shortcut", - "translateClipboardOnShortcutDesc": "When you open Translatium with a shortcut, it will automatically translate your clipboard contents." + "translateClipboardOnShortcutDesc": "When you open Translatium with a shortcut, it will automatically translate your clipboard contents.", + + "popclipExtension": "PopClip Extension" } diff --git a/src/strings/pl.app.json b/src/strings/pl.app.json index f1ee4471..c82bb5bd 100755 --- a/src/strings/pl.app.json +++ b/src/strings/pl.app.json @@ -138,5 +138,7 @@ "pasteFromClipboard": "Wklej ze schowka", "translateClipboardOnShortcut": "Przetłumacz schowek skrótem", - "translateClipboardOnShortcutDesc": "Gdy otworzysz Translatium za pomocą skrótu, zawartość schowka zostanie automatycznie przetłumaczona." + "translateClipboardOnShortcutDesc": "Gdy otworzysz Translatium za pomocą skrótu, zawartość schowka zostanie automatycznie przetłumaczona.", + + "popclipExtension": "PopClip Extension" } diff --git a/src/strings/pt_BR.app.json b/src/strings/pt_BR.app.json index 75b63dea..6f557cc7 100644 --- a/src/strings/pt_BR.app.json +++ b/src/strings/pt_BR.app.json @@ -138,5 +138,7 @@ "pasteFromClipboard": "Colar da Área de Transferência", "translateClipboardOnShortcut": "Traduzir a área de transferência no atalho", - "translateClipboardOnShortcutDesc": "Quando você abre o Translatium com um atalho, ele irá traduzir automaticamente o conteúdo da área de transferência." + "translateClipboardOnShortcutDesc": "Quando você abre o Translatium com um atalho, ele irá traduzir automaticamente o conteúdo da área de transferência.", + + "popclipExtension": "PopClip Extension" } diff --git a/src/strings/vi.app.json b/src/strings/vi.app.json index 8d12c85f..0ba194b5 100644 --- a/src/strings/vi.app.json +++ b/src/strings/vi.app.json @@ -137,5 +137,7 @@ "pasteFromClipboard": "Dán từ Clipboard", "translateClipboardOnShortcut": "Dịch clipboard khi dùng phím tắt", - "translateClipboardOnShortcutDesc": "Khi bạn mở Translatium bằng phím tắt, phần mềm sẽ tự động dịch nội dung trong clipboard của bạn." + "translateClipboardOnShortcutDesc": "Khi bạn mở Translatium bằng phím tắt, phần mềm sẽ tự động dịch nội dung trong clipboard của bạn.", + + "popclipExtension": "PopClip Extension" } diff --git a/src/strings/zh-CN.app.json b/src/strings/zh-CN.app.json index 311364a0..3d1147bb 100644 --- a/src/strings/zh-CN.app.json +++ b/src/strings/zh-CN.app.json @@ -138,5 +138,7 @@ "pasteFromClipboard": "从剪贴板粘贴", "translateClipboardOnShortcut": "快捷翻译", - "translateClipboardOnShortcutDesc": "当您使用快捷方式打开 Translatium 时,它将自动翻译您剪贴板的内容。" + "translateClipboardOnShortcutDesc": "当您使用快捷方式打开 Translatium 时,它将自动翻译您剪贴板的内容。", + + "popclipExtension": "PopClip Extension" }