GNU bug report logs - #46114
[PATCH] website: Localize package list.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Tue, 26 Jan 2021 16:57:01 UTC

Severity: normal

Tags: patch

Done: Julien Lepiller <julien <at> lepiller.eu>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 46114 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 46114 <at> debbugs.gnu.org
Subject: Re: bug#46114: [PATCH] website: Localize package list.
Date: Wed, 27 Jan 2021 23:18:02 +0100
Hi,

Julien Lepiller <julien <at> lepiller.eu> skribis:

> Le Tue, 26 Jan 2021 22:29:33 +0100,
> Ludovic Courtès <ludo <at> gnu.org> a écrit :

[...]

>> ‘latest-guix’ is the same as what you get with ‘guix pull’, so it
>> knows where to find its .gmo files—see this bit in (guix self):
>> 
>>                 (bindtextdomain "guix"
>>                                 #$(locale-data source "guix"))
>>                 (bindtextdomain "guix-packages"
>>                                 #$(locale-data source
>>                                                "guix-packages"
>>                                                "packages"))
>
> yeah, but that's not very helpful. I don't understand how to get them
> from guix-latest?

Oh you need the .mo files so you can ‘bindtextdomain’ hmmm…

It would be easier if the web site used the inferior API; you would
delegate translation to the inferior and that’s it.

> From ee20fd1a63914b9f3d13afb061b2192d65a26ee7 Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien <at> lepiller.eu>
> Date: Tue, 26 Jan 2021 17:48:47 +0100
> Subject: [PATCH] website: Localize package list.
>
> * .guix.scm: Copy guix-packages gettext domain locally.
> * apps/i18n.scm: Bind the guix-packages gettext domain.
> * apps/packages/templates/components.scm (package-preview): Localize
> package description.
> * apps/packages/utils.scm (package-description-shtml, package-synopsis-shtml):
> Localize package synopsis and description.
> * i18n-howto.txt: Document package list localization.

[...]

> +                    (packages-lingua-mo (string-append
> +                                          #$guix "/share/locale/" lingua
> +                                          "/LC_MESSAGES/guix-packages.mo"))
> +                    (packages-lang-mo (string-append
> +                                        #$guix "/share/locale/" lang
> +                                        "/LC_MESSAGES/guix-packages.mo")))
>                 (define (create-mo filename)
>                   (begin
>                     (invoke msgfmt filename)
> @@ -158,7 +165,17 @@
>                   (create-mo lingua-file))
>                  ((file-exists? lang-file)
>                   (create-mo lang-file))
> -                (else #t))))
> +                (else #t))
> +               (cond
> +                 ((file-exists? packages-lingua-mo)
> +                  (copy-file packages-lingua-mo
> +                             (string-append lingua "/LC_MESSAGES/"
> +                                            "guix-packages.mo")))
> +                 ((file-exists? packages-lang-mo)
> +                  (copy-file packages-lang-mo
> +                             (string-append lingua "/LC_MESSAGES/"
> +                                            "guix-packages.mo")))

So we copy them for the sake of ‘bindtextdomain’, right?

In practice those .mo files should be the same as what you’d get via
‘latest-guix’ so that’s probably fine.

Why “lingua” and “lang” BTW?


[...]

>  (define (package-description-shtml package)
>    "Return a SXML representation of PACKAGE description field with HTML
>  vocabulary."
> -  (and=> (package-description package) texinfo->shtml))
> +  ;(setenv "LC_ALL" (getenv "LANG"))

Leftover.  :-)

LGTM, thanks!

Ludo’.




This bug report was last modified 4 years and 113 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.