Add i18n support

Let's make a step towards the growing strace userbase all around
the world and translate something to the language of their choice.

This change enables translation of error messages corresponding
to errno codes, making it consistent with error diagnostics of other
i18n-aware tools, e.g.

$ LANG=es_ES strace -qq -a38 -P /missing unlink /missing
unlink("/missing")                    = -1 ENOENT (No existe el fichero o el directorio)
unlink: no se puede deshacer el enlace '/missing': No existe el fichero o el directorio

* strace.c: Include <locale.h>.
(main): Invoke setlocale.
* tests/init.sh: Export LC_ALL=C.
* NEWS: Mention this enhancement.
This commit is contained in:
Дмитрий Левин 2017-04-01 13:14:15 +00:00
parent 884d3ae479
commit 53b0d9c438
3 changed files with 4 additions and 0 deletions

1
NEWS
View File

@ -24,6 +24,7 @@ Noteworthy changes in release ?.?? (????-??-??)
* Known pixel/SDR format names are printed as comments for pixelformat fields
in v4l2 structures.
* Enhanced decoding of kern_features syscall.
* Added i18n support.
* Bug fixes
* Fixed build on m68k.

View File

@ -44,6 +44,7 @@
#include <pwd.h>
#include <grp.h>
#include <dirent.h>
#include <locale.h>
#include <sys/utsname.h>
#ifdef HAVE_PRCTL
# include <sys/prctl.h>
@ -2668,6 +2669,7 @@ terminate(void)
int
main(int argc, char *argv[])
{
setlocale(LC_ALL, "");
init(argc, argv);
exit_code = !nprocs;

View File

@ -26,6 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
export LC_ALL=C
ME_="${0##*/}"
LOG="log"
OUT="out"