From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#26302: [website] translations Date: Wed, 18 Sep 2019 15:57:47 +0200 Message-ID: <87ef0daeqs.fsf@gnu.org> References: <20170329154040.ddscahwp2agknihb@abyayala> <8760e8l3bd.fsf@gnu.org> <20170731215448.6zsu2qcfykuzbcd2@abyayala> <20190906142548.4crfjgvxilgalgrs@pelzflorian.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:36529) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAaTF-00043c-Dc for bug-guix@gnu.org; Wed, 18 Sep 2019 09:58:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAaTB-0003Xf-JV for bug-guix@gnu.org; Wed, 18 Sep 2019 09:58:13 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45846) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iAaT4-0003Sh-Gl for bug-guix@gnu.org; Wed, 18 Sep 2019 09:58:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iAaT4-0002Sr-FU for bug-guix@gnu.org; Wed, 18 Sep 2019 09:58:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20190906142548.4crfjgvxilgalgrs@pelzflorian.localdomain> (pelzflorian@pelzflorian.de's message of "Fri, 6 Sep 2019 16:25:48 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: "pelzflorian (Florian Pelz)" Cc: GNU Guix maintainers , 26302@debbugs.gnu.org Hi Florian, Could you create an account on Savannah so we can give you commit access? That=E2=80=99d 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=E2=80=99ve created an account, please make sure to add the OpenPGP= key you=E2=80=99ll use to sign commits on Savannah and on key servers, and repl= y to this message signed with that key. "pelzflorian (Florian Pelz)" skribis: > I am not entirely certain in my use of macros, but believe it is > right. See my discussion with Mark H Weaver at > . 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 =E2=80=98define-syntax=E2=80= =99, not =E2=80=98define=E2=80=99, so that they are defined at expansion time, not a= t run time. (It doesn=E2=80=99t make any difference when you=E2=80=99re 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 =E2=80=98sexp->msgid=E2=80=99 and =E2=80= =98deconstruct=E2=80=99 to be available at expansion time too. This can be done by wrapping their definition in =E2=80=98eval-when=E2=80=99: (eval-when (load expand eval) (define (sexp->msgid =E2=80=A6) =E2=80=A6) (define (deconstruct =E2=80=A6) =E2=80=A6)) But actually it=E2=80=99s not clear to me why these are macros. I think th= ey could be regular procedures and it=E2=80=99d work just fine, no? > +(define %plural-numbers > + ;; Hard-coded list of input numbers such that for each language=E2=80= =99s > + ;; 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=E2=80=99t understand this: are these the only plural numbers in all languages, or=E2=80=A6? Thanks! Ludo=E2=80=99.