xref: /netbsd-src/usr.bin/mklocale/mklocale.1 (revision 1246b914bd4240b6f6a99a3137ee71b493fd5850)
1*1246b914Srin.\" $NetBSD: mklocale.1,v 1.19 2024/01/05 02:38:06 rin Exp $
2247329bfSwiz.\" FreeBSD: src/usr.bin/mklocale/mklocale.1,v 1.6 1999/09/20 09:15:21 phantom Exp
3d31d542aSitojun.\"
4d31d542aSitojun.\" Copyright (c) 1993, 1994
5d31d542aSitojun.\"	The Regents of the University of California.  All rights reserved.
6d31d542aSitojun.\"
7d31d542aSitojun.\" This code is derived from software contributed to Berkeley by
8d31d542aSitojun.\" Paul Borman at Krystal Technologies.
9d31d542aSitojun.\"
10d31d542aSitojun.\" Redistribution and use in source and binary forms, with or without
11d31d542aSitojun.\" modification, are permitted provided that the following conditions
12d31d542aSitojun.\" are met:
13d31d542aSitojun.\" 1. Redistributions of source code must retain the above copyright
14d31d542aSitojun.\"    notice, this list of conditions and the following disclaimer.
15d31d542aSitojun.\" 2. Redistributions in binary form must reproduce the above copyright
16d31d542aSitojun.\"    notice, this list of conditions and the following disclaimer in the
17d31d542aSitojun.\"    documentation and/or other materials provided with the distribution.
1889aaa1bbSagc.\" 3. Neither the name of the University nor the names of its contributors
19d31d542aSitojun.\"    may be used to endorse or promote products derived from this software
20d31d542aSitojun.\"    without specific prior written permission.
21d31d542aSitojun.\"
22d31d542aSitojun.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23d31d542aSitojun.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24d31d542aSitojun.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25d31d542aSitojun.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26d31d542aSitojun.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27d31d542aSitojun.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28d31d542aSitojun.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29d31d542aSitojun.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30d31d542aSitojun.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31d31d542aSitojun.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32d31d542aSitojun.\" SUCH DAMAGE.
33d31d542aSitojun.\"
34d31d542aSitojun.\"	@(#)mklocale.1	8.2 (Berkeley) 4/18/94
35d31d542aSitojun.\"
36*1246b914Srin.Dd January 5, 2024
37d31d542aSitojun.Dt MKLOCALE 1
38d31d542aSitojun.Os
39d31d542aSitojun.Sh NAME
40d31d542aSitojun.Nm mklocale
41d31d542aSitojun.Nd make LC_CTYPE locale files
42d31d542aSitojun.Sh SYNOPSIS
43d31d542aSitojun.Nm mklocale
44d31d542aSitojun.Op Fl d
4582b050bfSwiz.Op Fl t Ar type
4601869ca4Swiz<
4782b050bfSwiz.Ar source
4801869ca4Swiz>
49a63657f6Swiz.Ar language/LC_CTYPE
50d31d542aSitojun.Nm mklocale
51d31d542aSitojun.Op Fl d
5282b050bfSwiz.Op Fl t Ar type
53d31d542aSitojun.Fl o
54d31d542aSitojun.Ar language/LC_CTYPE
5582b050bfSwiz.Ar source
56d31d542aSitojun.Sh DESCRIPTION
57d31d542aSitojunThe
58d31d542aSitojun.Nm mklocale
5949b12ea9Swizutility reads an
60d31d542aSitojun.Dv LC_CTYPE
6149b12ea9Swizsource file from standard input and produces an
62d31d542aSitojun.Dv LC_CTYPE
63d31d542aSitojunbinary file on standard output suitable for placement in
6401869ca4Swiz.Pa /usr/share/locale/<language>/LC_CTYPE .
65d31d542aSitojun.Pp
66d31d542aSitojunThe format of
6782b050bfSwiz.Ar source
68d31d542aSitojunis quite simple.
69d31d542aSitojunIt consists of a series of lines which start with a keyword and have
70be8ae688Sgrantassociated data following.
71be8ae688SgrantC style comments are used
72d31d542aSitojunto place comments in the file.
73d31d542aSitojun.Pp
74d31d542aSitojunFollowing options are available:
7549b12ea9Swiz.Bl -tag -width XXX
76d31d542aSitojun.It Fl d
77ea577b21SwizTurns on debugging messages.
78d31d542aSitojun.It Fl o
79d31d542aSitojunSpecify output file.
8082b050bfSwiz.It Fl t
8182b050bfSwizGenerate output in new-style LC_{MONETARY,NUMERIC,TIME,MESSAGES}
8282b050bfSwizlocale-db format.
83d31d542aSitojun.El
84d31d542aSitojun.Pp
85d31d542aSitojunBesides the keywords which will be listed below,
86d31d542aSitojunthe following are valid tokens in
8782b050bfSwiz.Ar source :
88d31d542aSitojun.Bl -tag -width literal
89d31d542aSitojun.It Dv RUNE
90d31d542aSitojunA
91d31d542aSitojun.Dv RUNE
92d31d542aSitojunmay be any of the following:
932a995722Sjoerg.Bl -tag -width 0x[0-9a-f]+
94d31d542aSitojun.It Ar 'x'
95d31d542aSitojunThe ASCII character
96d31d542aSitojun.Ar x .
97d31d542aSitojun.It Ar '\ex'
98d31d542aSitojunThe ANSI C character
99d31d542aSitojun.Ar \ex
100d31d542aSitojunwhere
101d31d542aSitojun.Ar \ex
102d31d542aSitojunis one of
103d31d542aSitojun.Dv \ea ,
104d31d542aSitojun.Dv \eb ,
105d31d542aSitojun.Dv \ef ,
106d31d542aSitojun.Dv \en ,
107d31d542aSitojun.Dv \er ,
108d31d542aSitojun.Dv \et ,
109d31d542aSitojunor
110d31d542aSitojun.Dv \ev .
1112a995722Sjoerg.It Ar 0x[0-9a-f]+
112d31d542aSitojunA hexadecimal number representing a rune code.
113d31d542aSitojun.It Ar 0[0-7]*
114d31d542aSitojunAn octal number representing a rune code.
115d31d542aSitojun.It Ar [1-9][0-9]*
116d31d542aSitojunA decimal number representing a rune code.
117d31d542aSitojun.El
118d31d542aSitojun.It Dv STRING
119d31d542aSitojunA string enclosed in double quotes (").
120d31d542aSitojun.It Dv THRU
121d31d542aSitojunEither
122d31d542aSitojun.Dv ...
123d31d542aSitojunor
124d31d542aSitojun.Dv - .
125d31d542aSitojunUsed to indicate ranges.
126d31d542aSitojun.It Ar literal
127d31d542aSitojunThe follow characters are taken literally:
12801869ca4Swiz.Bl -tag -width "<\|\|(\|\|["
12901869ca4Swiz.It Dv "<\|(\|["
130be8ae688SgrantUsed to start a mapping.
131be8ae688SgrantAll are equivalent.
13201869ca4Swiz.It Dv ">\|\^)\|]"
133be8ae688SgrantUsed to end a mapping.
134be8ae688SgrantAll are equivalent.
135ff7d7a23Sjoerg.It Dv \&:
136d31d542aSitojunUsed as a delimiter in mappings.
137d31d542aSitojun.El
138d31d542aSitojun.El
139a63657f6Swiz.Pp
140d31d542aSitojunKey words which should only appear once are:
141d31d542aSitojun.Bl -tag -width PHONOGRAM
142d31d542aSitojun.It Dv ENCODING
143d31d542aSitojunFollowed by a
144d31d542aSitojun.Dv STRING
145d31d542aSitojunwhich indicates the encoding mechanism to be used for this locale.
146d31d542aSitojunThe current encodings are:
147d31d542aSitojun.Bl -tag -width NONE
148d31d542aSitojun.It Dv NONE
149d31d542aSitojunNo translation and the default.
150d31d542aSitojun.It Dv UTF2
151d31d542aSitojun.Dv "Universal character set Transformation Format"
152d31d542aSitojunadopted from
153d31d542aSitojun.Nm "Plan 9 from Bell Labs" .
154d31d542aSitojun.It Dv EUC
155d31d542aSitojun.Dv EUC
156d31d542aSitojunencoding as used by several
157d31d542aSitojunvendors of
158d31d542aSitojun.Ux
159d31d542aSitojunsystems.
160d31d542aSitojun.El
161d31d542aSitojun.It Dv VARIABLE
162d31d542aSitojunThis keyword must be followed by a single tab or space character,
163d31d542aSitojunafter which encoding specific data is placed.
164d31d542aSitojunCurrently only the
165d31d542aSitojun.Dv "EUC"
166d31d542aSitojunencoding requires variable data.
167a63657f6Swiz.\" See
168a63657f6Swiz.\" .Xr euc 4
169a63657f6Swiz.\" for further details.
170d31d542aSitojun.It Dv INVALID
171d31d542aSitojunA single
172d31d542aSitojun.Dv RUNE
173d31d542aSitojunfollows and is used as the invalid rune for this locale.
174d31d542aSitojun.El
17549b12ea9Swiz.Pp
176d31d542aSitojunThe following keywords may appear multiple times and have the following
177d31d542aSitojunformat for data:
178ff7d7a23Sjoerg.Bl -tag -width "XXRUNE1 THRU RUNEn : RUNE2XX" -offset indent
179a63657f6Swiz.It Aq Dv RUNE1 RUNE2
180d31d542aSitojun.Dv RUNE1
181d31d542aSitojunis mapped to
182d31d542aSitojun.Dv RUNE2 .
183a63657f6Swiz.It Aq Dv RUNE1 THRU RUNEn : RUNE2
184d31d542aSitojunRunes
185d31d542aSitojun.Dv RUNE1
186d31d542aSitojunthrough
187d31d542aSitojun.Dv RUNEn
188d31d542aSitojunare mapped to
189d31d542aSitojun.Dv RUNE2
190d31d542aSitojunthrough
191d31d542aSitojun.Dv RUNE2
192d31d542aSitojun+ n-1.
193d31d542aSitojun.El
194d31d542aSitojun.Bl -tag -width PHONOGRAM
195d31d542aSitojun.It Dv MAPLOWER
196d31d542aSitojunDefines the tolower mappings.
197d31d542aSitojun.Dv RUNE2
198d31d542aSitojunis the lower case representation of
199d31d542aSitojun.Dv RUNE1 .
200d31d542aSitojun.It Dv MAPUPPER
201d31d542aSitojunDefines the toupper mappings.
202d31d542aSitojun.Dv RUNE2
203d31d542aSitojunis the upper case representation of
204d31d542aSitojun.Dv RUNE1 .
205d31d542aSitojun.It Dv TODIGIT
206d31d542aSitojunDefines a map from runes to their digit value.
207d31d542aSitojun.Dv RUNE2
208d31d542aSitojunis the integer value represented by
209d31d542aSitojun.Dv RUNE1 .
210d31d542aSitojunFor example, the ASCII character
211a63657f6Swiz.Sq 0
212a63657f6Swizwould map to the decimal value 0.
21396f7cfd9SrinOn
21496f7cfd9Srin.Nx ,
215*1246b914Srinthis information has never been used until now.
216*1246b914SrinOnly values up to 255 are allowed, and mapping to 256 and above is
217*1246b914Srinsilently ignored.
218d31d542aSitojun.El
21949b12ea9Swiz.Pp
220d31d542aSitojunThe following keywords may appear multiple times and have the following
221d31d542aSitojunformat for data:
222d31d542aSitojun.Bl -tag -width "RUNE1 THRU RUNEn"
223d31d542aSitojun.It Dv RUNE
224d31d542aSitojunThis rune has the property defined by the keyword.
225d31d542aSitojun.It Dv "RUNE1 THRU RUNEn"
226d31d542aSitojunAll the runes between and including
227d31d542aSitojun.Dv RUNE1
228d31d542aSitojunand
229d31d542aSitojun.Dv RUNEn
230d31d542aSitojunhave the property defined by the keyword.
231d31d542aSitojun.El
232d31d542aSitojun.Bl -tag -width PHONOGRAM
233d31d542aSitojun.It Dv ALPHA
234a63657f6SwizDefines runes which are alphabetic, printable, and graphic.
235d31d542aSitojun.It Dv CONTROL
236d31d542aSitojunDefines runes which are control characters.
237d31d542aSitojun.It Dv DIGIT
238a63657f6SwizDefines runes which are decimal digits, printable, and graphic.
239d31d542aSitojun.It Dv GRAPH
240d31d542aSitojunDefines runes which are graphic and printable.
241d31d542aSitojun.It Dv LOWER
242a63657f6SwizDefines runes which are lower case, printable, and graphic.
243d31d542aSitojun.It Dv PUNCT
244a63657f6SwizDefines runes which are punctuation, printable, and graphic.
245d31d542aSitojun.It Dv SPACE
246d31d542aSitojunDefines runes which are spaces.
247d31d542aSitojun.It Dv UPPER
248a63657f6SwizDefines runes which are upper case, printable, and graphic.
249d31d542aSitojun.It Dv XDIGIT
250a63657f6SwizDefines runes which are hexadecimal digits, printable, and graphic.
251d31d542aSitojun.It Dv BLANK
252d31d542aSitojunDefines runes which are blank.
253d31d542aSitojun.It Dv PRINT
254d31d542aSitojunDefines runes which are printable.
255d31d542aSitojun.It Dv IDEOGRAM
256a63657f6SwizDefines runes which are ideograms, printable, and graphic.
257d31d542aSitojun.It Dv SPECIAL
258a63657f6SwizDefines runes which are special characters, printable, and graphic.
259d31d542aSitojun.It Dv PHONOGRAM
260a63657f6SwizDefines runes which are phonograms, printable, and graphic.
261d31d542aSitojun.It Dv SWIDTHn
262d31d542aSitojunDefines runes with specific glyph width.
263d31d542aSitojun.Ar n
264d31d542aSitojuntakes 0 to 3.
265d31d542aSitojun.It Dv CHARSET
266d31d542aSitojunControls character set for subsequent runes.
26757e1c07cSgmcgarry.\" To support
26857e1c07cSgmcgarry.\" .Xr iso2022 4
26957e1c07cSgmcgarry.\" locale definitions.
270d31d542aSitojun.El
271d31d542aSitojun.Sh SEE ALSO
272e0c891c1Swiz.\"Xr colldef 1 ,
273d31d542aSitojun.Xr setlocale 3 ,
27457e1c07cSgmcgarry.\" .Xr euc 4 ,
27557e1c07cSgmcgarry.\" .Xr utf8 4
27657e1c07cSgmcgarry.Xr nls 7
277a9f8e2d2Swiz.Sh HISTORY
278a9f8e2d2SwizThe
279a9f8e2d2Swiz.Nm mklocale
280a9f8e2d2Swizutility first appeared in
281a9f8e2d2Swiz.Bx 4.4 .
282d31d542aSitojun.Sh BUGS
283d31d542aSitojunThe
284d31d542aSitojun.Nm mklocale
285d31d542aSitojunutility is overly simplistic.
286c66fb7f3Sitojun.Pp
287c66fb7f3SitojunWe should switch to
288c66fb7f3Sitojun.Nm localedef
289c66fb7f3Sitojunand its file format, which is more standard.
290