Re: Grammatical forms in translatable texts

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs,gmane.comp.gnu.gettext.bugs
Message-ID <[email protected]>
Hi Bruno!

Thanks for the answer.

Le 19 avr. 2020 à 14:04, Bruno Haible <[email protected]> a écrit :
> 
>>> Of course, you might consider this nitpicking.
> 
> It is not nitpicking. A msgid "syntax error, unexpected %s", where
> a translatable string is plugged in for %s, violates the i18n principle
> "Entire sentences", documented at
> https://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html

Yes, of course!  But it's better than what we had so far.  Gosh,
I hate reading

> $ cat foo.y
> %%
> $ bison foo.y
> foo.y:2.1: erreur: erreur de syntaxe, end of file inattendu

I prefer incorrect French than Frenglish:

> $ bison foo.y
> foo.y:2.1: erreur: fin de fichier inattendu


And it would be non acceptable to ask translators to address
all the possible cases

YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));

The real good option I see (to get proper sentences rather than
forms) is the one I mentioned in my message for Bison 3.8.

Meanwhile, quotes around %s could improve the result.  Or, in the
case of French, defensive translation:

> foo.y:2.1: erreur: fin de fichier inattendu(e)



>> but I believe contexts would help
>> (https://www.gnu.org/software/gettext/manual/html_node/Contexts.html).
> 
> I don't think contexts can help here. Context are a kind of namespacing
> system within a translation domain.

I was addressing the fact that token names might be too short
and be in conflict with other occurrences of the same word.
In Ruby, I frequently use s_ in such a case.

You didn't answer that part.  You dislike the idea of s_?

> The general solution, that works for any language, is to relax on the
> requirement that the error message should be a sentence. It can look
> like a form. For example:
> 
>   Syntax error.
>   Unexpected token: %s
>   Expected one of the following tokens: %s, ...
> 
> This way it doesn't matter whether the string substituted for %s,
> "kyrillischer Buchstabe", is a masculinum or neutrum, and how it would
> be declensed in a sentence.

But I'm not sure I'd do that in Bison itself.

Cheers!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.