NetBSD/usr.bin/gettext/gettext.1

108 lines
2.9 KiB
Groff

.\" $NetBSD: gettext.1,v 1.2 2015/06/03 14:38:38 wiz Exp $
.\"
.\" Copyright (c) 2015 William Orr <will@worrbase.com>,
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd June 3, 2015
.Dt GETTEXT 1
.Os
.Sh NAME
.Nm gettext
.Nd message translation front-end
.Sh SYNOPSIS
.Nm
.Op Fl h
.Nm
.Op Fl en
.Op Ar textdomain
.Ar msgid
.Nm
.Fl s
.Op Fl n
.Op Ar msgid ...
.Sh DESCRIPTION
.Nm
attempts to translate a given
.Ar msgid
into the locale-specific string as determined by the environment.
If a translation file is not found, or a translation for the given
.Ar msgid
is not found, the original string will be echoed.
.Pp
If the
.Ar textdomain
is not provided as an argument, the
.Ev TEXTDOMAIN
environment variable will be consulted instead.
.Pp
By default
.Nm
will look for message catalogs in
.Pa /usr/share/locale .
If the environment variable
.Ev TEXTDOMAINDIR
is defined, then that will override the default location.
.Pp
The following flags are available:
.Bl -tag -width Ds
.It Fl e
Interpret backslash escape sequences prior to translation.
.It Fl h
Print the usage information
.It Fl n
If
.Fl s
is used, do not add the trailing newline.
If
.Fl s
is not provided, this flag will do nothing.
.It Fl s
Act similarly to
.Xr echo 1 .
All
.Ar msgid
arguments will be translated, and a newline will be appended to the output
string.
.El
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It Ev TEXTDOMAIN
The domain to use when looking up
.Ar msgids .
.It Ev TEXTDOMAINDIR
The location of message catalogs to use, overriding
.Pa /usr/share/locale .
.El
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
.Bd -literal -offset indent
$ LANG=es gettext grep 'writing output'
escribiendo el resultado
.Ed
.Sh SEE ALSO
.Xr echo 1 ,
.Xr gettext 3 ,
.Xr environ 7