bug-gettext
[Top][All Lists]
Advanced

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

Re: [WIP-PATCHES] Lisp (and Scheme) jump format specifier and ngettext


From: Miguel Ángel Arruga Vivas
Subject: Re: [WIP-PATCHES] Lisp (and Scheme) jump format specifier and ngettext
Date: Thu, 10 Dec 2020 00:47:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi Bruno,

Sorry for the delay.

Bruno Haible <bruno@clisp.org> writes:

> Hi Miguel,
>
>> > The second patch is right as well. Simply, I had never thought at 
>> > explicitly
>> > listing plural cases in these unit tests.
>> > [...]
>> > Yes, it would be useful to add this test to the test suite.
>> 
>> I've joined them, because they are mostly plural case tests.  With your
>> guidance I came to the second patch, which solves both issues.  What do
>> you think?
>
> Thanks for working on this.

I'm glad to help, even though it's only a tiny bit like this one. :-)

> It is OK to join the changes for Lisp and for Scheme in a single patch,
> since it does effectively the same thing.

Great, I've added your cases to the patch, but these two ...

>>   # Invalid: omitting an object-typed variable
>>   msgid "~a's ~d thing"
>>   msgid_plural "~a's ~d things"
>>   msgstr[0] "the ~d thing"
> I meant: msgstr[0] "the ~*~d thing"
>>   msgstr[1] "the ~a's ~d things"
>> 
>>   # Invalid: omitting an object-typed variable
>>   msgid "~s ~d thing"
>>   msgid_plural "~s ~d things"
>>   msgstr[0] "the ~d thing"
> I meant: msgstr[0] "the ~*~d thing"
>>   msgstr[1] "the ~s ~d things"

... have an issue with the jump specifier, because they generate exactly
the same format_arg_list.  Indeed, I think both are worth to be
included, but I have to work more on it to get a sound implementation
for the second case and only the first version is included in the first
patch.

> Namely, the difference between messages with no plural and messages with
> plural is *only* that the message with plural some cases don't need to
> mention an integer argument since it is known from the plural form.
> [...]
> That's the *only* reason why a translator is supposed to use different
> format directives in the translation.

IIUC the proposed specification---which isn't exactly the same as the
current wording at format.h, but IMHO this a better definition---is that
the difference between the two format specification parameter lists must
be the empty list, or it must contain at most a single element of
integer type, which, depending on the language, could have the
additional restriction of being on the tail position of the parameter
list.

There are some odd cases that could be taken into account, as having the
number input several times as a parameter, but I don't think they are
the top priority having good internationalized messages in mind.
Nonetheless, this probably needs some patches for the manual too, as it
is kind of implied by "info '(gettext)Plural forms'" that any number of
arguments may be omitted from the translation.

> If yes, can you add more such tests? When working on xgettext, because of
> the complexity of the code involved, I like to use a test-driven coding
> approach: First add more test cases to the test suite, then only implement
> the code that does it.

I've seen on the history that usually these changes are squashed
together though, so I guess I should do that before pushing them,
shouldn't I?  In any case, these patches are more a status report of the
WIP than final code, because they need at the very least more comments
and probably some refactor to avoid code duplication.

Attachment: 0001-tests-Add-Lisp-and-Scheme-plural-cases.patch
Description: 0001-tests.patch

Attachment: 0002-format-lisp-format-scheme-Allow-omit-integer-with-ng.patch
Description: 0002-impl.patch

Best regards,
Miguel

reply via email to

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