[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Website translation
From: |
pelzflorian (Florian Pelz) |
Subject: |
Re: Website translation |
Date: |
Sun, 25 Aug 2019 20:58:31 +0200 |
User-agent: |
NeoMutt/20180716 |
On Thu, Aug 22, 2019 at 11:13:53PM +0200, Ludovic Courtès wrote:
> It would be great to add the right steps to website/.guix.scm (in
> guix-artwork.git).
>
Even though the attached patches allow building with .guix.scm, I
found that my previous code does not work correctly. The
deconstruction of the translation into an sexp happened at macro
expansion time before the evaluation phase when setlocale calls took
effect, so both or neither of index.en_US.html and index.de_DE.html
contained the German translation, depending on the system-wide locale
setting.
I tried to move the deconstruction to the evaluation phase by using
local-eval:
(define (sgettext x)
"After choosing an identifier for marking s-expressions for
translation, make it usable by defining a macro with it calling
sgettext. If for example the chosen identifier is G_,
use (define-syntax G_ sgettext)."
(syntax-case x ()
((_ exp)
(let ((msgstr (sexp->msgid (syntax->datum #'exp))))
#`(local-eval (pk (deconstruct (syntax->datum #'exp)
(gettext #,msgstr)))
(the-environment))))))
which almost works, except it seems (but I am unsure) the-environment
captures the wrong environment, so functions are missing. I see:
ERROR: In procedure %resolve-variable:
error: gnu-url: unbound variable
building pages in '/tmp/gnu.org/software/guix'...
;;; ((quasiquote (h2 (@ (class "a11y-offset")) "Menü des Webauftritts:")))
;;; ((quasiquote (footer "Mit " (unquote (quasiquote (span (@ (class "metta"))
"♥"))) " von Menschen gemacht und durch " (unquote (quasiquote (a (@ (class
"link-yellow") (href (unquote (gnu-url "software/guile/")))) "GNU Guile"))) "
ermöglicht. " (unquote (quasiquote (a (@ (class "link-yellow") (href
"//git.savannah.gnu.org/cgit/guix/guix-artwork.git/tree/website"))
"Quellcode"))) " unter der " (unquote (quasiquote (a (@ (class "link-yellow")
(href (unquote (gnu-url "licenses/agpl-3.0.html")))) "GNU AGPL"))) ".")))
I try to find a minimal example. I add the following to the pristine
guix-website (with only my first patch):
diff --git a/website/apps/base/templates/theme.scm
b/website/apps/base/templates/theme.scm
index ecb27ef..b993c2a 100644
--- a/website/apps/base/templates/theme.scm
+++ b/website/apps/base/templates/theme.scm
@@ -106,6 +106,9 @@
,(navbar #:active-item active-menu-item)
,(if (null? crumbs) "" (breadcrumbs crumbs))
+ ,(pk (let ()
+ (use-modules (ice-9 local-eval))
+ (local-eval '(gnu-url) (the-environment))))
,content
(footer
It crashes with
ERROR: In procedure %resolve-variable:
error: local-eval: unbound variable
I will continue investigating.
Regards,
Florian
0007-website-Make-building-with-.guix.scm-work-with-multi.patch
Description: Text document
0008-website-Have-.guix.scm-create-MO-files-for-translati.patch
Description: Text document
- Re: Website translation, pelzflorian (Florian Pelz), 2019/08/05
- Re: Website translation, pelzflorian (Florian Pelz), 2019/08/07
- Re: Website translation, Ludovic Courtès, 2019/08/22
- Re: Website translation, pelzflorian (Florian Pelz), 2019/08/23
- Re: Website translation, Ludovic Courtès, 2019/08/23
- Re: Website translation, pelzflorian (Florian Pelz), 2019/08/23
- Re: Website translation, Jelle Licht, 2019/08/23
- Re: Website translation, pelzflorian (Florian Pelz), 2019/08/23
- Re: Website translation,
pelzflorian (Florian Pelz) <=
- Re: Website translation, pelzflorian (Florian Pelz), 2019/08/25