Re: Grammatical forms in translatable texts

Bruno Haible <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs,gmane.comp.gnu.gettext.bugs
Message-ID <6815494.1Fh6lm5Yl4@omega>
Hi Akim,

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

That's because the message is too terse. Not even quotes around
'end of file'.

> I prefer incorrect French than Frenglish:
> 
> > $ bison foo.y
> > foo.y:2.1: erreur: fin de fichier inattendu

But you would agree with me that

    foo.y:2.1: erreur: frontière de fichier inattendu

would be grammatically incorrect and thereby give an entirely
wrong meaning to the sentence.

> 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"));

Why would this be unacceptable to translators?
YYCASE_(0, YY_("syntax error."));
YYCASE_(1, YY_("syntax error.\nunexpected token: '%s'"));
YYCASE_(2, YY_("syntax error.\nunexpected token: '%s'\nExpected token: '%s'"));
YYCASE_(3, YY_("syntax error.\nunexpected token: '%s'\nExpected token: '%s' or '%s'"));
YYCASE_(4, YY_("syntax error.\nunexpected token: '%s'\nExpected token: '%s' or '%s' or '%s'"));
YYCASE_(5, YY_("syntax error.\nunexpected token: '%s'\nExpected token: '%s' or '%s' or '%s' or '%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.

Why not? Unlike the other half-"solutions", this one works for all
languages.

You already put additional information about the errors in 'note:' lines;
why would you insist that the "unexpected token" info and the "expected
tokens" info would be on the same line, in the same sentence?

Bruno
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.