bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26302: [website] translations


From: Ludovic Courtès
Subject: bug#26302: [website] translations
Date: Wed, 18 Sep 2019 15:57:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi Florian,

Could you create an account on Savannah so we can give you commit
access?

That’d allow you for you to push these patches first in a branch so we
can test, and it should make it easier for you.

Once you’ve created an account, please make sure to add the OpenPGP key
you’ll use to sign commits on Savannah and on key servers, and reply to
this message signed with that key.

"pelzflorian (Florian Pelz)" <address@hidden> skribis:

> I am not entirely certain in my use of macros, but believe it is
> right.  See my discussion with Mark H Weaver at
> <https://lists.gnu.org/archive/html/guile-user/2019-09/msg00008.html>.

I have a couple of comments on this specific issue below.

> +;; NOTE: The sgettext macros have no hygiene because they use
> +;; datum->syntax and do not preserve the semantics of anything looking
> +;; like an sgettext macro.  This is an exceptional use case; do not
> +;; try this at home.

:-)

> +(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 ()
> +    ((id exp)
> +     (let* ((msgid (sexp->msgid (syntax->datum #'exp)))
> +            (new-exp (deconstruct (syntax->datum #'exp)
> +                                  (gettext msgid))))
> +       (datum->syntax #'id new-exp)))))

For this and other similar macros you must use ‘define-syntax’, not
‘define’, so that they are defined at expansion time, not at run time.
(It doesn’t make any difference when you’re evaluating code since both
phases run in the same module, but it does make a difference when these
phases happen at different times, in different processes.)

Consequently, you must arrange for ‘sexp->msgid’ and ‘deconstruct’ to be
available at expansion time too.  This can be done by wrapping their
definition in ‘eval-when’:

  (eval-when (load expand eval)
    (define (sexp->msgid …) …)
    (define (deconstruct …) …))

But actually it’s not clear to me why these are macros.  I think they
could be regular procedures and it’d work just fine, no?

> +(define %plural-numbers
> +  ;; Hard-coded list of input numbers such that for each language’s
> +  ;; plural formula, for each possible output grammatical number,
> +  ;; there is an n among %plural-numbers that yields this output
> +  ;; (cf. section Plural forms in the gettext manual), except 1 is
> +  ;; omitted from this list because it is a special case for
> +  ;; sngettext.  That is, calling ngettext with each number from
> +  ;; %plural-numbers and with 1 in any locale is guaranteed to return
> +  ;; each plural form at least once.  It would be more resilient
> +  ;; towards new languages if instead of hard-coding we computed this
> +  ;; from the Plural-Forms in the MO file header entry, but that is
> +  ;; not worth the incurred code complexity.
> +  '(0 2 3 11 100))

I don’t understand this: are these the only plural numbers in all
languages, or…?

Thanks!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]