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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46114 in the body.
You can then email your comments to 46114 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#46114; Package guix-patches. (Tue, 26 Jan 2021 16:57:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Julien Lepiller <julien <at> lepiller.eu>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 26 Jan 2021 16:57:01 GMT) Full text and rfc822 format available.

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

From: Julien Lepiller <julien <at> lepiller.eu>
To: guix-patches <at> gnu.org
Subject: [PATCH] website: Localize package list.
Date: Tue, 26 Jan 2021 17:56:18 +0100
[Message part 1 (text/plain, inline)]
Hi Guix!

This patch lets us localize package synopsis and description in package
lists. This is not super useful, because our guix-packages domain is
almost untranslated, for every language, but I think it's better than
nothing.

Locally, you can simply copy an existing guix-packages.mo (on the Guix
System,
/run/current-system/profile/share/locale/de/LC_MESSAGES/guix-packages.mo
for the German translation) to the local locale directory
(de/LC_MESSAGES/guix-packages.mo), in the same way we do for the
guix-website domain.

I also modified .guix.scm so the website can be generated with
localized packages. I used the latest guix package from the current
guix, because latest-guix (defined in .guix.scm) does not have any
locale information in it (mo or po). Any idea to get the latest
translations instead?
[0001-website-Update-announce-online-Guix-days.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#46114; Package guix-patches. (Tue, 26 Jan 2021 21:30:02 GMT) Full text and rfc822 format available.

Message #8 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: Tue, 26 Jan 2021 22:29:33 +0100
Hi,

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

> This patch lets us localize package synopsis and description in package
> lists. This is not super useful, because our guix-packages domain is
> almost untranslated, for every language, but I think it's better than
> nothing.

Yes, good idea.

> Locally, you can simply copy an existing guix-packages.mo (on the Guix
> System,
> /run/current-system/profile/share/locale/de/LC_MESSAGES/guix-packages.mo
> for the German translation) to the local locale directory
> (de/LC_MESSAGES/guix-packages.mo), in the same way we do for the
> guix-website domain.
>
> I also modified .guix.scm so the website can be generated with
> localized packages. I used the latest guix package from the current
> guix, because latest-guix (defined in .guix.scm) does not have any
> locale information in it (mo or po). Any idea to get the latest
> translations instead?

‘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"))

Now, you sent the wrong patch.  :-)

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#46114; Package guix-patches. (Tue, 26 Jan 2021 21:44:01 GMT) Full text and rfc822 format available.

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

From: Julien Lepiller <julien <at> lepiller.eu>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 46114 <at> debbugs.gnu.org
Subject: Re: bug#46114: [PATCH] website: Localize package list.
Date: Tue, 26 Jan 2021 22:43:06 +0100
[Message part 1 (text/plain, inline)]
Le Tue, 26 Jan 2021 22:29:33 +0100,
Ludovic Courtès <ludo <at> gnu.org> a écrit :

> Hi,
> 
> Julien Lepiller <julien <at> lepiller.eu> skribis:
> 
> > This patch lets us localize package synopsis and description in
> > package lists. This is not super useful, because our guix-packages
> > domain is almost untranslated, for every language, but I think it's
> > better than nothing.  
> 
> Yes, good idea.
> 
> > Locally, you can simply copy an existing guix-packages.mo (on the
> > Guix System,
> > /run/current-system/profile/share/locale/de/LC_MESSAGES/guix-packages.mo
> > for the German translation) to the local locale directory
> > (de/LC_MESSAGES/guix-packages.mo), in the same way we do for the
> > guix-website domain.
> >
> > I also modified .guix.scm so the website can be generated with
> > localized packages. I used the latest guix package from the current
> > guix, because latest-guix (defined in .guix.scm) does not have any
> > locale information in it (mo or po). Any idea to get the latest
> > translations instead?  
> 
> ‘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?

> 
> Now, you sent the wrong patch.  :-)

haha, indeed ^^'

> 
> Ludo’.

[0001-website-Localize-package-list.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#46114; Package guix-patches. (Wed, 27 Jan 2021 22:19:01 GMT) Full text and rfc822 format available.

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’.




Information forwarded to guix-patches <at> gnu.org:
bug#46114; Package guix-patches. (Fri, 29 Jan 2021 01:54:01 GMT) Full text and rfc822 format available.

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

From: Julien Lepiller <julien <at> lepiller.eu>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 46114 <at> debbugs.gnu.org
Subject: Re: bug#46114: [PATCH] website: Localize package list.
Date: Fri, 29 Jan 2021 02:52:54 +0100
Le Wed, 27 Jan 2021 23:18:02 +0100,
Ludovic Courtès <ludo <at> gnu.org> a écrit :
> 
> 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?

I simply copied the same template as for the po file. I think lingua
contains the specific language+territory code, whearas lang contains
only the language code. If we have a specific translation, we want to
use it, otherwise we use the generic one for the language.

> 
> 
> [...]
> 
> >  (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.  :-)

Fixed.

> 
> LGTM, thanks!
> 
> Ludo’.

Pushed as f56e35bbd34aca09b67c3623fcd9b05cc0467d6f, thank you!




Reply sent to Julien Lepiller <julien <at> lepiller.eu>:
You have taken responsibility. (Fri, 29 Jan 2021 01:54:02 GMT) Full text and rfc822 format available.

Notification sent to Julien Lepiller <julien <at> lepiller.eu>:
bug acknowledged by developer. (Fri, 29 Jan 2021 01:54:02 GMT) Full text and rfc822 format available.

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

From: Julien Lepiller <julien <at> lepiller.eu>
To: 46114-done <at> debbugs.gnu.org
Subject: Re: bug#46114: [PATCH] website: Localize package list.
Date: Fri, 29 Jan 2021 02:53:25 +0100
Forgot to close :)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 26 Feb 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 54 days ago.

Previous Next


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