1gettext(1) User Commands gettext(1)
2
3
4
6 gettext - retrieve text string from message database
7
9 gettext [-d textdomain | -−domain=textdomain]
10 [textdomain] msgid
11
12
13 gettext -s [-e] [-n]
14 [-d textdomain | -−domain=textdomain] msgid...
15
16
18 The gettext utility retrieves a translated text string corresponding to
19 string msgid from a message object generated with msgfmt(1). The mes‐
20 sage object name is derived from the optional argument textdomain if
21 present, otherwise from the TEXTDOMAIN environment. If no domain is
22 specified, or if a corresponding string cannot be found, gettext prints
23 msgid.
24
25
26 Ordinarily, gettext looks for its message object in
27 /usr/lib/locale/lang/LC_MESSAGES where lang is the locale name. If
28 present, the TEXTDOMAINDIR environment variable replaces the pathname
29 component up to lang.
30
31
32 This command interprets C escape sequences such as \t for tab. Use \\
33 to print a backslash. To produce a message on a line of its own, either
34 enter \n at the end of msgid, or use this command in conjunction with
35 printf(1).
36
37
38 When used with the -s option, gettext behaves like echo(1). But it does
39 not simply copy its arguments to standard output. Instead, those mes‐
40 sages found in the selected catalog are translated.
41
43 The following options are supported:
44
45 -d textdomain Retrieves translated messages from the domain
46 -−domain=textdomain textdomain, if textdomain is not specified as
47 an operand.
48
49
50 -e Enables expansion of some escape sequences if
51 used with the -s option.
52
53
54 -n Suppresses trailing newline if used with the
55 -s option.
56
57
58 -s Behaves like echo(1) (see DESCRIPTION above).
59 If the -s option is specified, no expansion
60 of C escape sequences is performed and a new‐
61 line character is appended to the output, by
62 default.
63
64
66 The following operands are supported:
67
68 textdomain A domain name used to retrieve the messages. This over‐
69 rides the specification by the -d or -−domain options, if
70 present.
71
72
73 msgid A key to retrieve the localized message.
74
75
77 LANG Specifies locale name.
78
79
80 LC_MESSAGES Specifies messaging locale, and if present overrides
81 LANG for messages.
82
83
84 TEXTDOMAIN Specifies the text domain name, which is identical to
85 the message object filename without .mo suffix.
86
87
88 TEXTDOMAINDIR Specifies the pathname to the message database. If
89 present, replaces /usr/lib/locale.
90
91
93 See attributes(5) for descriptions of the following attributes:
94
95
96
97
98 ┌─────────────────────────────┬─────────────────────────────┐
99 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
100 ├─────────────────────────────┼─────────────────────────────┤
101 │Availability │SUNWcsu │
102 └─────────────────────────────┴─────────────────────────────┘
103
105 echo(1), msgfmt(1), printf(1), gettext(3C), setlocale(3C),
106 attributes(5)
107
109 This is the shell equivalent of the library routine gettext(3C).
110
111
112
113SunOS 5.11 17 Sep 2001 gettext(1)