libctf, binutils: initial work towards libctf gettextization

We gettextize under our package name, which we change to a more
reasonable 'libctf'.  Our internationalization support is mostly
provided by ctf-intl.h, which is a copy of opcodes/opintl.h with
the non-gettext_noop N_() expansion debracketed to avoid pedantic
compiler warnings.

The libctf error strings returned by ctf_errmsg are marked up for
internationalization.

(We also adjust binutils's Makefile a tiny bit to allow for the
fact that libctf now uses functions from libintl.)

binutils/ChangeLog
2020-08-27  Nick Alcock  <nick.alcock@oracle.com>

	* Makefile.am (readelf_LDADD): Move $(LIBINTL) after $(LIBCTF_NOBFD).
	* Makefile.in: Regenerated.

libctf/ChangeLog
2020-08-27  Nick Alcock  <nick.alcock@oracle.com>

	* configure.ac: Adjust package name to simply 'libctf': arbitrarily
	declare this to be version 1.2.0.
	* Makefile.am (AM_CPPFLAGS): Add @INCINTL@.
	* Makefile.in: Regenerated.
	* configure: Regenerated.
	* ctf-intl.h: New file, lightly modified from opcodes/opintl.h.
	* ctf-impl.h: Include it.
	* ctf-error.r (_ctf_errlist_t): Mark strings as noop-translatable.
	(ctf_errmsg): Actually translate them.
This commit is contained in:
Nick Alcock
2020-07-30 17:43:12 +01:00
parent 514b4e191d
commit 987cf30ad8
11 changed files with 107 additions and 21 deletions

View File

@ -45,7 +45,7 @@ static const union _ctf_errlist_t
} _ctf_errlist =
{
{
#define _CTF_STR(n, s) s,
#define _CTF_STR(n, s) N_(s),
#include "ctf-error.h"
#undef _CTF_STR
}
@ -70,7 +70,7 @@ ctf_errmsg (int error)
else
str = (const char *) strerror (error);
return (str ? str : "Unknown error");
return (str ? gettext (str) : _("Unknown error"));
}
int