1gettxt(1) User Commands gettxt(1)
2
3
4
6 gettxt - retrieve a text string from a message database
7
9 gettxt msgfile : msgnum [dflt_msg]
10
11
13 gettxt retrieves a text string from a message file in the directory
14 /usr/lib/locale/locale/LC_MESSAGES . The directory name locale corre‐
15 sponds to the language in which the text strings are written; see set‐
16 locale(3C).
17
18 msgfile Name of the file in the directory
19 /usr/lib/locale/locale/LC_MESSAGES to retrieve msgnum
20 from. The name of msgfile can be up to 14 characters in
21 length, but may not contain either \0 (null) or the ASCII
22 code for / (slash) or : (colon).
23
24
25 msgnum Sequence number of the string to retrieve from msgfile.
26 The strings in msgfile are numbered sequentially from 1 to
27 n, where n is the number of strings in the file.
28
29
30 dflt_msg Default string to be displayed if gettxt fails to retrieve
31 msgnum from msgfile. Nongraphic characters must be repre‐
32 sented as alphabetic escape sequences.
33
34
35
36 The text string to be retrieved is in the file msgfile, created by the
37 mkmsgs(1) utility and installed under the directory
38 /usr/lib/locale/locale/LC_MESSAGES . You control which directory is
39 searched by setting the environment variable LC_MESSAGES. If LC_MES‐
40 SAGES is not set, the environment variable LANG will be used. If LANG
41 is not set, the files containing the strings are under the directory
42 /usr/lib/locale/C/LC_MESSAGES .
43
44
45 If gettxt fails to retrieve a message in the requested language, it
46 will try to retrieve the same message from /usr/lib/locale/C/LC_MES‐
47 SAGES/ msgfile. If this also fails, and if dflt_msg is present and non-
48 null, then it will display the value of dflt_msg; if dflt_msg is not
49 present or is null, then it will display the string Message not
50 found!!.
51
53 Example 1 The environment variables LANG and LC_MESSAGES.
54
55
56 If the environment variables LANG or LC_MESSAGES have not been set to
57 other than their default values, the following example:
58
59
60 example% gettxt UX:10 "hello world\n"
61
62
63
64
65 will try to retrieve the 10th message from /usr/lib/locale/C/UX/msg‐
66 file. If the retrieval fails, the message "hello world," followed by a
67 newline, will be displayed.
68
69
71 See environ(5) for descriptions of the following environment variables
72 that affect the execution of gettxt: LC_CTYPE and LC_MESSAGES.
73
74 LC_CTYPE Determines how gettxt handles characters. When LC_CTYPE
75 is set to a valid value, gettxt can display and handle
76 text and filenames containing valid characters for that
77 locale. gettxt can display and handle Extended Unix
78 Code (EUC) characters where any individual character
79 can be 1, 2, or 3 bytes wide. gettxt can also handle
80 EUC characters of 1, 2, or more column widths. In the
81 "C" locale, only characters from ISO 8859-1 are valid.
82
83
84 LC_MESSAGES Determines how diagnostic and informative messages are
85 presented. This includes the language and style of the
86 messages, and the correct form of affirmative and nega‐
87 tive responses. In the "C" locale, the messages are
88 presented in the default form found in the program
89 itself (in most cases, U.S. English).
90
91
93 /usr/lib/locale/C/LC_MESSAGES/*
94
95 default message files created by mkmsgs(1)
96
97
98 /usr/lib/locale/locale/LC_MESSAGES/*
99
100 message files for different languages created by mkmsgs(1)
101
102
104 See attributes(5) for descriptions of the following attributes:
105
106
107
108
109 ┌─────────────────────────────┬─────────────────────────────┐
110 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
111 ├─────────────────────────────┼─────────────────────────────┤
112 │Availability │SUNWloc │
113 │CSI │Enabled │
114 └─────────────────────────────┴─────────────────────────────┘
115
117 exstr(1), mkmsgs(1), srchtxt(1), gettxt(3C), setlocale(3C),
118 attributes(5), environ(5)
119
120
121
122SunOS 5.11 20 Dec 1996 gettxt(1)