[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#46114] [PATCH] website: Localize package list.
From: |
Ludovic Courtès |
Subject: |
[bug#46114] [PATCH] website: Localize package list. |
Date: |
Wed, 27 Jan 2021 23:18:02 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hi,
Julien Lepiller <julien@lepiller.eu> skribis:
> Le Tue, 26 Jan 2021 22:29:33 +0100,
> Ludovic Courtès <ludo@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@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’.