Difference between revisions of "Unit Locale"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Reference === Description === ---- ''To be documented'' === Constants === ---- ''To be documented'' === Type definitions === ---- ''To...")
 
 
(35 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Ultibo Locale Interface unit'''
 +
 
 +
This unit implements the locale support for Ultibo and provides the code page support for the WideStringManager/UnicodeStringManager interface for the RTL.
 +
 
 +
This unit provides compatible implementations of the following functions:
 +
 
 +
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 +
* ConvertDefaultLocale
 +
* EnumCodePagesProc
 +
* EnumLocalesProc
 +
* EnumTimeFormats
 +
* GetCPInfo
 +
* GetNumberFormat
 +
* GetSystemDefaultLangID
 +
* GetUserDefaultLangID
 +
* IsValidLocale
 +
* GetConsoleOutputCP
 +
* EnumCalendarInfo
 +
* EnumDateFormats
 +
* EnumSystemCodePages
 +
* EnumTimeFormatsProc
 +
* GetCurrencyFormat
 +
* GetLocaleInfo
 +
* GetSystemDefaultLCID
 +
* GetUserDefaultLCID
 +
* SetLocaleInfo
 +
* SetConsoleCP
 +
* EnumCalendarInfoProc
 +
* EnumDateFormatsProc
 +
* EnumSystemLocales
 +
* GetACP
 +
* GetDateFormat
 +
* GetOEMCP
 +
* GetTimeFormat
 +
* IsValidCodePage
 +
* GetConsoleCP
 +
* SetConsoleOutputCP
 +
</div>
 +
 +
 
 +
The following functions are implemented by the Threads unit:
 +
 
 +
* GetThreadLocale (ThreadGetLocale) (GetThreadLocale is exposed in the Ultibo unit)
 +
 
 +
* SetThreadLocale (ThreadSetLocale) (SetThreadLocale is exposed in the Ultibo unit)
 +
 
 +
Most of the above are currently not implemented.
 +
 
 +
 
 +
OEM Code Page defaults to 437 (OEM United States)
 +
 
 +
ANSI Code Page defaults to 1252 (ANSI Latin 1; Western European (Windows))
 +
 
 +
 +
See also: https://msdn.microsoft.com/en-us/library/windows/desktop/dd319081%28v=vs.85%29.aspx
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Default code page''' <code> CP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Most of these are defined in System (see: \source\rtl\inc\systemh.inc)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>CP_ACP = 0;</code>
 +
| Default to ANSI code page
 +
|-
 +
| <code>CP_OEMCP = 1;</code>
 +
| Default to OEM  code page
 +
|-
 +
| <code>CP_MACCP = 2;</code>
 +
| Default to MAC  code page
 +
|-
 +
| <code>CP_THREAD_ACP = 3;</code>
 +
| Current thread's ANSI code page
 +
|-
 +
| <code>CP_SYMBOL = 42;</code>
 +
| SYMBOL translations
 +
|-
 +
| <code>CP_UTF16 = 1200;</code>
 +
| UTF-16 translation
 +
|-
 +
| <code>CP_UNICODE = 1200;</code>
 +
| Unicode translation
 +
|-
 +
| <code>CP_UTF16_BE = 1201;</code>
 +
| UTF-16 (unicodeFFFE) translation
 +
|-
 +
| <code>CP_UTF7 = 65000;</code>
 +
| UTF-7 translation
 +
|-
 +
| <code>CP_UTF8 = 65001;</code>
 +
| UTF-8 translation
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Code page identifier''' <code> CP_OEM_*, CP_ANSI_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See: https://en.wikipedia.org/wiki/Code_page)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>CP_OEM_437 = 437;</code>
 +
| US
 +
|-
 +
| <code>CP_OEM_720 = 720;</code>
 +
| Arabic
 +
|-
 +
| <code>CP_OEM_737 = 737;</code>
 +
| Greek
 +
|-
 +
| <code>CP_OEM_775 = 775;</code>
 +
| Baltic
 +
|-
 +
| <code>CP_OEM_850 = 850;</code>
 +
| Latin I
 +
|-
 +
| <code>CP_OEM_852 = 852;</code>
 +
| Latin II
 +
|-
 +
| <code>CP_OEM_857 = 857;</code>
 +
| Turkish
 +
|-
 +
| <code>CP_OEM_862 = 862;</code>
 +
| Hebrew
 +
|-
 +
| <code>CP_OEM_866 = 866;</code>
 +
| Russian
 +
|-
 +
| <code>CP_OEM_874 = 874;</code>
 +
| Thai
 +
|-
 +
| <code>CP_OEM_1258 = 1258;</code>
 +
| Vietnam
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>CP_ANSI_1250 = 1250;</code>
 +
| Central Europe
 +
|-
 +
| <code>CP_ANSI_1251 = 1251;</code>
 +
| Cyrillic
 +
|-
 +
| <code>CP_ANSI_1252 = 1252;</code>
 +
| Latin I
 +
|-
 +
| <code>CP_ANSI_1253 = 1253;</code>
 +
| Greek
 +
|-
 +
| <code>CP_ANSI_1254 = 1254;</code>
 +
| Turkish
 +
|-
 +
| <code>CP_ANSI_1255 = 1255;</code>
 +
| Hebrew
 +
|-
 +
| <code>CP_ANSI_1256 = 1256;</code>
 +
| Arabic
 +
|-
 +
| <code>CP_ANSI_1257 = 1257;</code>
 +
| Baltic
 +
|-
 +
| <code>CP_ANSI_1258 = 1258;</code>
 +
| Vietnam
 +
|-
 +
| <code>CP_ANSI_874 = 874;</code>
 +
| Thai
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Default locale''' <code> LOCALE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>LOCALE_SYSTEM_DEFAULT = $800;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>LOCALE_USER_DEFAULT = $400;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''String length maximum''' <code> MAX_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MAX_LEADBYTES = 12;</code>
 +
| 5 ranges, 2 bytes each, 0 terminated
 +
|-
 +
| <code>MAX_DEFAULTCHAR = 2;</code>
 +
| single or double byte
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''MBCS and Unicode translation flag''' <code> MB_*, WC_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MB_PRECOMPOSED = $00000001;</code>
 +
| use precomposed chars
 +
|-
 +
| <code>MB_COMPOSITE = $00000002;</code>
 +
| use composite chars
 +
|-
 +
| <code>MB_USEGLYPHCHARS = $00000004;</code>
 +
| use glyph chars, not ctrl chars
 +
|-
 +
| <code>MB_ERR_INVALID_CHARS = $00000008;</code>
 +
| error for invalid chars
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WC_COMPOSITECHECK = $00000200;</code>
 +
| Convert composite to precomposed
 +
|-
 +
| <code>WC_DISCARDNS = $00000010;</code>
 +
| discard non-spacing chars
 +
|-
 +
| <code>WC_SEPCHARS = $00000020;</code>
 +
| generate separate chars
 +
|-
 +
| <code>WC_DEFAULTCHAR = $00000040;</code>
 +
| replace w/default AnsiChar
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>WC_NO_BEST_FIT_CHARS = $00000400;</code>
 +
| do not use best fit chars
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Character type flag''' <code> CT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>CT_CTYPE1 = $00000001;</code>
 +
| ctype 1 information
 +
|-
 +
| <code>CT_CTYPE2 = $00000002;</code>
 +
| ctype 2 information
 +
|-
 +
| <code>CT_CTYPE3 = $00000004;</code>
 +
| ctype 3 information
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''CType 1 flag bit''' <code> C1_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>C1_UPPER = $0001;</code>
 +
| upper case
 +
|-
 +
| <code>C1_LOWER = $0002;</code>
 +
| lower case
 +
|-
 +
| <code>C1_DIGIT = $0004;</code>
 +
| decimal digits
 +
|-
 +
| <code>C1_SPACE = $0008;</code>
 +
| spacing characters
 +
|-
 +
| <code>C1_PUNCT = $0010;</code>
 +
| punctuation characters
 +
|-
 +
| <code>C1_CNTRL = $0020;</code>
 +
| control characters
 +
|-
 +
| <code>C1_BLANK = $0040;</code>
 +
| blank characters
 +
|-
 +
| <code>C1_XDIGIT = $0080;</code>
 +
| other digits
 +
|-
 +
| <code>C1_ALPHA = $0100;</code>
 +
| any linguistic character
 +
|-
 +
| <code>C1_DEFINED = $0200;</code>
 +
|defined character
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''CType 2 flag bit''' <code> C2_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>C2_LEFTTORIGHT = $0001;</code>
 +
| left to right
 +
|-
 +
| <code>C2_RIGHTTOLEFT = $0002;</code>
 +
| right to left
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>C2_EUROPENUMBER = $0003;</code>
 +
| European number, digit
 +
|-
 +
| <code>C2_EUROPESEPARATOR = $0004;</code>
 +
| European numeric separator
 +
|-
 +
| <code>C2_EUROPETERMINATOR = $0005;</code>
 +
| European numeric terminator
 +
|-
 +
| <code>C2_ARABICNUMBER = $0006;</code>
 +
| Arabic number
 +
|-
 +
| <code>C2_COMMONSEPARATOR  = $0007;</code>
 +
| common numeric separator
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>C2_BLOCKSEPARATOR = $0008;</code>
 +
| block separator
 +
|-
 +
| <code>C2_SEGMENTSEPARATOR = $0009;</code>
 +
| segment separator
 +
|-
 +
| <code>C2_WHITESPACE = $000A;</code>
 +
| white space
 +
|-
 +
| <code>C2_OTHERNEUTRAL = $000B;</code>
 +
| other neutrals
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>C2_NOTAPPLICABLE = $0000;</code>
 +
| no implicit directionality
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''CType 3 flag bit''' <code> C3_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>C3_NONSPACING = $0001;</code>
 +
| nonspacing character
 +
|-
 +
| <code>C3_DIACRITIC = $0002;</code>
 +
| diacritic mark
 +
|-
 +
| <code>C3_VOWELMARK = $0004;</code>
 +
| vowel mark
 +
|-
 +
| <code>C3_SYMBOL = $0008;</code>
 +
| symbols
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>C3_KATAKANA = $0010;</code>
 +
| katakana character
 +
|-
 +
| <code>C3_HIRAGANA = $0020;</code>
 +
| hiragana character
 +
|-
 +
| <code>C3_HALFWIDTH = $0040;</code>
 +
| half width character
 +
|-
 +
| <code>C3_FULLWIDTH = $0080;</code>
 +
| full width character
 +
|-
 +
| <code>C3_IDEOGRAPH = $0100;</code>
 +
| ideographic character
 +
|-
 +
| <code>C3_KASHIDA = $0200;</code>
 +
| Arabic kashida character
 +
|-
 +
| <code>C3_LEXICAL = $0400;</code>
 +
| lexical character
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>C3_ALPHA = $8000;</code>
 +
| any linguistic AnsiChar (C1_ALPHA)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>C3_NOTAPPLICABLE = $0000;</code>
 +
| ctype 3 is not applicable
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''String flag''' <code> NORM_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>NORM_IGNORECASE = $00000001;</code>
 +
| ignore case
 +
|-
 +
| <code>NORM_IGNORENONSPACE = $00000002;</code>
 +
| ignore nonspacing chars
 +
|-
 +
| <code>NORM_IGNORESYMBOLS = $00000004;</code>
 +
| ignore symbols
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>NORM_IGNOREKANATYPE = $00010000;</code>
 +
| ignore kanatype
 +
|-
 +
| <code>NORM_IGNOREWIDTH = $00020000;</code>
 +
| ignore width
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Locale independent mapping flag''' <code> MAP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MAP_FOLDCZONE = $00000010;</code>
 +
| fold compatibility zone chars
 +
|-
 +
| <code>MAP_PRECOMPOSED = $00000020;</code>
 +
| convert to precomposed chars
 +
|-
 +
| <code>MAP_COMPOSITE = $00000040;</code>
 +
| convert to composite chars
 +
|-
 +
| <code>MAP_FOLDDIGITS = $00000080;</code>
 +
| all digits to ASCII 0-9
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>MAP_EXPAND_LIGATURES = $00002000;</code>
 +
| expand all ligatures
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Locale dependent mapping flag''' <code> LCMAP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>LCMAP_LOWERCASE = $00000100;</code>
 +
| lower case letters
 +
|-
 +
| <code>LCMAP_UPPERCASE = $00000200;</code>
 +
| upper case letters
 +
|-
 +
| <code>LCMAP_SORTKEY = $00000400;</code>
 +
| WC sort key (normalize)
 +
|-
 +
| <code>LCMAP_BYTEREV = $00000800;</code>
 +
| byte reversal
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>LCMAP_HIRAGANA = $00100000;</code>
 +
| map katakana to hiragana
 +
|-
 +
| <code>LCMAP_KATAKANA = $00200000;</code>
 +
| map hiragana to katakana
 +
|-
 +
| <code>LCMAP_HALFWIDTH = $00400000;</code>
 +
| map double byte to single byte
 +
|-
 +
| <code>LCMAP_FULLWIDTH = $00800000;</code>
 +
| map single byte to double byte
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>LCMAP_LINGUISTIC_CASING = $01000000;</code>
 +
| use linguistic rules for casing
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>LCMAP_SIMPLIFIED_CHINESE  = $02000000;</code>
 +
| map traditional chinese to simplified chinese
 +
|-
 +
| <code>LCMAP_TRADITIONAL_CHINESE = $04000000;</code>
 +
| map simplified chinese to traditional chinese
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Language group enumeration flag''' <code> LGRPID_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>LGRPID_INSTALLED = $00000001;</code>
 +
| installed language group ids
 +
|-
 +
| <code>LGRPID_SUPPORTED = $00000002;</code>
 +
| supported language group ids
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Locale enumeration flag''' <code> LCID_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>LCID_INSTALLED = $00000001;</code>
 +
| installed locale ids
 +
|-
 +
| <code>LCID_SUPPORTED = $00000002;</code>
 +
| supported locale ids
 +
|-
 +
| <code>LCID_ALTERNATE_SORTS = $00000004;</code>
 +
| alternate sort locale ids
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Code page enumeration flag''' <code> CP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>CP_INSTALLED = $00000001;</code>
 +
| installed code page ids
 +
|-
 +
| <code>CP_SUPPORTED = $00000002;</code>
 +
| supported code page ids
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Sorting flag''' <code> SORT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SORT_STRINGSORT = $00001000;</code>
 +
| use string sort method
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Compare string return value''' <code> CSTR_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>CSTR_LESS_THAN = 1;</code>
 +
| string 1 less than string 2
 +
|-
 +
| <code>CSTR_EQUAL = 2;</code>
 +
| string 1 equal to string 2
 +
|-
 +
| <code>CSTR_GREATER_THAN = 3;</code>
 +
| string 1 greater than string 2
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Country/Region code''' <code> CTRY_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>CTRY_DEFAULT = 0;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>CTRY_ALBANIA = 355;</code>
 +
| Albania
 +
|-
 +
| <code>CTRY_ALGERIA = 213;</code>
 +
| Algeria
 +
|-
 +
| <code>CTRY_ARGENTINA = 54;</code>
 +
| Argentina
 +
|-
 +
| <code>CTRY_ARMENIA = 374;</code>
 +
| Armenia
 +
|-
 +
| <code>CTRY_AUSTRALIA = 61;</code>
 +
| Australia
 +
|-
 +
| <code>CTRY_AUSTRIA = 43;</code>
 +
| Austria
 +
|-
 +
| <code>CTRY_AZERBAIJAN = 994;</code>
 +
| Azerbaijan
 +
|-
 +
| <code>CTRY_BAHRAIN = 973;</code>
 +
| Bahrain
 +
|-
 +
| <code>CTRY_BELARUS = 375;</code>
 +
| Belarus
 +
|-
 +
| <code>CTRY_BELGIUM = 32;</code>
 +
| Belgium
 +
|-
 +
| <code>CTRY_BELIZE = 501;</code>
 +
| Belize
 +
|-
 +
| <code>CTRY_BOLIVIA = 591;</code>
 +
| Bolivia
 +
|-
 +
| <code>CTRY_BRAZIL = 55;</code>
 +
| Brazil
 +
|-
 +
| <code>CTRY_BRUNEI_DARUSSALAM = 673;</code>
 +
| Brunei Darussalam
 +
|-
 +
| <code>CTRY_BULGARIA = 359;</code>
 +
| Bulgaria
 +
|-
 +
| <code>CTRY_CANADA = 2;</code>
 +
| Canada
 +
|-
 +
| <code>CTRY_CARIBBEAN = 1;</code>
 +
| Caribbean
 +
|-
 +
| <code>CTRY_CHILE = 56;</code>
 +
| Chile
 +
|-
 +
| <code>CTRY_COLOMBIA = 57;</code>
 +
| Colombia
 +
|-
 +
| <code>CTRY_COSTA_RICA = 506;</code>
 +
| Costa Rica
 +
|-
 +
| <code>CTRY_CROATIA = 385;</code>
 +
| Croatia
 +
|-
 +
| <code>CTRY_CZECH = 420;</code>
 +
| Czech Republic
 +
|-
 +
| <code>CTRY_DENMARK = 45;</code>
 +
| Denmark
 +
|-
 +
| <code>CTRY_DOMINICAN_REPUBLIC = 1;</code>
 +
| Dominican Republic
 +
|-
 +
| <code>CTRY_ECUADOR = 593;</code>
 +
| Ecuador
 +
|-
 +
| <code>CTRY_EGYPT = 20;</code>
 +
| Egypt
 +
|-
 +
| <code>CTRY_EL_SALVADOR = 503;</code>
 +
| El Salvador
 +
|-
 +
| <code>CTRY_ESTONIA = 372;</code>
 +
| Estonia
 +
|-
 +
| <code>CTRY_FAEROE_ISLANDS = 298;</code>
 +
| Faeroe Islands
 +
|-
 +
| <code>CTRY_FINLAND = 358;</code>
 +
| Finland
 +
|-
 +
| <code>CTRY_FRANCE = 33;</code>
 +
| France
 +
|-
 +
| <code>CTRY_GEORGIA = 995;</code>
 +
| Georgia
 +
|-
 +
| <code>CTRY_GERMANY = 49;</code>
 +
| Germany
 +
|-
 +
| <code>CTRY_GREECE = 30;</code>
 +
| Greece
 +
|-
 +
| <code>CTRY_GUATEMALA = 502;</code>
 +
| Guatemala
 +
|-
 +
| <code>CTRY_HONDURAS = 504;</code>
 +
| Honduras
 +
|-
 +
| <code>CTRY_HONG_KONG = 852;</code>
 +
| Hong Kong S.A.R., P.R.C.
 +
|-
 +
| <code>CTRY_HUNGARY = 36;</code>
 +
| Hungary
 +
|-
 +
| <code>CTRY_ICELAND = 354;</code>
 +
| Iceland
 +
|-
 +
| <code>CTRY_INDIA = 91;</code>
 +
| India
 +
|-
 +
| <code>CTRY_INDONESIA = 62;</code>
 +
| Indonesia
 +
|-
 +
| <code>CTRY_IRAN = 981;</code>
 +
| Iran
 +
|-
 +
| <code>CTRY_IRAQ = 964;</code>
 +
| Iraq
 +
|-
 +
| <code>CTRY_IRELAND = 353;</code>
 +
| Ireland
 +
|-
 +
| <code>CTRY_ISRAEL = 972;</code>
 +
| Israel
 +
|-
 +
| <code>CTRY_ITALY = 39;</code>
 +
| Italy
 +
|-
 +
| <code>CTRY_JAMAICA = 1;</code>
 +
| Jamaica
 +
|-
 +
| <code>CTRY_JAPAN = 81;</code>
 +
| Japan
 +
|-
 +
| <code>CTRY_JORDAN = 962;</code>
 +
| Jordan
 +
|-
 +
| <code>CTRY_KAZAKSTAN = 7;</code>
 +
| Kazakstan
 +
|-
 +
| <code>CTRY_KENYA = 254;</code>
 +
| Kenya
 +
|-
 +
| <code>CTRY_KUWAIT = 965;</code>
 +
| Kuwait
 +
|-
 +
| <code>CTRY_KYRGYZSTAN = 996;</code>
 +
| Kyrgyzstan
 +
|-
 +
| <code>CTRY_LATVIA = 371;</code>
 +
| Latvia
 +
|-
 +
| <code>CTRY_LEBANON = 961;</code>
 +
| Lebanon
 +
|-
 +
| <code>CTRY_LIBYA = 218;</code>
 +
| Libya
 +
|-
 +
| <code>CTRY_LIECHTENSTEIN = 41;</code>
 +
| Liechtenstein
 +
|-
 +
| <code>CTRY_LITHUANIA = 370;</code>
 +
| Lithuania
 +
|-
 +
| <code>CTRY_LUXEMBOURG = 352;</code>
 +
| Luxembourg
 +
|-
 +
| <code>CTRY_MACAU = 853;</code>
 +
| Macau S.A.R., PRC
 +
|-
 +
| <code>CTRY_MACEDONIA = 389;</code>
 +
| Former Yugoslav Republic of Macedonia
 +
|-
 +
| <code>CTRY_MALAYSIA = 60;</code>
 +
| Malaysia
 +
|-
 +
| <code>CTRY_MALDIVES = 960;</code>
 +
| Maldives
 +
|-
 +
| <code>CTRY_MEXICO = 52;</code>
 +
| Mexico
 +
|-
 +
| <code>CTRY_MONACO = 33;</code>
 +
| Principality of Monaco
 +
|-
 +
| <code>CTRY_MONGOLIA = 976;</code>
 +
| Mongolia
 +
|-
 +
| <code>CTRY_MOROCCO = 212;</code>
 +
| Morocco
 +
|-
 +
| <code>CTRY_NETHERLANDS = 31;</code>
 +
| Netherlands
 +
|-
 +
| <code>CTRY_NEW_ZEALAND = 64;</code>
 +
| New Zealand
 +
|-
 +
| <code>CTRY_NICARAGUA = 505;</code>
 +
| Nicaragua
 +
|-
 +
| <code>CTRY_NORWAY = 47;</code>
 +
| Norway
 +
|-
 +
| <code>CTRY_OMAN = 968;</code>
 +
| Oman
 +
|-
 +
| <code>CTRY_PAKISTAN = 92;</code>
 +
| Islamic Republic of Pakistan
 +
|-
 +
| <code>CTRY_PANAMA = 507;</code>
 +
| Panama
 +
|-
 +
| <code>CTRY_PARAGUAY = 595;</code>
 +
| Paraguay
 +
|-
 +
| <code>CTRY_PERU = 51;</code>
 +
| Peru
 +
|-
 +
| <code>CTRY_PHILIPPINES = 63;</code>
 +
| Republic of the Philippines
 +
|-
 +
| <code>CTRY_POLAND = 48;</code>
 +
| Poland
 +
|-
 +
| <code>CTRY_PORTUGAL = 351;</code>
 +
| Portugal
 +
|-
 +
| <code>CTRY_PRCHINA = 86;</code>
 +
| People's Republic of China
 +
|-
 +
| <code>CTRY_PUERTO_RICO = 1;</code>
 +
| Puerto Rico
 +
|-
 +
| <code>CTRY_QATAR = 974;</code>
 +
| Qatar
 +
|-
 +
| <code>CTRY_ROMANIA = 40;</code>
 +
| Romania
 +
|-
 +
| <code>CTRY_RUSSIA = 7;</code>
 +
| Russia
 +
|-
 +
| <code>CTRY_SAUDI_ARABIA = 966;</code>
 +
| Saudi Arabia
 +
|-
 +
| <code>CTRY_SERBIA = 381;</code>
 +
| Serbia
 +
|-
 +
| <code>CTRY_SINGAPORE = 65;</code>
 +
| Singapore
 +
|-
 +
| <code>CTRY_SLOVAK = 421;</code>
 +
| Slovak Republic
 +
|-
 +
| <code>CTRY_SLOVENIA = 386;</code>
 +
| Slovenia
 +
|-
 +
| <code>CTRY_SOUTH_AFRICA = 27;</code>
 +
| South Africa
 +
|-
 +
| <code>CTRY_SOUTH_KOREA = 82;</code>
 +
| Korea
 +
|-
 +
| <code>CTRY_SPAIN = 34;</code>
 +
| Spain
 +
|-
 +
| <code>CTRY_SWEDEN = 46;</code>
 +
| Sweden
 +
|-
 +
| <code>CTRY_SWITZERLAND = 41;</code>
 +
| Switzerland
 +
|-
 +
| <code>CTRY_SYRIA = 963;</code>
 +
| Syria
 +
|-
 +
| <code>CTRY_TAIWAN = 886;</code>
 +
| Taiwan
 +
|-
 +
| <code>CTRY_TATARSTAN = 7;</code>
 +
| Tatarstan
 +
|-
 +
| <code>CTRY_THAILAND = 66;</code>
 +
| Thailand
 +
|-
 +
| <code>CTRY_TRINIDAD_Y_TOBAGO = 1;</code>
 +
| Trinidad y Tobago
 +
|-
 +
| <code>CTRY_TUNISIA = 216;</code>
 +
| Tunisia
 +
|-
 +
| <code>CTRY_TURKEY = 90;</code>
 +
| Turkey
 +
|-
 +
| <code>CTRY_UAE = 971;</code>
 +
| U.A.E.
 +
|-
 +
| <code>CTRY_UKRAINE = 380;</code>
 +
| Ukraine
 +
|-
 +
| <code>CTRY_UNITED_KINGDOM = 44;</code>
 +
| United Kingdom
 +
|-
 +
| <code>CTRY_UNITED_STATES = 1;</code>
 +
| United States
 +
|-
 +
| <code>CTRY_URUGUAY = 598;</code>
 +
| Uruguay
 +
|-
 +
| <code>CTRY_UZBEKISTAN = 7;</code>
 +
| Uzbekistan
 +
|-
 +
| <code>CTRY_VENEZUELA = 58;</code>
 +
| Venezuela
 +
|-
 +
| <code>CTRY_VIET_NAM = 84;</code>
 +
| Viet Nam
 +
|-
 +
| <code>CTRY_YEMEN = 967;</code>
 +
| Yemen
 +
|-
 +
| <code>CTRY_ZIMBABWE = 263;</code>
 +
| Zimbabwe
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Primary language Id value''' <code> LANG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>LANG_NEUTRAL = $00;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>LANG_ENGLISH = $09;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Sublanguage Id value''' <code> SUBLANG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SUBLANG_NEUTRAL = $00;</code>
 +
| language neutral
 +
|-
 +
| <code>SUBLANG_DEFAULT = $01;</code>
 +
| user default
 +
|-
 +
| <code>SUBLANG_SYS_DEFAULT = $02;</code>
 +
| system default
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>SUBLANG_ENGLISH_US = $01;</code>
 +
| English (USA)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''Locale Id'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>LCID = DWORD;</code>
 +
| style="width: 40%;"|
 +
|-
 +
| <code>PLCID = ^LCID;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Language Id'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>LANGID = Word;</code>
 +
| style="width: 40%;"|
 +
|-
 +
| <code>PLANGID = ^LANGID;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Language group Id'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>LGRPID = DWORD;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Locale type'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>LCTYPE = DWORD;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Calendar type'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>CALTYPE = DWORD;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''Calendar Id'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>CALID = DWORD;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''CP information'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>CPINFO = _cpinfo;</code>
 +
 
 +
<code>TCpInfo = CPINFO;</code>
 +
 
 +
<code>PCpInfo = LPCPINFO;</code>
 +
 
 +
<code>LPCPINFO = ^CPINFO;</code>
 +
 
 +
<code>_cpinfo = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MaxCharSize: UINT;</code>
 +
| max length (in bytes) of a AnsiChar
 +
|-
 +
| <code>DefaultChar: array [0..MAX_DEFAULTCHAR - 1] of BYTE;</code>
 +
| default character
 +
|-
 +
| <code>LeadByte: array [0..MAX_LEADBYTES - 1] of BYTE;</code>
 +
| lead byte ranges
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''CP info extended'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>CPINFOEX = _cpinfoex;</code>
 +
 
 +
<code>TCpInfoEx = CPINFOEX;</code>
 +
 
 +
<code>PCpInfoEx = LPCPINFOEX;</code>
 +
 
 +
<code>LPCPINFOEX = ^CPINFOEX;</code>
 +
 
 +
<code>_cpinfoex = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MaxCharSize: UINT;</code>
 +
| max length (in bytes) of a AnsiChar
 +
|-
 +
| <code>DefaultChar: array [0..MAX_DEFAULTCHAR - 1] of BYTE;</code>
 +
| default character (MB)
 +
|-
 +
| <code>LeadByte: array [0..MAX_LEADBYTES - 1] of BYTE;</code>
 +
| lead byte ranges
 +
|-
 +
| <code>UnicodeDefaultChar: WCHAR;</code>
 +
| default character (Unicode)
 +
|-
 +
| <code>CodePage: UINT;</code>
 +
| code page Id
 +
|-
 +
| <code>CodePageName: array [0..MAX_PATH - 1] of AnsiChar;</code>
 +
| code page name (Ansi)
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''Code table'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PCodeTable = ^TCodeTable;</code>
 +
 
 +
<code>TCodeTable = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Code Table - The OEM/ANSI to UNICODE Values of a Code Page
 +
|-
 +
| <code>MaxCharSize:UINT;</code>
 +
| Max Length (Bytes) of a Char
 +
|-
 +
| <code>DefaultChar:array[0..MAX_DEFAULTCHAR - 1] of Byte;</code>
 +
| Default Character
 +
|-
 +
| <code>LeadByte:array[0..MAX_LEADBYTES - 1] of Byte;</code>
 +
| Lead Byte Ranges
 +
|-
 +
| <code>Values:array[$00..$FF] of Word;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''Translation table'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PTransTable = ^TTransTable;</code>
 +
 
 +
<code>TTransTable = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Trans Table - The OEM/ANSI to ANSI/OEM Values of a Code Page
 +
|-
 +
| <code>TransID:Word;</code>
 +
| Translate Code Page
 +
|-
 +
| <code>Values:array[$00..$FF] of Word;</code>
 +
| Word to allow for DBCS
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''Lowercase table'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PLowerTable = ^TLowerTable;</code>
 +
 
 +
<code>TLowerTable = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Lower Table - Upper to Lower case values of a Code Page
 +
|-
 +
| <code>LowerID:Word;</code>
 +
| Lowercase Code Page
 +
|-
 +
| <code>Values:array[$00..$FF] of Word;</code>
 +
| Word to allow for DBCS
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''Uppercase table'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUpperTable = ^TUpperTable;</code>
 +
 
 +
<code>TUpperTable = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Upper Table - Lower to Upper case values of a Code Page
 +
|-
 +
| <code>UpperID:Word;</code>
 +
| Uppercase Code Page
 +
|-
 +
| <code>Values:array[$00..$FF] of Word;</code>
 +
| Word to allow for DBCS
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Unicode table'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUnicodeTable = ^TUnicodeTable;</code>
 +
 
 +
<code>TUnicodeTable = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Unicode Table - The UNICODE to OEM/ANSI Values of a Code Page
 +
|-
 +
| <code>Values:array[$0000..$FFFF] of Word;</code>
 +
| Word to allow for DBCS
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''Lead bytes'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PLeadBytes = ^TLeadBytes;</code>
 +
 
 +
<code>TLeadBytes = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Lead Bytes - The extended Page Tables for DBCS Pages
 +
|-
 +
| <code>Tables:array[$00..$FF] of PCodeTable;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Code page'''
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PCodePage = ^TCodePage;</code>
 +
 
 +
<code>TCodePage = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Each Code Table provides the OEM to UNICODE Values. To convert back use the main Unicode Table in the Code Page which was populated when the Code Page was loaded.
 +
|-
 +
|colspan="2"|Note: Code Page - The actual information for an OEM/ANSI Code Page
 +
|-
 +
| <code>PageID:Word;</code>
 +
| Code Page ID (eg 437 or 1252)
 +
|-
 +
| <code>Handle:THandle;</code>
 +
| Handle of Code Page Module
 +
|-
 +
| <code>CodeTable:PCodeTable;</code>
 +
| The OEM/ANSI Values
 +
|-
 +
| <code>LeadBytes:PLeadBytes;</code>
 +
| The Lead Byte Tables
 +
|-
 +
| <code>TransTable:PTransTable;</code>
 +
| The OEM <-> ANSI Values
 +
|-
 +
| <code>LowerTable:PLowerTable;</code>
 +
| The Upper to Lower Values
 +
|-
 +
| <code>UpperTable:PUpperTable;</code>
 +
| The Lower to Upper Values
 +
|-
 +
| <code>UnicodeTable:PUnicodeTable;</code>
 +
| The UNICODE Values
 +
|-
 +
| <code>PrevPage:PCodePage;</code>
 +
| Prev Code Page
 +
|-
 +
| <code>NextPage:PCodePage;</code>
 +
| Next Code Page
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''Locale specific variables'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>OemPage:PCodePage;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>AnsiPage:PCodePage;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>DefaultPage:PCodePage;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>CodePageLock:TPlatformLock;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure LocaleInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''Locale functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function IsValidCodePage(CodePage:UINT):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetACP:UINT;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetOEMCP:UINT;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function SetACP(CodePage:UINT):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function SetOEMCP(CodePage:UINT):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetConsoleCP:UINT;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function SetConsoleCP(wCodePageID:UINT):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetConsoleOutputCP:UINT;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function SetConsoleOutputCP(wCodePageID:UINT):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetCPInfo(CodePage:UINT; var lpCPInfo:TCPInfo):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetCPInfoEx(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetCPInfoExA(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetCPInfoExW(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXW):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function IsValidLocale(Locale:LCID; dwFlags:DWORD):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetSystemDefaultLCID:LCID;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetUserDefaultLCID:LCID;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function SetSystemDefaultLCID(Locale:LCID):BOOL;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetSystemDefaultLangID: LANGID;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the System Default Language Identifier (Combined Primary and Sub language Identifiers)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| System and User values are the same for Ultibo
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetUserDefaultLangID: LANGID;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the System Default Language Identifier (Combined Primary and Sub language Identifiers)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| System and User values are the same for Ultibo
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''RTL unicode string manager functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function SysGetStandardCodePage(const stdcp:TStandardCodePageEnum):TSystemCodePage;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''Locale helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function MapPage(CodePage:UINT):Word;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Map a default code page to the actual current page</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function GetPage(PageID:Word):PCodePage;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the requested page in the linked list</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CheckPage(Page:PCodePage):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check that the Page supplied is part of the Linked list</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function LinkPage(Page:PCodePage):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Link Page to Prev,Next Siblings and Adjust First/Last</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function UnlinkPage(Page:PCodePage):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unlink Page from Prev,Next Siblings and Adjust First/Last</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function LoadPage(PageID:Word; Table:PCodeTable; Lower:PLowerTable; Upper:PUpperTable):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Load a code table and allocate memory to create a code page</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function UnloadPage(PageID:Word; Page:PCodePage):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unload a code page and release allocated memory</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function DefaultTrans(PageID,TransID:Word):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function InstallTrans(PageID:Word; Table:PTransTable):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 04:37, 31 August 2021

Return to Unit Reference


Description


Ultibo Locale Interface unit

This unit implements the locale support for Ultibo and provides the code page support for the WideStringManager/UnicodeStringManager interface for the RTL.

This unit provides compatible implementations of the following functions:

  • ConvertDefaultLocale
  • EnumCodePagesProc
  • EnumLocalesProc
  • EnumTimeFormats
  • GetCPInfo
  • GetNumberFormat
  • GetSystemDefaultLangID
  • GetUserDefaultLangID
  • IsValidLocale
  • GetConsoleOutputCP
  • EnumCalendarInfo
  • EnumDateFormats
  • EnumSystemCodePages
  • EnumTimeFormatsProc
  • GetCurrencyFormat
  • GetLocaleInfo
  • GetSystemDefaultLCID
  • GetUserDefaultLCID
  • SetLocaleInfo
  • SetConsoleCP
  • EnumCalendarInfoProc
  • EnumDateFormatsProc
  • EnumSystemLocales
  • GetACP
  • GetDateFormat
  • GetOEMCP
  • GetTimeFormat
  • IsValidCodePage
  • GetConsoleCP
  • SetConsoleOutputCP


The following functions are implemented by the Threads unit:

  • GetThreadLocale (ThreadGetLocale) (GetThreadLocale is exposed in the Ultibo unit)
  • SetThreadLocale (ThreadSetLocale) (SetThreadLocale is exposed in the Ultibo unit)

Most of the above are currently not implemented.


OEM Code Page defaults to 437 (OEM United States)

ANSI Code Page defaults to 1252 (ANSI Latin 1; Western European (Windows))


See also: https://msdn.microsoft.com/en-us/library/windows/desktop/dd319081%28v=vs.85%29.aspx

Constants



Default code page CP_*
Most of these are defined in System (see: \source\rtl\inc\systemh.inc)
 
CP_ACP = 0; Default to ANSI code page
CP_OEMCP = 1; Default to OEM code page
CP_MACCP = 2; Default to MAC code page
CP_THREAD_ACP = 3; Current thread's ANSI code page
CP_SYMBOL = 42; SYMBOL translations
CP_UTF16 = 1200; UTF-16 translation
CP_UNICODE = 1200; Unicode translation
CP_UTF16_BE = 1201; UTF-16 (unicodeFFFE) translation
CP_UTF7 = 65000; UTF-7 translation
CP_UTF8 = 65001; UTF-8 translation


Code page identifier CP_OEM_*, CP_ANSI_*
See: https://en.wikipedia.org/wiki/Code_page)
 
CP_OEM_437 = 437; US
CP_OEM_720 = 720; Arabic
CP_OEM_737 = 737; Greek
CP_OEM_775 = 775; Baltic
CP_OEM_850 = 850; Latin I
CP_OEM_852 = 852; Latin II
CP_OEM_857 = 857; Turkish
CP_OEM_862 = 862; Hebrew
CP_OEM_866 = 866; Russian
CP_OEM_874 = 874; Thai
CP_OEM_1258 = 1258; Vietnam
 
CP_ANSI_1250 = 1250; Central Europe
CP_ANSI_1251 = 1251; Cyrillic
CP_ANSI_1252 = 1252; Latin I
CP_ANSI_1253 = 1253; Greek
CP_ANSI_1254 = 1254; Turkish
CP_ANSI_1255 = 1255; Hebrew
CP_ANSI_1256 = 1256; Arabic
CP_ANSI_1257 = 1257; Baltic
CP_ANSI_1258 = 1258; Vietnam
CP_ANSI_874 = 874; Thai


Default locale LOCALE_*
LOCALE_SYSTEM_DEFAULT = $800;  
LOCALE_USER_DEFAULT = $400;  


String length maximum MAX_*
MAX_LEADBYTES = 12; 5 ranges, 2 bytes each, 0 terminated
MAX_DEFAULTCHAR = 2; single or double byte


MBCS and Unicode translation flag MB_*, WC_*
MB_PRECOMPOSED = $00000001; use precomposed chars
MB_COMPOSITE = $00000002; use composite chars
MB_USEGLYPHCHARS = $00000004; use glyph chars, not ctrl chars
MB_ERR_INVALID_CHARS = $00000008; error for invalid chars
 
WC_COMPOSITECHECK = $00000200; Convert composite to precomposed
WC_DISCARDNS = $00000010; discard non-spacing chars
WC_SEPCHARS = $00000020; generate separate chars
WC_DEFAULTCHAR = $00000040; replace w/default AnsiChar
 
WC_NO_BEST_FIT_CHARS = $00000400; do not use best fit chars


Character type flag CT_*
CT_CTYPE1 = $00000001; ctype 1 information
CT_CTYPE2 = $00000002; ctype 2 information
CT_CTYPE3 = $00000004; ctype 3 information


CType 1 flag bit C1_*
C1_UPPER = $0001; upper case
C1_LOWER = $0002; lower case
C1_DIGIT = $0004; decimal digits
C1_SPACE = $0008; spacing characters
C1_PUNCT = $0010; punctuation characters
C1_CNTRL = $0020; control characters
C1_BLANK = $0040; blank characters
C1_XDIGIT = $0080; other digits
C1_ALPHA = $0100; any linguistic character
C1_DEFINED = $0200; defined character


CType 2 flag bit C2_*
C2_LEFTTORIGHT = $0001; left to right
C2_RIGHTTOLEFT = $0002; right to left
 
C2_EUROPENUMBER = $0003; European number, digit
C2_EUROPESEPARATOR = $0004; European numeric separator
C2_EUROPETERMINATOR = $0005; European numeric terminator
C2_ARABICNUMBER = $0006; Arabic number
C2_COMMONSEPARATOR = $0007; common numeric separator
 
C2_BLOCKSEPARATOR = $0008; block separator
C2_SEGMENTSEPARATOR = $0009; segment separator
C2_WHITESPACE = $000A; white space
C2_OTHERNEUTRAL = $000B; other neutrals
 
C2_NOTAPPLICABLE = $0000; no implicit directionality


CType 3 flag bit C3_*
C3_NONSPACING = $0001; nonspacing character
C3_DIACRITIC = $0002; diacritic mark
C3_VOWELMARK = $0004; vowel mark
C3_SYMBOL = $0008; symbols
 
C3_KATAKANA = $0010; katakana character
C3_HIRAGANA = $0020; hiragana character
C3_HALFWIDTH = $0040; half width character
C3_FULLWIDTH = $0080; full width character
C3_IDEOGRAPH = $0100; ideographic character
C3_KASHIDA = $0200; Arabic kashida character
C3_LEXICAL = $0400; lexical character
 
C3_ALPHA = $8000; any linguistic AnsiChar (C1_ALPHA)
 
C3_NOTAPPLICABLE = $0000; ctype 3 is not applicable


String flag NORM_*
NORM_IGNORECASE = $00000001; ignore case
NORM_IGNORENONSPACE = $00000002; ignore nonspacing chars
NORM_IGNORESYMBOLS = $00000004; ignore symbols
 
NORM_IGNOREKANATYPE = $00010000; ignore kanatype
NORM_IGNOREWIDTH = $00020000; ignore width


Locale independent mapping flag MAP_*
MAP_FOLDCZONE = $00000010; fold compatibility zone chars
MAP_PRECOMPOSED = $00000020; convert to precomposed chars
MAP_COMPOSITE = $00000040; convert to composite chars
MAP_FOLDDIGITS = $00000080; all digits to ASCII 0-9
 
MAP_EXPAND_LIGATURES = $00002000; expand all ligatures


Locale dependent mapping flag LCMAP_*
LCMAP_LOWERCASE = $00000100; lower case letters
LCMAP_UPPERCASE = $00000200; upper case letters
LCMAP_SORTKEY = $00000400; WC sort key (normalize)
LCMAP_BYTEREV = $00000800; byte reversal
 
LCMAP_HIRAGANA = $00100000; map katakana to hiragana
LCMAP_KATAKANA = $00200000; map hiragana to katakana
LCMAP_HALFWIDTH = $00400000; map double byte to single byte
LCMAP_FULLWIDTH = $00800000; map single byte to double byte
 
LCMAP_LINGUISTIC_CASING = $01000000; use linguistic rules for casing
 
LCMAP_SIMPLIFIED_CHINESE = $02000000; map traditional chinese to simplified chinese
LCMAP_TRADITIONAL_CHINESE = $04000000; map simplified chinese to traditional chinese


Language group enumeration flag LGRPID_*
LGRPID_INSTALLED = $00000001; installed language group ids
LGRPID_SUPPORTED = $00000002; supported language group ids


Locale enumeration flag LCID_*
LCID_INSTALLED = $00000001; installed locale ids
LCID_SUPPORTED = $00000002; supported locale ids
LCID_ALTERNATE_SORTS = $00000004; alternate sort locale ids


Code page enumeration flag CP_*
CP_INSTALLED = $00000001; installed code page ids
CP_SUPPORTED = $00000002; supported code page ids


Sorting flag SORT_*
SORT_STRINGSORT = $00001000; use string sort method


Compare string return value CSTR_*
CSTR_LESS_THAN = 1; string 1 less than string 2
CSTR_EQUAL = 2; string 1 equal to string 2
CSTR_GREATER_THAN = 3; string 1 greater than string 2


Country/Region code CTRY_*
CTRY_DEFAULT = 0;  
 
CTRY_ALBANIA = 355; Albania
CTRY_ALGERIA = 213; Algeria
CTRY_ARGENTINA = 54; Argentina
CTRY_ARMENIA = 374; Armenia
CTRY_AUSTRALIA = 61; Australia
CTRY_AUSTRIA = 43; Austria
CTRY_AZERBAIJAN = 994; Azerbaijan
CTRY_BAHRAIN = 973; Bahrain
CTRY_BELARUS = 375; Belarus
CTRY_BELGIUM = 32; Belgium
CTRY_BELIZE = 501; Belize
CTRY_BOLIVIA = 591; Bolivia
CTRY_BRAZIL = 55; Brazil
CTRY_BRUNEI_DARUSSALAM = 673; Brunei Darussalam
CTRY_BULGARIA = 359; Bulgaria
CTRY_CANADA = 2; Canada
CTRY_CARIBBEAN = 1; Caribbean
CTRY_CHILE = 56; Chile
CTRY_COLOMBIA = 57; Colombia
CTRY_COSTA_RICA = 506; Costa Rica
CTRY_CROATIA = 385; Croatia
CTRY_CZECH = 420; Czech Republic
CTRY_DENMARK = 45; Denmark
CTRY_DOMINICAN_REPUBLIC = 1; Dominican Republic
CTRY_ECUADOR = 593; Ecuador
CTRY_EGYPT = 20; Egypt
CTRY_EL_SALVADOR = 503; El Salvador
CTRY_ESTONIA = 372; Estonia
CTRY_FAEROE_ISLANDS = 298; Faeroe Islands
CTRY_FINLAND = 358; Finland
CTRY_FRANCE = 33; France
CTRY_GEORGIA = 995; Georgia
CTRY_GERMANY = 49; Germany
CTRY_GREECE = 30; Greece
CTRY_GUATEMALA = 502; Guatemala
CTRY_HONDURAS = 504; Honduras
CTRY_HONG_KONG = 852; Hong Kong S.A.R., P.R.C.
CTRY_HUNGARY = 36; Hungary
CTRY_ICELAND = 354; Iceland
CTRY_INDIA = 91; India
CTRY_INDONESIA = 62; Indonesia
CTRY_IRAN = 981; Iran
CTRY_IRAQ = 964; Iraq
CTRY_IRELAND = 353; Ireland
CTRY_ISRAEL = 972; Israel
CTRY_ITALY = 39; Italy
CTRY_JAMAICA = 1; Jamaica
CTRY_JAPAN = 81; Japan
CTRY_JORDAN = 962; Jordan
CTRY_KAZAKSTAN = 7; Kazakstan
CTRY_KENYA = 254; Kenya
CTRY_KUWAIT = 965; Kuwait
CTRY_KYRGYZSTAN = 996; Kyrgyzstan
CTRY_LATVIA = 371; Latvia
CTRY_LEBANON = 961; Lebanon
CTRY_LIBYA = 218; Libya
CTRY_LIECHTENSTEIN = 41; Liechtenstein
CTRY_LITHUANIA = 370; Lithuania
CTRY_LUXEMBOURG = 352; Luxembourg
CTRY_MACAU = 853; Macau S.A.R., PRC
CTRY_MACEDONIA = 389; Former Yugoslav Republic of Macedonia
CTRY_MALAYSIA = 60; Malaysia
CTRY_MALDIVES = 960; Maldives
CTRY_MEXICO = 52; Mexico
CTRY_MONACO = 33; Principality of Monaco
CTRY_MONGOLIA = 976; Mongolia
CTRY_MOROCCO = 212; Morocco
CTRY_NETHERLANDS = 31; Netherlands
CTRY_NEW_ZEALAND = 64; New Zealand
CTRY_NICARAGUA = 505; Nicaragua
CTRY_NORWAY = 47; Norway
CTRY_OMAN = 968; Oman
CTRY_PAKISTAN = 92; Islamic Republic of Pakistan
CTRY_PANAMA = 507; Panama
CTRY_PARAGUAY = 595; Paraguay
CTRY_PERU = 51; Peru
CTRY_PHILIPPINES = 63; Republic of the Philippines
CTRY_POLAND = 48; Poland
CTRY_PORTUGAL = 351; Portugal
CTRY_PRCHINA = 86; People's Republic of China
CTRY_PUERTO_RICO = 1; Puerto Rico
CTRY_QATAR = 974; Qatar
CTRY_ROMANIA = 40; Romania
CTRY_RUSSIA = 7; Russia
CTRY_SAUDI_ARABIA = 966; Saudi Arabia
CTRY_SERBIA = 381; Serbia
CTRY_SINGAPORE = 65; Singapore
CTRY_SLOVAK = 421; Slovak Republic
CTRY_SLOVENIA = 386; Slovenia
CTRY_SOUTH_AFRICA = 27; South Africa
CTRY_SOUTH_KOREA = 82; Korea
CTRY_SPAIN = 34; Spain
CTRY_SWEDEN = 46; Sweden
CTRY_SWITZERLAND = 41; Switzerland
CTRY_SYRIA = 963; Syria
CTRY_TAIWAN = 886; Taiwan
CTRY_TATARSTAN = 7; Tatarstan
CTRY_THAILAND = 66; Thailand
CTRY_TRINIDAD_Y_TOBAGO = 1; Trinidad y Tobago
CTRY_TUNISIA = 216; Tunisia
CTRY_TURKEY = 90; Turkey
CTRY_UAE = 971; U.A.E.
CTRY_UKRAINE = 380; Ukraine
CTRY_UNITED_KINGDOM = 44; United Kingdom
CTRY_UNITED_STATES = 1; United States
CTRY_URUGUAY = 598; Uruguay
CTRY_UZBEKISTAN = 7; Uzbekistan
CTRY_VENEZUELA = 58; Venezuela
CTRY_VIET_NAM = 84; Viet Nam
CTRY_YEMEN = 967; Yemen
CTRY_ZIMBABWE = 263; Zimbabwe


Primary language Id value LANG_*
LANG_NEUTRAL = $00;  
 
LANG_ENGLISH = $09;  


Sublanguage Id value SUBLANG_*
SUBLANG_NEUTRAL = $00; language neutral
SUBLANG_DEFAULT = $01; user default
SUBLANG_SYS_DEFAULT = $02; system default
 
SUBLANG_ENGLISH_US = $01; English (USA)


Type definitions



Locale Id

LCID = DWORD;
PLCID = ^LCID;

Language Id

LANGID = Word;
PLANGID = ^LANGID;

Language group Id

LGRPID = DWORD;

Locale type

LCTYPE = DWORD;

Calendar type

CALTYPE = DWORD;

Calendar Id

CALID = DWORD;

CP information

CPINFO = _cpinfo;

TCpInfo = CPINFO;

PCpInfo = LPCPINFO;

LPCPINFO = ^CPINFO;

_cpinfo = record

MaxCharSize: UINT; max length (in bytes) of a AnsiChar
DefaultChar: array [0..MAX_DEFAULTCHAR - 1] of BYTE; default character
LeadByte: array [0..MAX_LEADBYTES - 1] of BYTE; lead byte ranges

CP info extended

CPINFOEX = _cpinfoex;

TCpInfoEx = CPINFOEX;

PCpInfoEx = LPCPINFOEX;

LPCPINFOEX = ^CPINFOEX;

_cpinfoex = record

MaxCharSize: UINT; max length (in bytes) of a AnsiChar
DefaultChar: array [0..MAX_DEFAULTCHAR - 1] of BYTE; default character (MB)
LeadByte: array [0..MAX_LEADBYTES - 1] of BYTE; lead byte ranges
UnicodeDefaultChar: WCHAR; default character (Unicode)
CodePage: UINT; code page Id
CodePageName: array [0..MAX_PATH - 1] of AnsiChar; code page name (Ansi)

Code table

PCodeTable = ^TCodeTable;

TCodeTable = record

Note: Code Table - The OEM/ANSI to UNICODE Values of a Code Page
MaxCharSize:UINT; Max Length (Bytes) of a Char
DefaultChar:array[0..MAX_DEFAULTCHAR - 1] of Byte; Default Character
LeadByte:array[0..MAX_LEADBYTES - 1] of Byte; Lead Byte Ranges
Values:array[$00..$FF] of Word;  

Translation table

PTransTable = ^TTransTable;

TTransTable = record

Note: Trans Table - The OEM/ANSI to ANSI/OEM Values of a Code Page
TransID:Word; Translate Code Page
Values:array[$00..$FF] of Word; Word to allow for DBCS

Lowercase table

PLowerTable = ^TLowerTable;

TLowerTable = record

Note: Lower Table - Upper to Lower case values of a Code Page
LowerID:Word; Lowercase Code Page
Values:array[$00..$FF] of Word; Word to allow for DBCS

Uppercase table

PUpperTable = ^TUpperTable;

TUpperTable = record

Note: Upper Table - Lower to Upper case values of a Code Page
UpperID:Word; Uppercase Code Page
Values:array[$00..$FF] of Word; Word to allow for DBCS

Unicode table

PUnicodeTable = ^TUnicodeTable;

TUnicodeTable = record

Note: Unicode Table - The UNICODE to OEM/ANSI Values of a Code Page
Values:array[$0000..$FFFF] of Word; Word to allow for DBCS

Lead bytes

PLeadBytes = ^TLeadBytes;

TLeadBytes = record

Note: Lead Bytes - The extended Page Tables for DBCS Pages
Tables:array[$00..$FF] of PCodeTable;  

Code page

PCodePage = ^TCodePage;

TCodePage = record

Note: Each Code Table provides the OEM to UNICODE Values. To convert back use the main Unicode Table in the Code Page which was populated when the Code Page was loaded.
Note: Code Page - The actual information for an OEM/ANSI Code Page
PageID:Word; Code Page ID (eg 437 or 1252)
Handle:THandle; Handle of Code Page Module
CodeTable:PCodeTable; The OEM/ANSI Values
LeadBytes:PLeadBytes; The Lead Byte Tables
TransTable:PTransTable; The OEM <-> ANSI Values
LowerTable:PLowerTable; The Upper to Lower Values
UpperTable:PUpperTable; The Lower to Upper Values
UnicodeTable:PUnicodeTable; The UNICODE Values
PrevPage:PCodePage; Prev Code Page
NextPage:PCodePage; Next Code Page


Public variables



Locale specific variables

OemPage:PCodePage;
AnsiPage:PCodePage;
DefaultPage:PCodePage;
CodePageLock:TPlatformLock;


Function declarations



Initialization functions

procedure LocaleInit;
Description: To be documented
Note None documented


Locale functions

function IsValidCodePage(CodePage:UINT):BOOL;
Description: To be documented
Note None documented


function GetACP:UINT;
Description: To be documented
Note None documented


function GetOEMCP:UINT;
Description: To be documented
Note None documented


function SetACP(CodePage:UINT):BOOL;
Description: To be documented
Note None documented


function SetOEMCP(CodePage:UINT):BOOL;
Description: To be documented
Note None documented


function GetConsoleCP:UINT;
Description: To be documented
Note None documented


function SetConsoleCP(wCodePageID:UINT):BOOL;
Description: To be documented
Note None documented


function GetConsoleOutputCP:UINT;
Description: To be documented
Note None documented


function SetConsoleOutputCP(wCodePageID:UINT):BOOL;
Description: To be documented
Note None documented


function GetCPInfo(CodePage:UINT; var lpCPInfo:TCPInfo):BOOL;
Description: To be documented
Note None documented


function GetCPInfoEx(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;
Description: To be documented
Note None documented


function GetCPInfoExA(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;
Description: To be documented
Note None documented


function GetCPInfoExW(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXW):BOOL;
Description: To be documented
Note None documented


function IsValidLocale(Locale:LCID; dwFlags:DWORD):BOOL;
Description: To be documented
Note None documented


function GetSystemDefaultLCID:LCID;
Description: To be documented
Note None documented


function GetUserDefaultLCID:LCID;
Description: To be documented
Note None documented


function SetSystemDefaultLCID(Locale:LCID):BOOL;
Description: To be documented
Note None documented


function GetSystemDefaultLangID: LANGID;
Description: Get the System Default Language Identifier (Combined Primary and Sub language Identifiers)
Note System and User values are the same for Ultibo


function GetUserDefaultLangID: LANGID;
Description: Get the System Default Language Identifier (Combined Primary and Sub language Identifiers)
Note System and User values are the same for Ultibo


RTL unicode string manager functions

function SysGetStandardCodePage(const stdcp:TStandardCodePageEnum):TSystemCodePage;
Description: To be documented
Note None documented


Locale helper functions

function MapPage(CodePage:UINT):Word;
Description: Map a default code page to the actual current page
Note None documented


function GetPage(PageID:Word):PCodePage;
Description: Find the requested page in the linked list
Note None documented


function CheckPage(Page:PCodePage):Boolean;
Description: Check that the Page supplied is part of the Linked list
Note None documented


function LinkPage(Page:PCodePage):Boolean;
Description: Link Page to Prev,Next Siblings and Adjust First/Last
Note None documented


function UnlinkPage(Page:PCodePage):Boolean;
Description: Unlink Page from Prev,Next Siblings and Adjust First/Last
Note None documented


function LoadPage(PageID:Word; Table:PCodeTable; Lower:PLowerTable; Upper:PUpperTable):Boolean;
Description: Load a code table and allocate memory to create a code page
Note None documented


function UnloadPage(PageID:Word; Page:PCodePage):Boolean;
Description: Unload a code page and release allocated memory
Note None documented


function DefaultTrans(PageID,TransID:Word):Boolean;
Description: To be documented
Note None documented


function InstallTrans(PageID:Word; Table:PTransTable):Boolean;
Description: To be documented
Note None documented


Return to Unit Reference