2 .\" Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH GETTEXT 1 "Sep 17, 2001"
8 gettext \- retrieve text string from message database
12 \fBgettext\fR [\fB-d\fR \fItextdomain\fR | \fB-\(midomain\fR=\fItextdomain\fR]
13 [\fItextdomain\fR] \fImsgid\fR
18 \fBgettext\fR \fB-s\fR [\fB-e\fR] [\fB-n\fR]
19 [\fB-d\fR \fItextdomain\fR | \fB-\(midomain\fR=\fItextdomain\fR] \fImsgid\fR...
25 The \fBgettext\fR utility retrieves a translated text string corresponding to
26 string \fImsgid\fR from a message object generated with \fBmsgfmt\fR(1). The
27 message object name is derived from the optional argument \fItextdomain\fR if
28 present, otherwise from the \fBTEXTDOMAIN\fR environment. If no domain is
29 specified, or if a corresponding string cannot be found, \fBgettext\fR prints
33 Ordinarily, \fBgettext\fR looks for its message object in
34 \fB/usr/lib/locale/\fIlang\fR/LC_MESSAGES\fR where \fIlang\fR is the locale
35 name. If present, the \fBTEXTDOMAINDIR\fR environment variable replaces the
36 pathname component up to \fIlang\fR.
39 This command interprets C escape sequences such as \fB\et\fR for tab. Use
40 \fB\e\e\fR to print a backslash. To produce a message on a line of its own,
41 either enter \fB\en\fR at the end of \fImsgid\fR, or use this command in
42 conjunction with \fBprintf\fR(1).
45 When used with the \fB-s\fR option, \fBgettext\fR behaves like \fBecho\fR(1).
46 But it does not simply copy its arguments to standard output. Instead, those
47 messages found in the selected catalog are translated.
51 The following options are supported:
55 \fB\fB-d\fR \fItextdomain\fR\fR
59 \fB\fB-\(midomain\fR=\fItextdomain\fR\fR
62 Retrieves translated messages from the domain \fItextdomain\fR, if
63 \fItextdomain\fR is not specified as an operand.
72 Enables expansion of some escape sequences if used with the \fB-s\fR option.
81 Suppresses trailing newline if used with the \fB-s\fR option.
90 Behaves like \fBecho\fR(1) (see DESCRIPTION above). If the \fB-s\fR option is
91 specified, no expansion of C escape sequences is performed and a newline
92 character is appended to the output, by default.
98 The following operands are supported:
102 \fB\fItextdomain\fR\fR
105 A domain name used to retrieve the messages. This overrides the specification
106 by the \fB-d\fR or \fB-\(midomain\fR options, if present.
115 A key to retrieve the localized message.
118 .SH ENVIRONMENT VARIABLES
125 Specifies locale name.
131 \fB\fBLC_MESSAGES\fR\fR
134 Specifies messaging locale, and if present overrides \fBLANG\fR for messages.
140 \fB\fBTEXTDOMAIN\fR\fR
143 Specifies the text domain name, which is identical to the message object
144 filename without \fB\&.mo\fR suffix.
150 \fB\fBTEXTDOMAINDIR\fR\fR
153 Specifies the pathname to the message database. If present, replaces
154 \fB/usr/lib/locale\fR.
160 \fBecho\fR(1), \fBmsgfmt\fR(1), \fBprintf\fR(1), \fBgettext\fR(3C),
161 \fBsetlocale\fR(3C), \fBattributes\fR(5)
165 This is the shell equivalent of the library routine \fBgettext\fR(3C).