From: "Ludovic Courtès" <ludo@gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
Cc: 26302@debbugs.gnu.org
Subject: bug#26302: [website] translations
Date: Thu, 19 Sep 2019 13:50:10 +0200 [thread overview]
Message-ID: <87muf033pp.fsf@gnu.org> (raw)
In-Reply-To: <20190919074829.hu3c7yy3bmeudfsw@florianbeaglebone.fritz.box> (pelzflorian@pelzflorian.de's message of "Thu, 19 Sep 2019 07:48:29 +0000")
Hi,
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:
>> > +(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.
>
> As per the above docstring, I already have a definition
>
> (define-syntax G_ sgettext)
>
> in (apps i18n). Possibly I should just move it here.
Hmmm right. It works, but it’s surprising and “borderline”.
If all you want is an alias, I’d recommend writing, say:
(define-syntax sgettext …)
(define-syntax G_
(identifier-syntax sgettext))
>> (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?
>>
>
> I do not understand. sexp->msgid and deconstruct are procedures, not
> syntax transformers. I can add eval-when, but the current code runs
> as expected for me.
I tried to explain above but you can check the Guile manual on
‘eval-when’ (info "(guile) Eval When"). The example there hopefully
clarifies what the problem is.
>> > +(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…?
>>
>
> Yes, in all languages for which a plural= formula is documented in the
> gettext manual.
>
> For example, Arabic has
>
> Plural-Forms: nplurals=6; \
> plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 \
> : n%100>=11 ? 4 : 5;
>
> with input plural numbers 0, 1, 2, 3, 11, 100 mapping to all outputs
> 0, 1, 2, 3, 4, 5.
>
> Maybe I should add this example to the code comment.
Oh I see. Maybe just link to the relevant section of the manual ("info
(gettext) Plural forms").
I think you can go ahead and push this series to a branch, say
‘wip-i18n’ (the ‘wip-’ prefix meaning that you reserve the right to
rebase the branch as you will.)
We can then maybe set up a ‘static-web-site’ service on berlin, with
appropriate nginx rules, to build and publish the manual at a separate
URL so we can all test it. See hydra/berlin.scm in maintenance.git.
Thoughts?
Thank you!
Ludo’.
next prev parent reply other threads:[~2019-09-19 11:51 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 15:40 bug#26302: [website] translations ng0
2017-03-29 16:13 ` ng0
2017-04-15 12:00 ` ng0
2017-04-15 12:26 ` ng0
2017-07-31 21:11 ` Ludovic Courtès
2017-07-31 21:54 ` ng0
2019-09-06 14:25 ` pelzflorian (Florian Pelz)
2019-09-06 14:42 ` pelzflorian (Florian Pelz)
2019-09-08 19:44 ` Ludovic Courtès
2019-09-08 20:46 ` pelzflorian (Florian Pelz)
2019-09-18 13:57 ` Ludovic Courtès
2019-09-19 7:48 ` pelzflorian (Florian Pelz)
2019-09-19 11:42 ` bug#26302: Adding Florian as a committer Ludovic Courtès
2019-09-19 11:50 ` Ludovic Courtès [this message]
2019-09-19 22:08 ` bug#26302: [website] translations pelzflorian (Florian Pelz)
2019-10-22 12:10 ` Ludovic Courtès
2019-10-22 12:28 ` pelzflorian (Florian Pelz)
2019-10-22 12:41 ` pelzflorian (Florian Pelz)
2019-10-23 14:16 ` Ludovic Courtès
2019-10-23 14:41 ` pelzflorian (Florian Pelz)
2019-10-22 13:01 ` pelzflorian (Florian Pelz)
2019-10-31 20:19 ` pelzflorian (Florian Pelz)
2019-11-01 14:58 ` Ludovic Courtès
2019-09-06 18:17 ` sirgazil via Bug reports for GNU Guix
2019-09-08 17:16 ` pelzflorian (Florian Pelz)
2019-09-10 0:49 ` sirgazil via Bug reports for GNU Guix
2019-09-15 20:18 ` pelzflorian (Florian Pelz)
2019-09-18 13:00 ` pelzflorian (Florian Pelz)
2019-10-07 8:15 ` pelzflorian (Florian Pelz)
2019-10-08 9:37 ` pelzflorian (Florian Pelz)
2019-11-08 9:02 ` pelzflorian (Florian Pelz)
2019-11-08 14:01 ` sirgazil via Bug reports for GNU Guix
2019-11-08 16:18 ` pelzflorian (Florian Pelz)
2019-11-08 16:20 ` pelzflorian (Florian Pelz)
2019-11-08 17:13 ` pelzflorian (Florian Pelz)
2019-11-08 18:39 ` sirgazil via Bug reports for GNU Guix
2019-11-17 16:17 ` pelzflorian (Florian Pelz)
2019-12-02 8:57 ` pelzflorian (Florian Pelz)
2020-03-25 17:33 ` bug#26302: Deploying the i18n’d web site Ludovic Courtès
2020-03-25 23:21 ` pelzflorian (Florian Pelz)
2020-03-26 1:24 ` pelzflorian (Florian Pelz)
2020-04-07 21:18 ` Ludovic Courtès
2020-04-07 22:02 ` pelzflorian (Florian Pelz)
2020-04-09 3:21 ` pelzflorian (Florian Pelz)
2020-04-09 7:45 ` pelzflorian (Florian Pelz)
2020-04-09 14:57 ` pelzflorian (Florian Pelz)
2020-04-09 15:27 ` Ludovic Courtès
2020-04-09 17:31 ` pelzflorian (Florian Pelz)
2020-04-09 18:58 ` Bengt Richter
2020-04-09 19:17 ` pelzflorian (Florian Pelz)
2020-07-01 20:11 ` Christopher Baines
2020-07-05 9:08 ` pelzflorian (Florian Pelz)
2020-07-09 13:09 ` Ludovic Courtès
2020-07-09 14:48 ` pelzflorian (Florian Pelz)
2020-07-10 17:28 ` pelzflorian (Florian Pelz)
2020-07-12 6:26 ` pelzflorian (Florian Pelz)
2020-07-26 17:46 ` bug#26302: Multilingual web site is on-line! Ludovic Courtès
2020-07-26 18:57 ` pelzflorian (Florian Pelz)
2020-07-27 16:01 ` pelzflorian (Florian Pelz)
2020-07-28 21:50 ` Ludovic Courtès
2020-07-29 1:21 ` Julien Lepiller
2020-07-29 13:56 ` pelzflorian (Florian Pelz)
2020-08-03 14:53 ` Ludovic Courtès
2020-08-21 0:14 ` pelzflorian (Florian Pelz)
2020-08-21 0:41 ` Julien Lepiller
2020-08-21 7:51 ` pelzflorian (Florian Pelz)
2020-07-29 19:21 ` pelzflorian (Florian Pelz)
2020-07-31 14:45 ` Ludovic Courtès
2020-08-04 15:37 ` pelzflorian (Florian Pelz)
2020-08-23 15:55 ` Ludovic Courtès
2020-08-24 12:47 ` pelzflorian (Florian Pelz)
2020-08-24 14:05 ` Ludovic Courtès
2020-07-27 1:54 ` Dmitry Alexandrov
2020-07-27 11:28 ` pelzflorian (Florian Pelz)
2020-07-27 20:20 ` pelzflorian (Florian Pelz)
2020-07-09 16:56 ` bug#26302: Deploying the i18n’d web site Christopher Baines
2020-07-10 17:31 ` pelzflorian (Florian Pelz)
2020-07-13 13:22 ` Ludovic Courtès
2020-07-13 14:48 ` pelzflorian (Florian Pelz)
2020-07-13 16:32 ` pelzflorian (Florian Pelz)
2019-11-01 14:54 ` bug#26302: [website] translations Ludovic Courtès
2019-11-02 13:15 ` pelzflorian (Florian Pelz)
2019-11-04 17:19 ` Ludovic Courtès
2019-11-05 7:31 ` pelzflorian (Florian Pelz)
2019-11-05 11:11 ` pelzflorian (Florian Pelz)
2019-11-06 14:56 ` Ludovic Courtès
2019-11-06 18:30 ` pelzflorian (Florian Pelz)
2019-11-07 20:24 ` Ludovic Courtès
2019-11-06 14:49 ` Ludovic Courtès
2019-11-06 18:21 ` pelzflorian (Florian Pelz)
2020-07-26 17:52 ` Vagrant Cascadian
2020-07-27 11:20 ` pelzflorian (Florian Pelz)
2020-07-28 9:44 ` bug#26302: Fwd: website translation English (US)? pelzflorian (Florian Pelz)
2020-07-28 10:03 ` zimoun
2020-07-28 16:02 ` pelzflorian (Florian Pelz)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87muf033pp.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=26302@debbugs.gnu.org \
--cc=pelzflorian@pelzflorian.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).