xref: /dragonfly/usr.bin/localedef/localedef.1 (revision 279dd846)
1.\" Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
2.\" Portions Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved
3.\" Portions Copyright 2013 DEY Storage Systems, Inc.
4.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
5.\" permission to reproduce portions of its copyrighted documentation.
6.\" Original documentation from The Open Group can be obtained online at
7.\" http://www.opengroup.org/bookstore/.
8.\" The Institute of Electrical and Electronics Engineers and The Open Group,
9.\" have given us permission to reprint portions of their documentation. In
10.\" the following statement, the phrase "this text" refers to portions of the
11.\" system documentation. Portions of this text are reprinted and reproduced
12.\" in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1,
13.\" 2004 Edition, Standard for Information Technology -- Portable Operating
14.\" System Interface (POSIX), The Open Group Base Specifications Issue 6,
15.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
16.\" Engineers, Inc and The Open Group. In the event of any discrepancy between
17.\" these versions and the original IEEE and The Open Group Standard, the
18.\" original IEEE and The Open Group Standard is the referee document. The
19.\" original Standard can be obtained online at
20.\" http://www.opengroup.org/unix/online.html.
21.\"  This notice shall appear on any product containing this material.
22.\" The contents of this file are subject to the terms of the Common
23.\" Development and Distribution License (the "License").  You may not use
24.\" this file except in compliance with the License.
25.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or
26.\" http://www.opensolaris.org/os/licensing.  See the License for the specific
27.\" language governing permissions and limitations under the License.
28.\" When distributing Covered Code, include this CDDL HEADER in each file and
29.\" include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable,
30.\" add the following below this CDDL HEADER, with the fields enclosed by
31.\" brackets "[]" replaced with your own identifying information:
32.\" Portions Copyright [yyyy] [name of copyright owner]
33.Dd July 28, 2015
34.Dt LOCALEDEF 1
35.Os
36.Sh NAME
37.Nm localedef
38.Nd define locale environment
39.Sh SYNOPSIS
40.Nm
41.Op Fl D
42.Op Fl c
43.Op Fl v
44.Op Fl U
45.Op Fl f Ar charmap
46.Op Fl w Ar widthfile
47.Op Fl i Ar sourcefile
48.Op Fl u Ar codeset
49localename
50.Sh DESCRIPTION
51The
52.Nm localedef
53utility converts source definitions for locale categories
54into a format usable by the functions and utilities whose operational behavior
55is determined by the setting of the locale environment variables; see
56.Xr environ 5 .
57.Pp
58The utility reads source definitions for one or more locale categories
59belonging to the same locale from the file named in the \fB-i\fR option (if
60specified) or from standard input.
61.Pp
62Each category source definition is identified by the corresponding environment
63variable name and terminated by an
64.Sy END
65.Em category-name
66statement. The following categories are supported:
67.Bl -tag -width LC_MONETARY
68.It LC_CTYPE
69Defines character classification and case conversion.
70.It LC_COLLATE
71Defines collation rules.
72.It LC_MONETARY
73Defines the format and symbols used in formatting of monetary information.
74.It LC_NUMERIC
75Defines the decimal delimiter, grouping and grouping symbol for non-monetary
76numeric editing.
77.It LC_TIME
78Defines the format and content of date and time information.
79.It LC_MESSAGES
80Defines the format and values of affirmative and negative responses.
81.El
82.Pp
83The following options are supported:
84.Bl -tag -width xx_sourcefile
85.It -D
86DragonFly-style output.  Rather than the default of creating the
87.Sy localename
88directory and creating files like LC_CTYPE, LC_COLLATE, etc, in that directory,
89the output files have the format "<localename>.<category>" and are
90dumped to the current directory.
91.It -c
92Creates permanent output even if warning messages have been issued.
93.It -v
94Emit verbose debugging output on standard output.
95.It -U
96Ignore the presence of character symbols that have no matching character
97definition.  This facilitates the use of a common locale definition file
98to be used across multiple encodings, even when some symbols are not
99present in a given encoding.
100.It -f charmap
101Specifies the pathname of a file containing a mapping of character symbols and
102collating element symbols to actual character encodings. This option must be
103specified if symbolic names (other than collating symbols defined in a
104.Sy collating-symbol
105keyword) are used. If the
106.Sy -f
107option is not present, the default character mapping will be used.
108.It -w widthfile
109The path name of the file containing character screen width definitions.
110If not supplied, then default screen widths will be assumed, which will
111generally not account for East Asian encodings requiring more than a single
112character cell to display, nor for combining or accent marks that occupy
113no additional screen width.
114.It -i sourcefile
115The path name of a file containing the source definitions. If this option is
116not present, source definitions will be read from standard input.
117.It -u codeset
118Specifies the name of a codeset used as the target mapping of character symbols
119and collating element symbols whose encoding values are defined in terms of the
120ISO/IEC 10646-1: 2000 standard position constant values. See NOTES.
121.El
122.Pp
123The following operands are required:
124.Bl -tag -width localename
125.It localename
126Identifies the locale. If the name contains one or more slash characters,
127.Ar localename
128will be interpreted as a path name where the created locale
129definitions will be stored. This capability may be restricted to users with
130appropriate privileges. (As a consequence of specifying one
131.Ar localename ,
132although several categories can be processed in one execution, only categories
133belonging to the same locale can be processed.)
134.El
135.Sh OUTPUT
136.Nm
137creates a directory of files that represents the locale's data, unless instructed
138otherwise by the
139.Sy -D
140(DragonFly output) option. The contants of this directory should generally be
141copied into the appropriate subdirectory of /usr/share/locale in order the
142definitions to be visible to programs linked with libc.
143.Sh ENVIRONMENT
144See
145.Xr Benviron 5
146for definitions of the following environment variables that affect the execution of
147.Nm :
148.Sy LANG ,
149.Sy LC_ALL ,
150.Sy LC_COLLATE ,
151.Sy LC_CTYPE ,
152.Sy LC_MESSAGES ,
153.Sy LC_MONETARY ,
154.Sy LC_MUMERIC ,
155.Sy LC_TIME ,
156and
157.Sy NLSPATH .
158.Sh EXIT STATUS
159The following exit values are returned:
160.Bl -tag -width XX
161.It 0
162No errors occurred and the locales were successfully created.
163.It 1
164Warnings occurred and the locales were successfully created.
165.It 2
166The locale specification exceeded implementation limits or the coded character
167set or sets used were not supported by the implementation, and no locale was
168created.
169.It >3
170Warnings or errors occurred and no output was created.
171.El
172.Pp
173If an error is detected, no permanent output will be created.
174.Sh SEE ALSO
175.Xr locale 1 ,
176.Xr iconv_open 3 ,
177.Xr nl_langinfo 3 ,
178.Xr strftime 3 ,
179.Xr environ 5 .
180.Sh WARNINGS
181If warnings occur, permanent output will be created if the
182.Sy -c
183option was specified. The following conditions will cause warning messages to be issued:
184.Bl -tag -width X
185.It *
186If a symbolic name not found in the
187.Em charmap
188file is used for the descriptions of the
189.Sy LC_CTYPE
190or
191.Sy LC_COLLATE
192categories (for other categories, this will be an error condition).
193.It *
194If optional keywords not supported by the implementation are present in the
195source.
196.El
197.Sh NOTES
198When the
199.Sy -u
200option is used, the
201.Em codeset
202option-argument is interpreted as a name of a codeset to which the
203ISO/IEC 10646-1: 2000 standard position constant values are converted. Both the
204ISO/IEC 10646-1: 2000 standard position constant values and other formats (decimal,
205hexadecimal, or octal) are valid as encoding values within the charmap file. The
206codeset can be any codeset that is supported by the \fBiconv_open\fR(3C) function
207on the system.
208.Pp
209When conflicts occur between the charmap specification of
210.Em codeset ,
211.Em mb_cur_max ,
212or
213.Em mb_cur_min
214and the corresponding value for the codeset represented by the
215.Sy -u
216option-argument
217.Em codeset ,
218the
219.Nm
220utility fails as an error.
221.Pp
222When conflicts occur between the charmap encoding values specified for symbolic
223names of characters of the portable character set and the character encoding
224values defined by the US-ASCII, the result is unspecified.
225.Sh HISTORY
226.Nm
227first appeared in
228.Dx
2294.4. It was ported from Illumos from the point
230.An Garrett D'Amore
231.Aq garrett@nexenta.com
232added multibyte support (October 2010).
233.An John Marino
234.Aq draco@marino.st
235provided the alternations necessary to compile cleanly on
236.Dx
237as well as altered libc to use the new collation (the changes were also based
238on Illumos, but modified to work with xlocale functionality.)
239