Subject: [bug#75063] [PATCH 1/2] gnu: dict: Add symbols to help users configure FreeDict with dicod.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 25 Dec 2024 22:23:48 +0100

Hi,

Nice!  I recently added FreeDict dictionaries to my own config and was
contemplating the idea of having it properly integrated.  Perfect.  :-)

FWIW, I have:

--8<---------------cut here---------------start------------->8---
(define %freedict-databases
  (map (lambda (dictionary-name)
         (dicod-database
          (name "freedict")
          (handler "dictorg")
          (options
           (list #~(string-append "database="
                                  #$freedict-dictionaries
                                  "/share/dictd/" #$dictionary-name)))))
       '("fra-eng" "eng-fra" "eng-spa" "spa-eng")))
--8<---------------cut here---------------end--------------->8---

and then:

--8<---------------cut here---------------start------------->8---
     (service dicod-service-type
              (dicod-configuration
               (databases (cons %dicod-database:gcide
                                %freedict-databases))))
--8<---------------cut here---------------end--------------->8---

Runciter <[email-masked]> skribis:

> * gnu/services/dict.scm: (%dictorg-handler): New variable;
> (freedict-dictorg-database): new procedure;
> (%freedict-dictorg-databases): new variable.
>
> Signed-off-by: Runciter <[email-masked]>

[...]

> +(define %dictorg-handler
> +  (dicod-handler (name "dictorg")
> +                 (module "dictorg")
> +                 (options (list #~(string-append "dbdir=/")))))

I believe we don’t even need that; it’s built-in.

> +(define (freedict-dictorg-database dict-name)
> +  "Return a record of type @code{<dicod-database>} that configures a
> +database for the freedict multilingual dictionary named by the string
> +DICT-NAME."
> +  (dicod-database (name (string-append "freedict-"
> +                                       dict-name))
> +                  (complex? #t)

What does ‘complex?’ do actually?  (Seems to work without it.)

> * doc/guix.texi: (Dictionary Service): Update configuration example.

Could you squash both commits?  In general documentation goes to the
same commit as the change it documents.

> diff --git a/doc/guix.texi b/doc/guix.texi
> index 08ffbc36d7..1a394b91b2 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -41158,13 +41158,15 @@ Miscellaneous Services
>                        (name "wordnet")
>                        (module "wordnet")
>                        (options
> -                       (list #~(string-append "wnhome=" #$wordnet))))))
> -          (databases (list
> +                       (list #~(string-append "wnhome=" #$wordnet))))
> +                       %dictorg-handler))
> +          (databases (cons*
>                        (dicod-database
>                         (name "wordnet")
>                         (complex? #t)
>                         (handler "wordnet"))
> -                      %dicod-database:gcide))))
> +                      %dicod-database:gcide
> +                      %freedict-dictorg-databases))))

Could you also document ‘freedict-dictorg-databases’ and
‘%freedict-dictorg-databases’, similar to how ‘%dicod-database:gcide’ is
documented?

For consistency, perhaps the these should be renamed to
‘dicod-freedict-databases’ and ‘%dicod-database:freedict’.

Thanks in advance,
Ludo’.