gettext markup of library sources
Ulrich Drepper
drepper@redhat.com
Mon Apr 21 19:34:00 GMT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Phil Edwards wrote:
> +// XXX These are only placeholders. They let people mark up the library
> +// sources without breaking things, and will be probably be somewhere else
> +// once localization of the library itself is functioning.
> +#define _(__msgid) (__msgid)
> +#define __N(__msgid) (__msgid)
> +#define __gettext_noop(__msgid) (__msgid)
There is no reason to define __gettext_noop. The functionality is
always identical to that of _N (or this __N abomination). Only
gettext_noop is useful since xgettext automatically recognizes this
name. __gettext_noop is not recognized. Don't blindly copy and then
change things.
Also, using __ prefexes in macro parameters is completely unnecessary.
Those tokens are not in the normal namespace and therefore aren't
polluting it.
> @@ -466,7 +466,7 @@
> // localized to this single should-never-get-this-far function.
> _WordT&
> _M_getword(size_t) const
> - { __throw_out_of_range("bitset -- zero-length"); return *new _WordT; }
> + { __throw_out_of_range(_("bitset is zero-length")); return *new _WordT; }
Is this really what you want? Do you want to throw the translated
string? This seems wasteful. It means every instantiation has a call
to gettext which adds to the code size.
If there is a central place where the strings are used (in the terminate
handler?) put the gettext call in there and use __N in the throw calls.
If the user is also supposed to get translated strings provide an
interface in libstdc++ (or libsupc++) which takes the string and simply
calls dgettext() (note: *NOT* gettext(), a mistake made by several
library implementors before).
- --
- --------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+pEee2ijCOnn/RHQRArGtAJ9gsLdDwehA281oaZuHf9qcCY0sngCfTOJz
qWzooxmGTYNCUYQKpk1/LPY=
=Jd7a
-----END PGP SIGNATURE-----
More information about the Libstdc++
mailing list