xref: /netbsd-src/usr.bin/gettext/gettext.1 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: gettext.1,v 1.2 2015/06/03 14:38:38 wiz Exp $
2.\"
3.\" Copyright (c) 2015 William Orr <will@worrbase.com>,
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd June 3, 2015
28.Dt GETTEXT 1
29.Os
30.Sh NAME
31.Nm gettext
32.Nd message translation front-end
33.Sh SYNOPSIS
34.Nm
35.Op Fl h
36.Nm
37.Op Fl en
38.Op Ar textdomain
39.Ar msgid
40.Nm
41.Fl s
42.Op Fl n
43.Op Ar msgid ...
44.Sh DESCRIPTION
45.Nm
46attempts to translate a given
47.Ar msgid
48into the locale-specific string as determined by the environment.
49If a translation file is not found, or a translation for the given
50.Ar msgid
51is not found, the original string will be echoed.
52.Pp
53If the
54.Ar textdomain
55is not provided as an argument, the
56.Ev TEXTDOMAIN
57environment variable will be consulted instead.
58.Pp
59By default
60.Nm
61will look for message catalogs in
62.Pa /usr/share/locale .
63If the environment variable
64.Ev TEXTDOMAINDIR
65is defined, then that will override the default location.
66.Pp
67The following flags are available:
68.Bl -tag -width Ds
69.It Fl e
70Interpret backslash escape sequences prior to translation.
71.It Fl h
72Print the usage information
73.It Fl n
74If
75.Fl s
76is used, do not add the trailing newline.
77If
78.Fl s
79is not provided, this flag will do nothing.
80.It Fl s
81Act similarly to
82.Xr echo 1 .
83All
84.Ar msgid
85arguments will be translated, and a newline will be appended to the output
86string.
87.El
88.Sh ENVIRONMENT
89.Bl -tag -width Ds
90.It Ev TEXTDOMAIN
91The domain to use when looking up
92.Ar msgids .
93.It Ev TEXTDOMAINDIR
94The location of message catalogs to use, overriding
95.Pa /usr/share/locale .
96.El
97.Sh EXIT STATUS
98.Ex -std
99.Sh EXAMPLES
100.Bd -literal -offset indent
101$ LANG=es gettext grep 'writing output'
102escribiendo el resultado
103.Ed
104.Sh SEE ALSO
105.Xr echo 1 ,
106.Xr gettext 3 ,
107.Xr environ 7
108