unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: Julien Lepiller <julien@lepiller.eu>
Cc: guix-devel@gnu.org, Zhu Zihao <all_but_last@163.com>
Subject: Re: Word order in Guix l10n
Date: Wed, 23 Dec 2020 13:22:53 +0100	[thread overview]
Message-ID: <87czz0yan6.fsf@gmail.com> (raw)
In-Reply-To: <BCF4769B-B946-4E0F-AE1D-F61531908B27@lepiller.eu> (Julien Lepiller's message of "Tue, 22 Dec 2020 10:06:29 -0500")

[-- Attachment #1: Type: text/plain, Size: 3169 bytes --]

Hi Julien,

Julien Lepiller <julien@lepiller.eu> writes:

> This specific syntax looks ok, but we need to limit ourself to the
> common syntax between guile and lisp, because that's what gettext
> supports.

The issue with Guile's format is explained here[1], as the used
implementation follows SRFI-28[2], but there are no difference between
the format from Common Lisp and the one from (ice-9 format)[3] on the
surface level: both implementations are compatible regarding numeric,
iteration, selection and jump directives, to name a few.

Other directives might be compatible, such as the plural directive ~P,
or not, although most of them shouldn't be used in any case: not because
they could have compatibility problems but because they don't fit into
internationalized messages correctly.

For example, most languages have irregular cases for plural formation,
some have more than two grammatical numeric cases, such as
singular/dual/plural, and some don't have an equivalent category, such
as Japanese.  That's exactly use case of ngettext---I've pointed out on
the other mail the pending issue on that area, which is related to the
omission of the numeric parameter but not its order, and applies both to
Common Lisp and (ice-9 format).

> We should use this kind of syntax everywhere we have more than one
> argument.

I don't see the advantage of using everywhere jumps on the msgids.
Nonetheless, a TRANSLATORS: comment placed on the first string appearing
on the POT file, pointing the section of the manual for (ice-9 format),
or even an explicit and detailed explanation of this syntax could be
very helpful for translators.  The attached patch does this, although
any suggestion or even a complete rewrite is welcome, because I don't
feel it quite inspired.

> Also thinking about rtl languages, it's probably important
> for them, though I'm not sure how gettext works for them.

gettext-family functions only see byte arrays and provide the
corresponding array, the bytes are always placed in increasing memory
locations.  Right-to-left handling is a responsibility of visualization
layer, which sometimes includes the final format, but that is an issue
even with left-to-right languages as French.

For example, this composition...

  (string-append translated ": " other-translated)

... produces weird results, or convoluted French translations, because
it isn't handled properly.  A format string must be used here too,
because it must include the white-space expected in French before the
colon:

  (format #f (_ "~a: ~a") translated other-translated)

Newlines are the only ones that are omitted sometimes from the
internationalized composition because the convention up-to-down is
followed, but this is a limitation of the teletype/terminal interface
though; graphic interfaces aren't composed with this limitation and
"whole widgets" should be the localization frame, which usually is the
case.

Happy hacking!
Miguel

[1] https://www.gnu.org/software/guile/manual/html_node/Simple-Output.html
[2] https://www.gnu.org/software/guile/manual/html_node/SRFI_002d28.html
[3] https://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: comment.patch --]
[-- Type: text/x-patch, Size: 1707 bytes --]

From 2615934a2c377858dce2a0410982287faed754a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Wed, 23 Dec 2020 13:07:38 +0100
Subject: [PATCH] nls: Add comment about format directives.

* gnu.scm (%try-use-modules): Add comment for translations.  It should
be placed on the first string found by xgettext.
---
 gnu.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu.scm b/gnu.scm
index f139531ef3..0e87b10eb2 100644
--- a/gnu.scm
+++ b/gnu.scm
@@ -78,6 +78,19 @@
                   (raise
                    (apply
                     make-compound-condition
+                    ;; TRANSLATORS: The scheme-format tag is used to identify
+                    ;; strings that contain format directives as specified
+                    ;; here:
+                    ;; https://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html
+                    ;;
+                    ;; The goto/jump directive can be used to alter the order
+                    ;; of the arguments, either performing relative jumps with
+                    ;; ~N* and ~N:* (forward and backwards respectively) or
+                    ;; the absolute position of the argument can be used
+                    ;; (starting from 0) with ~N@*.  When N isn't provided,
+                    ;; it's understood to be 1 on the relative jumps (next and
+                    ;; previous argument respectively) and 0 on the absolute
+                    ;; jumps (first argument).
                     (formatted-message (G_ "module ~a not found")
                                        module)
                     (condition
-- 
2.29.2


  reply	other threads:[~2020-12-23 12:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 10:53 Word order in Guix l10n Zhu Zihao
2020-12-15 12:25 ` Julien Lepiller
2020-12-18 15:04   ` Ludovic Courtès
2020-12-18 18:03     ` Arun Isaac
2020-12-22 15:00       ` Ludovic Courtès
2020-12-22 15:06         ` Julien Lepiller
2020-12-23 12:22           ` Miguel Ángel Arruga Vivas [this message]
2020-12-27 22:13             ` Ludovic Courtès
2020-12-22 15:45         ` Miguel Ángel Arruga Vivas
2020-12-15 13:11 ` Arun Isaac
2020-12-15 13:51   ` Zhu Zihao

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=87czz0yan6.fsf@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=all_but_last@163.com \
    --cc=guix-devel@gnu.org \
    --cc=julien@lepiller.eu \
    /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).