Subject: [PATCH] gnu: Add crow-translate.

From: [email-masked]
Date: Sat, 13 Aug 2022 20:18:43 +0800

From: tiantian <[email-masked]>

* gnu/packages/dictionaries.scm (crow-translate): New variable.
---
 gnu/packages/dictionaries.scm | 49 +++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/dictionaries.scm b/gnu/packages/dictionaries.scm
index f9d6e57877..d2f422dbc8 100644
--- a/gnu/packages/dictionaries.scm
+++ b/gnu/packages/dictionaries.scm
@@ -27,6 +27,7 @@
 (define-module (gnu packages dictionaries)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix gexp)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
@@ -38,16 +39,21 @@ (define-module (gnu packages dictionaries)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fribidi)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages image)
+  #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages ocr)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages compression)
@@ -431,3 +437,46 @@ (define-public sdcv
     (description "sdcv is simple text-based utility for work with dictionaries
 in StarDict's format.")
     (license license:gpl2+)))
+
+(define-public crow-translate
+  (package
+    (name "crow-translate")
+    (version "2.9.12")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/crow-translate/crow-translate")
+                    (commit version)
+                    (recursive? #t)))
+              (sha256
+               (base32
+                "0xvw81wlgymj2cvjia1xfhgdl5x9fjxzy698fc15jpk6ilfk6s9l"))
+              (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:tests? #f
+           #:phases #~(modify-phases %standard-phases
+                        (delete 'patch-dot-desktop-files)
+                        (add-after 'unpack 'patch-desktop-file
+                          (lambda _
+                            (let ((file
+                                   "data/io.crow_translate.CrowTranslate.desktop")
+                                  (exec-program #$(file-append qttools-5
+                                                               "/bin/qdbus")))
+                              (substitute* file
+                                (("Exec=qdbus")
+                                 (string-append "Exec=" exec-program)))))))))
+    (inputs (list kwayland
+                  leptonica
+                  qtbase-5
+                  qttools-5
+                  qtx11extras
+                  qtmultimedia-5
+                  tesseract-ocr))
+    (native-inputs (list doxygen extra-cmake-modules pkg-config))
+    (synopsis "Simple and lightweight translator")
+    (description "@code{Crow Translate} is a simple and lightweight translator
+written in C++/Qt that allows you to translate and speak text using Google,
+Yandex Bing, LibreTranslate and Lingva.")
+    (home-page "https://crow-translate.github.io/")
+    (license license:gpl3)))

base-commit: bf35cded1837a97be93524046e4c9cc63f3b85f5
-- 
2.37.1