Adding DeepL translator to kate-script
Dr.-Ing. Christoph Cullmann
cullmann at absint.com
Sun Aug 19 12:49:36 BST 2018
Hi,
> Hi,
>
> I am trying to integrate the DeepL translator into kate tools menu through a
> script command. https://github.com/vsetka/deepl-translator has made DeepL
> available as a command line utility and also in javascript (see example.js
> provided there).
>
> I am not proficient at all in javascript and have trouble to use the require()
> function in order to be able to call the translation functions of deepl.
> I pushed my work on https://github.com/b606/katescript-deepL but it is not
> already functional.
>
> So far my script is installed in ~/.local/share/katepart5/script/commands/
> The command "Translate Selected Text" appears in the menu and a fake
> translation function correctly modify the text in place.
>
> Then I tried various things in order to get deepl functions (all resulting in
> SyntaxError: ParseError at the require() directive line 41):
>
> - symbolic link of the whole vsetka folder in ~/.local/share/katepart5/script/
> commands/ or in ~/.local/share/katepart5/script/libraries/ and trying
> require(deepl-translator/index.js) or require(deepl-translator/src/deepl-
> translator.js)
> - symbolic links to the individual files of vsetka in the same folders
>
> After reading many things about require(), I concluded that I need a kate-
> script guru to solve this, if it is ever possible to do :-)
require() actually should load any .js file relative to
~/.local/share/katepart5/script/libraries/
Not sure how conform the QJSEngine is in regards to all the needs of the scripts
that the deepl stuff needs.
Greetings
Christoph
>
> Best regards
>
> -----
> system: debian stretch with stretch-backports activated
> apt-cache policy nodejs kate katepart
> nodejs:
> Installé : 8.11.1~dfsg-2~bpo9+1
> *** 8.11.1~dfsg-2~bpo9+1 100
> 100 http://deb.debian.org/debian stretch-backports/main amd64 Packages
> kate:
> Installé : 4:16.08.3-1
> *** 4:16.08.3-1 500
> 500 http://deb.debian.org/debian stable/main amd64 Packages
> katepart:
> Installé : 4:4.14.3-4
> *** 4:4.14.3-4 500
> 500 http://deb.debian.org/debian stable/main amd64 Packages
--
----------------------------- Dr.-Ing. Christoph Cullmann ---------
AbsInt Angewandte Informatik GmbH Email: cullmann at AbsInt.com
Science Park 1 Tel: +49-681-38360-22
66123 Saarbrücken Fax: +49-681-38360-20
GERMANY WWW: http://www.AbsInt.com
--------------------------------------------------------------------
Geschäftsführung: Dr.-Ing. Christian Ferdinand
Eingetragen im Handelsregister des Amtsgerichts Saarbrücken, HRB 11234
More information about the KWrite-Devel
mailing list