1xgettext(1)                      User Commands                     xgettext(1)
2
3
4

NAME

6       xgettext - extract gettext call strings from C programs
7

SYNOPSIS

9       xgettext [-ns] [-a [-x exclude-file]] [-c comment-tag]
10            [-d default-domain] [-j] [-m prefix] [-M suffix]
11            [-p pathname] -| filename...
12
13
14       xgettext -h
15
16

DESCRIPTION

18       The  xgettext utility is used to automate the creation of portable mes‐
19       sage files (.po). A .po file contains copies of "C"  strings  that  are
20       found  in  ANSI C source code in filename or the standard input if  `'
21       is specified on the command line. The  .po file can be used as input to
22       the   msgfmt(1)  utility,  which  produces a binary form of the message
23       file that can be  used by application during run-time.
24
25
26       xgettext writes msgid strings from gettext(3C) calls  in   filename  to
27       the  default  output file messages.po. The default output file name can
28       be changed by  -d option. msgid strings in dgettext() calls are written
29       to  the output file domainname.po where domainname is the first parame‐
30       ter to the dgettext() call.
31
32
33       By default, xgettext creates a  .po file in the current working  direc‐
34       tory,  and  each  entry  is  in  the  same  order  that the strings are
35       extracted from filenames. When the -p option  is  specified,  the   .po
36       file  is  created  in  the  pathname directory. An existing .po file is
37       overwritten.
38
39
40       Duplicate  msgids are written to the  .po file as comment  lines.  When
41       the   -s  option  is specified, the  .po is sorted by the msgid string,
42       and all duplicated msgids are removed. All  msgstr  directives  in  the
43       .po file are empty unless the -m option is used.
44

OPTIONS

46       The following options are supported:
47
48       -n                   Add  comment  lines  to the output file indicating
49                            file name and line number in the source file where
50                            each  extracted string is encountered. These lines
51                            appear before each msgid in the following format:
52
53                              # # File: filename, line: line-number
54
55
56
57
58       -s                   Generate output sorted by  msgids with all  dupli‐
59                            cate  msgids removed.
60
61
62       -a                   Extract  all strings, not just those found in get‐
63                            text(3C), and dgettext() () calls. Only  one   .po
64                            file is created.
65
66
67       -c comment-tag       The  comment  block  beginning with comment-tag as
68                            the first token of the comment block is  added  to
69                            the  output .po file as  # delimited comments. For
70                            multiple domains, xgettext  directs  comments  and
71                            messages to the prevailing text domain.
72
73
74       -d default-domain    Rename  default  output  file  from messages.po to
75                            default-domain .po.
76
77
78       -j                   Join messages with existing message files.   If  a
79                            .po  file does not exist, it is created.  If a .po
80                            file does exist, new messages are  appended.   Any
81                            duplicate  msgids are commented out in the result‐
82                            ing .po file.  Domain directives in  the  existing
83                            .po  file  are  ignored. Results not guaranteed if
84                            the existing message file has been edited.
85
86
87       -m prefix            Fill in the msgstr with  prefix.  This  is  useful
88                            for  debugging  purposes. To make msgstr identical
89                            to msgid, use an empty string  ("") for prefix.
90
91
92       -M suffix            Fill in the msgstr with  suffix.  This  is  useful
93                            for debugging purposes.
94
95
96       -p pathname          Specify  the directory where the output files will
97                            be placed. This option overrides the current work‐
98                            ing directory.
99
100
101       -x exclude-file      Specify a  .po file that contains a list of msgids
102                            that are not to be extracted from the input files.
103                            The format of exclude-file is identical to the .po
104                            file. However, only the msgid  directive  line  in
105                            exclude-file  is  used. All other lines are simply
106                            ignored.  The -x option can only be used with  the
107                            -a option.
108
109
110       -h                   Print a help message on the standard output.
111
112

ATTRIBUTES

114       See attributes(5) for descriptions of the following attributes:
115
116
117
118
119       ┌─────────────────────────────┬─────────────────────────────┐
120       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
121       ├─────────────────────────────┼─────────────────────────────┤
122       │Availability                 │SUNWloc                      │
123       └─────────────────────────────┴─────────────────────────────┘
124

SEE ALSO

126       msgfmt(1), gettext(3C), attributes(5)
127

NOTES

129       xgettext  is not able to extract cast strings, for example ANSI C casts
130       of literal strings to (const char *). This is unnecessary anyway, since
131       the prototypes in <libintl.h> already specify this type.
132
133
134       In  messages  and translation notes, lines greater than 2048 characters
135       are truncated to 2048 characters and a warning message  is  printed  to
136       stderr.
137
138
139
140SunOS 5.11                        23 Mar 1999                      xgettext(1)
Impressum