Topic: Localization of strings returned by exception.what()


Author: Nathan Myers <ncm@cantrip.org>
Date: 1996/10/23
Raw View
Nigel D'Souza wrote:
>
> When a internationalized program reports an error to the user, it reports
> the error in the local language.  If such a program uses the C++ library,
> it needs to report the exceptions that are thrown by the C++ library (such
> as a read-only file or disk full exception that may be thrown by fstream).

> Is there anything in the C++ library specification that lets you localize
> the strings returned by the what() member function of the exception classes?

No.  Those strings are purely for communication from compiler vendor to
programmer, and the Standard doesn't impose any requirement on what's
in them.  (A system that reports out of memory errors as "Your father
smells of elderberries" is perfectly conforming; probably you shouldn't
pass that message on to your users. :-)

Probably some vendors will provide a way to localize those strings, but
the standard says absolutely nothing about it, and whatever they do will
certainly not be portable.

> Are implementations expected to subclass the handful of exception
> classes defined in the library in order to "return" more specific error codes?

I see no reason to derive from the standard exception classes, except
perhaps
convenience.  Do they provide you any convenience?

Nathan Myers
ncm@cantrip.org  http://www.cantrip.org/
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: Nigel.D'Souza@natinst.com (Nigel D'Souza)
Date: 1996/10/18
Raw View
     It is very important for internationalized applications to display
     error messages in the local language.  Is there anything in the
     Standard C++ Library that allows localization of the strings returned
     by the what() member function of the standard exception classes.
     Alternatively, there needs to be some way to determine the exact error
     code and display a message from the applications own localized
     messages.

     Nigel D'Souza
     nigeld@natinst.com




[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: "Nigel D'Souza" <nigeld@natinst.com>
Date: 1996/10/21
Raw View
When a internationalized program reports an error to the user, it
reports
the error in the local language.
If such a program uses the C++ library, it needs to report the
exceptions
that are thrown by the C++ library (such as a read-only file or disk
full
exception that may be thrown by fstream).
Is there anything in the C++ library specification that lets you
localize
the strings returned by the what() member function of the exception
classes?
Are implementations expected to subclass the handful of exception
classes
defined in the library in order to "return" more specific error codes?

Nigel D'Souza
National Instruments


      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]