Locale categories
This table describes the locale categories that are supported on the IBM® i operating system.
Locale category | Description |
---|---|
LC_COLLATE | Defines character or string collation information |
LC_CTYPE | Defines character classification, case conversion, and other character attributes. |
LC_MESSAGES | Defines the format for affirmative and negative responses. |
LC_MONETARY | Defines rules and symbols for formatting monetary numeric information. |
LC_NUMERIC | Defines a list of rules and symbols for formatting non-monetary numeric information. |
LC_TIME | Defines a list of rules and symbols for formatting time and date information. |
LC_TOD | Defines rules for daylight saving time and time zone information. |
Locale category source definitions
The category source definition consists of:
- The category header (category name), where the category name must be all uppercase characters.
- The associated keyword/value pairs that comprise the category body. Keywords can be all uppercase, all lowercase, or mixed case characters.
- The category trailer (which consists of END category-name)
For example:
LC_CTYPE
source for LC_CTYPE category
END LC_CTYPE
Lines preceding the first category header can be used to change the comment character and the escape character. The comment_char (the default is #) and escape_char (the default is \) keywords can be used to change these characters. The following example shows how to change the comment character and escape character to * and / :
comment_char <asterisk>
escape_char <slash>
The source for all categories is specified using keywords, strings, character literals, and character symbols:
- Keywords
- Each keyword identifies either a definition or a rule. The remainder of
the statement containing the keyword contains the operands to the keyword.
Operands are separated from the keyword by one or more blank characters. A
statement may be continued on the next line by placing an escape_char as the
last character before the newline or linefeed character that ends the line.
Lines containing the comment_char in the first column are treated as comment lines. Comment lines cannot be continued on a subsequent line using an escape character. \ is the default escape character. However, the escape character can be defined to be any character by the user.
- Strings
- Strings must be enclosed in quotation marks. Quotation
marks within strings can be represented in two ways:
- Literally. The escape character can be followed by quotation marks.
- A symbolic name. For example, <quotation-mark>.
A string can be continued on the next line by placing an escape_char as the last character before the newline or linefeed character that ends the line.
A string is a sequence of character symbols or literals enclosed by quotation ("") characters. For example:
"<A><B><C>"
- Character literals
- A character literal is the character itself.
- Character symbols
- A character symbol begins with the < (less-than) character, followed
by non-control characters, and ends with the > (greater-than) character.
For example, <A> is a valid character symbol (symbolic name). Any character
symbol referenced in the source file should be one of the predefined system-supplied
symbols. The system-supplied symbolic names are in the source file member
QLGSYMBOL in the QLOCALESRC source file in the optionally installable library
QSYSLOCALE.
In the event that the system does not contain a predefined symbolic name for a character, the UCS-2 level-1 format is allowed. The UCS-2 format is based on the character set defined in ISO/IEC 10646. The UCS-2 format may also be used in place of the predefined symbolic names. Here is an example of the UCS-2 symbolic name format:
<Uxxxx>
where 'xxxx' are 4 hexadecimal digits. For example, <U0041>. The hexadecimal number 0041 within this symbolic name is the UCS-2 code point that represents the character 'A'.
Each locale category must be explicitly defined in a locale definition source file.