all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Runciter via Guix-patches via <guix-patches@gnu.org>
To: 75063@debbugs.gnu.org
Cc: Runciter <runciter@whispers-vpn.org>
Subject: [bug#75063] [PATCH v2] gnu: dict: Add symbols to help users configure FreeDict with dicod.
Date: Wed, 01 Jan 2025 19:23:25 +0000	[thread overview]
Message-ID: <eb6b4319e4a25c06bb48968d9f11779046ab0e52.1735759383.git.runciter@whispers-vpn.org> (raw)
In-Reply-To: <cover.1735043982.git.runciter@whispers-vpn.org>

* gnu/services/dict.scm: (%dicod-database:freedict): New procedure;
(dicod-freedict-databases): new variable.
* doc/guix.texi: (Dictionary Service): Document them.

Signed-off-by: Runciter <runciter@whispers-vpn.org>
---
 doc/guix.texi         |  25 +++++++++--
 gnu/services/dict.scm | 100 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 121 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 08ffbc36d7..30ca842ea5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41148,7 +41148,23 @@ Miscellaneous Services
 Dictionary of English using the @code{gcide} package.
 @end defvar
 
-The following is an example @code{dicod-service-type} configuration.
+@deffn {Procedure} %dicod-database:freedict dictionary-name
+"Returns a record of type @code{dicod-database} for purpose of configuring a
+database for the FreeDict multilingual dictionary named by the string
+@var{dictionary-name} into a service of type @code{dicod-service-type}."
+@end deffn
+
+@defvar dicod-freedict-databases
+A relatively large list of records of type @code{dicod-database}, made
+available for users who wish to configure all the FreeDict multilingual
+dictionaries provided by the @code{freedict-dictionaries} package into a
+service of type @code{dicod-service-type}.
+@end defvar
+
+The following is an example @code{dicod-service-type} configuration,
+extending a @command{dicod} daemon serving databases for the wordnet and
+gcide dictionaries, as well as a selection of FreeDict multilingual
+dictionaries.
 
 @lisp
 (service dicod-service-type
@@ -41159,12 +41175,15 @@ Miscellaneous Services
                       (module "wordnet")
                       (options
                        (list #~(string-append "wnhome=" #$wordnet))))))
-          (databases (list
+          (databases (cons*
                       (dicod-database
                        (name "wordnet")
                        (complex? #t)
                        (handler "wordnet"))
-                      %dicod-database:gcide))))
+                      %dicod-database:gcide
+                      (map
+                       %dicod-database:freedict
+                       '("fra-eng" "eng-fra" "eng-spa" "spa-eng"))))))
 @end lisp
 
 @cindex Docker
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index a4e25f5302..69028ab5d3 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2016, 2017, 2018, 2020, 2022, 2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
+;;; Copyright © 2024 Runciter <runciter@whispers-vpn.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,7 +41,9 @@ (define-module (gnu services dict)
             dicod-configuration
             dicod-handler
             dicod-database
-            %dicod-database:gcide))
+            %dicod-database:gcide
+            %dicod-database:freedict
+            dicod-freedict-databases))
 
 \f
 ;;;
@@ -94,6 +97,101 @@ (define %dicod-database:gcide
    (options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
                   #~(string-append "idxdir=" #$%dicod-gcide-index)))))
 
+(define (%dicod-database:freedict dictionary-name)
+  "Returns a record of type @code{dicod-database} for purpose of configuring a
+database for the FreeDict multilingual dictionary named by the string
+@var{dictionary-name} into a service of type @code{dicod-service-type}."
+  (dicod-database (name (string-append "freedict-"
+                                       dictionary-name))
+                  (handler "dictorg")
+                  (options (list #~(string-append "database="
+                                                  #$freedict-dictionaries
+                                                  "/share/dictd/"
+                                                  #$dictionary-name)))))
+
+(define dicod-freedict-databases
+  (map %dicod-database:freedict (list "afr-deu"
+                                      "afr-eng"
+                                      "ara-eng"
+                                      "bre-fra"
+                                      "ces-eng"
+                                      "ckb-kmr"
+                                      "cym-eng"
+                                      "dan-eng"
+                                      "deu-ita"
+                                      "deu-kur"
+                                      "deu-nld"
+                                      "deu-por"
+                                      "deu-tur"
+                                      "eng-afr"
+                                      "eng-ara"
+                                      "eng-ces"
+                                      "eng-cym"
+                                      "eng-dan"
+                                      "eng-ell"
+                                      "eng-fra"
+                                      "eng-gle"
+                                      "eng-hin"
+                                      "eng-hrv"
+                                      "eng-hun"
+                                      "eng-ita"
+                                      "eng-lat"
+                                      "eng-lit"
+                                      "eng-nld"
+                                      "eng-pol"
+                                      "eng-por"
+                                      "eng-rom"
+                                      "eng-rus"
+                                      "eng-spa"
+                                      "eng-srp"
+                                      "eng-swh"
+                                      "eng-tur"
+                                      "fra-bre"
+                                      "fra-eng"
+                                      "fra-nld"
+                                      "gla-deu"
+                                      "gle-eng"
+                                      "gle-pol"
+                                      "hrv-eng"
+                                      "hun-eng"
+                                      "isl-eng"
+                                      "ita-deu"
+                                      "ita-eng"
+                                      "jpn-deu"
+                                      "jpn-eng"
+                                      "jpn-fra"
+                                      "jpn-rus"
+                                      "kha-deu"
+                                      "kha-eng"
+                                      "kur-deu"
+                                      "kur-eng"
+                                      "kur-tur"
+                                      "lat-deu"
+                                      "lat-eng"
+                                      "lit-eng"
+                                      "mkd-bul"
+                                      "nld-deu"
+                                      "nld-eng"
+                                      "nld-fra"
+                                      "nno-nob"
+                                      "oci-cat"
+                                      "pol-gle"
+                                      "por-deu"
+                                      "por-eng"
+                                      "san-deu"
+                                      "slk-eng"
+                                      "slv-eng"
+                                      "spa-ast"
+                                      "spa-eng"
+                                      "spa-por"
+                                      "srp-eng"
+                                      "swe-eng"
+                                      "swh-eng"
+                                      "swh-pol"
+                                      "tur-deu"
+                                      "tur-eng"
+                                      "wol-fra")))
+
 (define %dicod-accounts
   (list (user-group
          (name "dicod")

base-commit: 9dc91360fd2e41fb783ab4af341ac60aee2f5d31
-- 
2.47.1






      parent reply	other threads:[~2025-01-01 19:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-24 12:47 [bug#75063] [PATCH 0/2] Easy configuration of FreeDict into dicod-service-type Runciter via Guix-patches via
2024-12-24 13:00 ` [bug#75063] [PATCH 1/2] gnu: dict: Add symbols to help users configure FreeDict with dicod Runciter via Guix-patches via
2024-12-25 21:23   ` Ludovic Courtès
2024-12-24 13:00 ` [bug#75063] [PATCH 2/2] doc: add FreeDict dictionaries to dicod configuration example Runciter via Guix-patches via
2024-12-26 16:22 ` [bug#75063] [PATCH 1/2] gnu: dict: Add symbols to help users configure FreeDict with dicod Runciter via Guix-patches via
2024-12-29 18:35 ` Runciter via Guix-patches via
2025-01-01 19:23 ` Runciter via Guix-patches via [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb6b4319e4a25c06bb48968d9f11779046ab0e52.1735759383.git.runciter@whispers-vpn.org \
    --to=guix-patches@gnu.org \
    --cc=75063@debbugs.gnu.org \
    --cc=runciter@whispers-vpn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.