bug-bison
[Top][All Lists]
Advanced

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

Re: Grammatical forms in translatable texts


From: Bruno Haible
Subject: Re: Grammatical forms in translatable texts
Date: Sun, 19 Apr 2020 16:26:14 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; )

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




reply via email to

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