xref: /freebsd/usr.bin/localedef/localedef.1 (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
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.\"
34.\" $FreeBSD$
35.\"
36.Dd July 28, 2015
37.Dt LOCALEDEF 1
38.Os
39.Sh NAME
40.Nm localedef
41.Nd define locale environment
42.Sh SYNOPSIS
43.Nm
44.Op Fl cDUv
45.Op Fl f Ar charmap
46.Op Fl i Ar sourcefile
47.Op Fl u Ar codeset
48.Op Fl w Ar widthfile
49.Ar localename
50.Sh DESCRIPTION
51The
52.Nm
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 7 .
57.Pp
58The utility reads source definitions for one or more locale categories
59belonging to the same locale from the file named in the
60.Fl i
61option (if specified) or from standard input.
62.Pp
63Each category source definition is identified by the corresponding environment
64variable name and terminated by an
65.Sy END
66.Em category-name
67statement.
68The following categories are supported:
69.Bl -tag -width ".Ev LC_MONETARY"
70.It Ev LC_CTYPE
71Defines character classification and case conversion.
72.It Ev LC_COLLATE
73Defines collation rules.
74.It Ev LC_MONETARY
75Defines the format and symbols used in formatting of monetary information.
76.It Ev LC_NUMERIC
77Defines the decimal delimiter, grouping and grouping symbol for non-monetary
78numeric editing.
79.It Ev LC_TIME
80Defines the format and content of date and time information.
81.It Ev LC_MESSAGES
82Defines the format and values of affirmative and negative responses.
83.El
84.Pp
85The following options are supported:
86.Bl -tag -width indent
87.It Fl c
88Creates permanent output even if warning messages have been issued.
89.It Fl D
90BSD-style
91output.
92Rather than the default of creating the
93.Ar localename
94directory and creating files like
95.Pa LC_CTYPE ,
96.Pa LC_COLLATE ,
97etc.\& in that directory,
98the output file names have the format
99.Dq <localename>.<category>
100and are dumped to the current directory.
101.It Fl f Ar charmap
102Specifies the pathname of a file containing a mapping of character symbols and
103collating element symbols to actual character encodings.
104This option must be specified if symbolic names (other than collating symbols
105defined in a
106.Sy collating-symbol
107keyword) are used.
108If the
109.Fl f
110option is not present, the default character mapping will be used.
111.It Fl i Ar sourcefile
112The path name of a file containing the source definitions.
113If this option is not present, source definitions will be read from
114standard input.
115.It Fl u Ar codeset
116Specifies the name of a codeset used as the target mapping of character symbols
117and collating element symbols whose encoding values are defined in terms of the
118ISO/IEC 10646-1:2000 standard position constant values.
119See
120.Sx NOTES .
121.It Fl U
122Ignore the presence of character symbols that have no matching character
123definition.  This facilitates the use of a common locale definition file
124to be used across multiple encodings, even when some symbols are not
125present in a given encoding.
126.It Fl v
127Emit verbose debugging output on standard output.
128.It Fl w Ar widthfile
129The path name of the file containing character screen width definitions.
130If not supplied, then default screen widths will be assumed, which will
131generally not account for East Asian encodings requiring more than a single
132character cell to display, nor for combining or accent marks that occupy
133no additional screen width.
134.El
135.Pp
136The following operands are required:
137.Bl -tag -width ".Ar localename"
138.It Ar localename
139Identifies the locale.
140If the name contains one or more slash characters,
141.Ar localename
142will be interpreted as a path name where the created locale
143definitions will be stored.
144This capability may be restricted to users with appropriate privileges.
145(As a consequence of specifying one
146.Ar localename ,
147although several categories can be processed in one execution, only categories
148belonging to the same locale can be processed.)
149.El
150.Sh OUTPUT
151.Nm
152creates a directory of files that represents the locale's data,
153unless instructed otherwise by the
154.Fl D (
155BSD
156output) option.
157The contants of this directory should generally be copied into the
158appropriate subdirectory of
159.Pa /usr/share/locale
160in order the definitions to be visible to programs linked with libc.
161.Sh ENVIRONMENT
162See
163.Xr environ 7
164for definitions of the following environment variables that affect the
165execution of
166.Nm :
167.Ev LANG ,
168.Ev LC_ALL ,
169.Ev LC_COLLATE ,
170.Ev LC_CTYPE ,
171.Ev LC_MESSAGES ,
172.Ev LC_MONETARY ,
173.Ev LC_MUMERIC ,
174.Ev LC_TIME ,
175and
176.Ev NLSPATH .
177.Sh EXIT STATUS
178The following exit values are returned:
179.Bl -tag -width XX
180.It 0
181No errors occurred and the locales were successfully created.
182.It 1
183Warnings occurred and the locales were successfully created.
184.It 2
185The locale specification exceeded implementation limits or the coded character
186set or sets used were not supported by the implementation, and no locale was
187created.
188.It >3
189Warnings or errors occurred and no output was created.
190.El
191.Pp
192If an error is detected, no permanent output will be created.
193.Sh SEE ALSO
194.Xr locale 1 ,
195.Xr iconv_open 3 ,
196.Xr nl_langinfo 3 ,
197.Xr strftime 3 ,
198.Xr environ 7
199.Sh WARNINGS
200If warnings occur, permanent output will be created if the
201.Fl c
202option was specified.
203The following conditions will cause warning messages to be issued:
204.Bl -bullet
205.It
206If a symbolic name not found in the
207.Pa charmap
208file is used for the descriptions of the
209.Sy LC_CTYPE
210or
211.Sy LC_COLLATE
212categories (for other categories, this will be an error condition).
213.It
214If optional keywords not supported by the implementation are present in the
215source.
216.El
217.Sh NOTES
218When the
219.Fl u
220option is used, the
221.Ar codeset
222option-argument is interpreted as a name of a codeset to which the
223ISO/IEC 10646-1:2000 standard position constant values are converted.
224Both the ISO/IEC 10646-1:2000 standard position constant values and
225other formats (decimal, hexadecimal, or octal) are valid as encoding
226values within the charmap file.
227The
228.Ar codeset
229can be any codeset that is supported by the
230.Fn iconv_open 3
231function.
232.Pp
233When conflicts occur between the charmap specification of
234.Ar codeset ,
235.Em mb_cur_max ,
236or
237.Em mb_cur_min
238and the corresponding value for the codeset represented by the
239.Fl u
240option-argument
241.Ar codeset ,
242the
243.Nm
244utility fails with an error.
245.Pp
246When conflicts occur between the charmap encoding values specified for symbolic
247names of characters of the portable character set and the character encoding
248values defined by the US-ASCII, the result is unspecified.
249.Sh HISTORY
250.Nm
251first appeared in
252.Fx 11 .
253.Pp
254It was written by
255.An Garrett D'Amore
256.Aq Mt garrett@nexenta.com
257for Illumos.
258.An John Marino
259.Aq Mt draco@marino.st
260provided the alternations necessary to compile cleanly on
261.Dx .
262.An Baptiste Daroussin
263.Aq Mt bapt@FreeBSD.org
264ported it to
265.Fx
266and converted it to
267.Xr tree 3 .
268