[PATCH] website: Localize package list.

  • Done
  • quality assurance status badge
Details
2 participants
  • Julien Lepiller
  • Ludovic Courtès
Owner
unassigned
Submitted by
Julien Lepiller
Severity
normal
J
J
Julien Lepiller wrote on 26 Jan 2021 17:56
(address . guix-patches@gnu.org)
20210126175618.252a04e8@tachikoma.lepiller.eu
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?
From 87a0bb44fb28ff3a7e2237b2b559c1edbcbc6913 Mon Sep 17 00:00:00 2001
From: zimoun <zimon.toutoune@gmail.com>
Date: Tue, 3 Nov 2020 10:05:50 +0100
Subject: [PATCH] website: Update announce online Guix days.

* website/posts/online-guix-day-announce-1.md: Fix email, update the deadline.
---
website/posts/online-guix-day-announce-1.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (27 lines)
diff --git a/website/posts/online-guix-day-announce-1.md b/website/posts/online-guix-day-announce-1.md
index 686c01b..b4ca308 100644
--- a/website/posts/online-guix-day-announce-1.md
+++ b/website/posts/online-guix-day-announce-1.md
@@ -11,7 +11,7 @@ and will be held entirely online. Want to speak? Submit your proposal!
Important dates:
-1. **November 6th**: Deadline for talks proposal.
+1. **November 10th**: Deadline for talks proposal.
1. **November 14th**: Deadline for releasing your pre-recorded talks.
1. **November 16th**: Release of the schedule.
1. **November 22nd**: Conference day!
@@ -27,9 +27,9 @@ The agenda of the day is:
*There will be no presentation on the 22nd!* And **no registration fee**.
-##### Until November 6th: talks proposal
+##### Until November 10th: talks proposal
-Propose your talks by sending them to `guix-devel@gnu.org`. Feel free to drop
+Propose your talks by sending them to `guix-days@gnu.org`. Feel free to drop
in `#guix` on irc.freenode.net to discuss what you would like to talk about
before submitting. :)
--
2.28.0
L
L
Ludovic Courtès wrote on 26 Jan 2021 22:29
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46114@debbugs.gnu.org)
87bldbxu82.fsf@gnu.org
Hi,

Julien Lepiller <julien@lepiller.eu> skribis:

Toggle quote (5 lines)
> 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.

Toggle quote (13 lines)
> 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’.
J
J
Julien Lepiller wrote on 26 Jan 2021 22:43
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 46114@debbugs.gnu.org)
20210126224306.08ebfa99@tachikoma.lepiller.eu
Le Tue, 26 Jan 2021 22:29:33 +0100,
Ludovic Courtès <ludo@gnu.org> a écrit :

Toggle quote (34 lines)
> Hi,
>
> Julien Lepiller <julien@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?

Toggle quote (3 lines)
>
> Now, you sent the wrong patch. :-)

haha, indeed ^^'

Toggle quote (2 lines)
>
> Ludo’.
L
L
Ludovic Courtès wrote on 27 Jan 2021 23:18
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 46114@debbugs.gnu.org)
87tur2t46d.fsf@gnu.org
Hi,

Julien Lepiller <julien@lepiller.eu> skribis:

Toggle quote (3 lines)
> Le Tue, 26 Jan 2021 22:29:33 +0100,
> Ludovic Courtès <ludo@gnu.org> a écrit :

[...]

Toggle quote (13 lines)
>> ‘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.

Toggle quote (13 lines)
> From ee20fd1a63914b9f3d13afb061b2192d65a26ee7 Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@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.

[...]

Toggle quote (25 lines)
> + (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?


[...]

Toggle quote (6 lines)
> (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’.
J
J
Julien Lepiller wrote on 29 Jan 2021 02:52
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 46114@debbugs.gnu.org)
20210129025254.041f18be@tachikoma.lepiller.eu
Le Wed, 27 Jan 2021 23:18:02 +0100,
Ludovic Courtès <ludo@gnu.org> a écrit :
Toggle quote (8 lines)
>
> 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.

Toggle quote (12 lines)
>
>
> [...]
>
> > (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.

Toggle quote (5 lines)
>
> LGTM, thanks!
>
> Ludo’.

Pushed as f56e35bbd34aca09b67c3623fcd9b05cc0467d6f, thank you!
J
J
Julien Lepiller wrote on 29 Jan 2021 02:53
(address . 46114-done@debbugs.gnu.org)
20210129025325.2c88f454@tachikoma.lepiller.eu
Forgot to close :)
Closed
?