2 .\" Copyright 1989 AT&T All Rights Reserved Copyright (c) 1996, 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 GETTXT 1 "Dec 20, 1996"
8 gettxt \- retrieve a text string from a message database
12 \fBgettxt\fR \fImsgfile\fR : \fImsgnum\fR [\fIdflt_msg\fR]
18 \fBgettxt\fR retrieves a text string from a message file in the directory
19 \fB/usr/lib/locale/\fR\fIlocale\fR\fB/\fR\fBLC_MESSAGES\fR\fB \fR. The
20 directory name \fIlocale\fR corresponds to the language in which the text
21 strings are written; see \fBsetlocale\fR(3C).
28 Name of the file in the directory
29 \fB/usr/lib/locale/\fR\fIlocale\fR\fB/\fR\fBLC_MESSAGES\fR\fB \fR to retrieve
30 \fImsgnum\fR from. The name of \fImsgfile\fR can be up to 14 characters in
31 length, but may not contain either \e0 (null) or the \fBASCII\fR code for
32 \fB/\fR (slash) or \fB:\fR (colon).
41 Sequence number of the string to retrieve from \fImsgfile\fR. The strings in
42 \fImsgfile\fR are numbered sequentially from \fI1\fR to \fIn\fR, where \fIn\fR
43 is the number of strings in the file.
52 Default string to be displayed if \fBgettxt\fR fails to retrieve \fImsgnum\fR
53 from \fImsgfile\fR. Nongraphic characters must be represented as alphabetic
59 The text string to be retrieved is in the file \fImsgfile\fR, created by the
60 \fBmkmsgs\fR(1) utility and installed under the directory
61 \fB/usr/lib/locale/\fR\fIlocale\fR\fB/\fR\fBLC_MESSAGES\fR\fB \fR. You
62 control which directory is searched by setting the environment variable
63 \fBLC_MESSAGES\fR. If \fBLC_MESSAGES\fR is not set, the environment variable
64 \fBLANG\fR will be used. If \fBLANG\fR is not set, the files containing the
65 strings are under the directory \fB/usr/lib/locale/C/\fR\fBLC_MESSAGES\fR\fB
69 If \fBgettxt\fR fails to retrieve a message in the requested language, it will
70 try to retrieve the same message from
71 \fB/usr/lib/locale/C/\fR\fBLC_MESSAGES\fR\fB/ \fR\fImsgfile\fR. If this also
72 fails, and if \fIdflt_msg\fR is present and non-null, then it will display the
73 value of \fIdflt_msg\fR; if \fIdflt_msg\fR is not present or is null, then it
74 will display the string \fBMessage not found!!\fR.
77 \fBExample 1 \fRThe environment variables \fBLANG\fR and \fBLC_MESSAGES\fR.
80 If the environment variables \fBLANG\fR or \fBLC_MESSAGES\fR have not been set
81 to other than their default values, the following example:
86 \fBexample% gettxt UX:10 "hello world\en"\fR
93 will try to retrieve the 10th message from
94 \fB/usr/lib/locale/C/UX/\fR\fImsgfile\fR. If the retrieval fails, the message
95 "hello world," followed by a newline, will be displayed.
97 .SH ENVIRONMENT VARIABLES
100 See \fBenviron\fR(5) for descriptions of the following environment variables
101 that affect the execution of \fBgettxt\fR: \fBLC_CTYPE\fR and
102 \fB\fR\fBLC_MESSAGES\fR\fB\&. \fR
106 \fB\fBLC_CTYPE\fR \fR
109 Determines how \fBgettxt\fR handles characters. When \fBLC_CTYPE\fR is set to a
110 valid value, \fBgettxt\fR can display and handle text and filenames containing
111 valid characters for that locale. \fBgettxt\fR can display and handle Extended
112 Unix Code (EUC) characters where any individual character can be 1, 2, or 3
113 bytes wide. \fBgettxt\fR can also handle \fBEUC\fR characters of 1, 2, or more
114 column widths. In the "C" locale, only characters from ISO 8859-1 are valid.
120 \fB\fBLC_MESSAGES\fR \fR
123 Determines how diagnostic and informative messages are presented. This includes
124 the language and style of the messages, and the correct form of affirmative and
125 negative responses. In the "C" locale, the messages are presented in the
126 default form found in the program itself (in most cases, U.S. English).
133 \fB\fB/usr/lib/locale/C/\fR\fBLC_MESSAGES\fR\fB/* \fR\fR
137 default message files created by \fBmkmsgs\fR(1)
143 \fB\fB/usr/lib/locale/\fR\fIlocale\fR\fB/\fR\fBLC_MESSAGES\fR\fB/* \fR\fR
147 message files for different languages created by \fBmkmsgs\fR(1)
153 See \fBattributes\fR(5) for descriptions of the following attributes:
161 ATTRIBUTE TYPE ATTRIBUTE VALUE
168 \fBexstr\fR(1), \fBmkmsgs\fR(1), \fBsrchtxt\fR(1), \fBgettxt\fR(3C),
169 \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5)