Return to Unit Reference
Description
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
[Expand]
Default code page constants 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_UTF7 = 65000;
|
UTF-7 translation
|
CP_UTF8 = 65001;
|
UTF-8 translation
|
[Expand]
Code page identifier constants 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
|
[Expand]
Default locale constants LOCALE_*
LOCALE_SYSTEM_DEFAULT = $800;
|
|
LOCALE_USER_DEFAULT = $400;
|
|
[Expand]
String length maximum constants MAX_*
MAX_LEADBYTES = 12;
|
5 ranges, 2 bytes each, 0 terminated
|
MAX_DEFAULTCHAR = 2;
|
single or double byte
|
[Expand]
MBCS and Unicode translation flag constants 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
|
[Expand]
Character type flag constants CT_*
CT_CTYPE1 = $00000001;
|
ctype 1 information
|
CT_CTYPE2 = $00000002;
|
ctype 2 information
|
CT_CTYPE3 = $00000004;
|
ctype 3 information
|
[Expand]
CType 1 flag bit constants 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
|
[Expand]
CType 2 flag bit constants 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
|
[Expand]
CType 3 flag bit constants 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
|
[Expand]
String flag constants 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
|
[Expand]
Locale independent mapping flag constants 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
|
[Expand]
Locale dependent mapping flag constants 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
|
[Expand]
Language group enumeration flag constants LGRPID_*
LGRPID_INSTALLED = $00000001;
|
installed language group ids
|
LGRPID_SUPPORTED = $00000002;
|
supported language group ids
|
[Expand]
Locale enumeration flag constants LCID_*
LCID_INSTALLED = $00000001;
|
installed locale ids
|
LCID_SUPPORTED = $00000002;
|
supported locale ids
|
LCID_ALTERNATE_SORTS = $00000004;
|
alternate sort locale ids
|
[Expand]
Code page enumeration flag constants CP_*
CP_INSTALLED = $00000001;
|
installed code page ids
|
CP_SUPPORTED = $00000002;
|
supported code page ids
|
[Expand]
Sorting flag constants SORT_*
SORT_STRINGSORT = $00001000;
|
use string sort method
|
[Expand]
Compare string return value constants 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
|
[Expand]
Country/Region code constants 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
|
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
[Expand]
procedure LocaleInit;
Description: To be documented
Locale functions
[Expand]
function IsValidCodePage(CodePage:UINT):BOOL;
Description: To be documented
[Expand]
function GetACP:UINT;
Description: To be documented
[Expand]
function GetOEMCP:UINT;
Description: To be documented
[Expand]
function SetACP(CodePage:UINT):BOOL;
Description: To be documented
[Expand]
function SetOEMCP(CodePage:UINT):BOOL;
Description: To be documented
[Expand]
function GetConsoleCP:UINT;
Description: To be documented
[Expand]
function SetConsoleCP(wCodePageID:UINT):BOOL;
Description: To be documented
[Expand]
function GetConsoleOutputCP:UINT;
Description: To be documented
[Expand]
function SetConsoleOutputCP(wCodePageID:UINT):BOOL;
Description: To be documented
[Expand]
function GetCPInfo(CodePage:UINT; var lpCPInfo:TCPInfo):BOOL;
Description: To be documented
[Expand]
function GetCPInfoEx(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;
Description: To be documented
[Expand]
function GetCPInfoExA(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;
Description: To be documented
[Expand]
function GetCPInfoExW(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXW):BOOL;
Description: To be documented
[Expand]
function IsValidLocale(Locale:LCID; dwFlags:DWORD):BOOL;
Description: To be documented
[Expand]
function GetSystemDefaultLCID:LCID;
Description: To be documented
[Expand]
function GetUserDefaultLCID:LCID;
Description: To be documented
[Expand]
function SetSystemDefaultLCID(Locale:LCID):BOOL;
Description: To be documented
RTL unicode string manager functions
[Expand]
function SysGetStandardCodePage(const stdcp:TStandardCodePageEnum):TSystemCodePage;
Description: To be documented
Locale helper functions
[Expand]
function MapPage(CodePage:UINT):Word;
Description: Map a default code page to the actual current page
[Expand]
function GetPage(PageID:Word):PCodePage;
Description: Find the requested page in the linked list
[Expand]
function CheckPage(Page:PCodePage):Boolean;
Description: Check that the Page supplied is part of the Linked list
[Expand]
function LinkPage(Page:PCodePage):Boolean;
Description: Link Page to Prev,Next Siblings and Adjust First/Last
[Expand]
function UnlinkPage(Page:PCodePage):Boolean;
Description: Unlink Page from Prev,Next Siblings and Adjust First/Last
[Expand]
function LoadPage(PageID:Word; Table:PCodeTable; Lower:PLowerTable; Upper:PUpperTable):Boolean;
Description: Load a code table and allocate memory to create a code page
[Expand]
function UnloadPage(PageID:Word; Page:PCodePage):Boolean;
Description: Unload a code page and release allocated memory
[Expand]
function DefaultTrans(PageID,TransID:Word):Boolean;
Description: To be documented
[Expand]
function InstallTrans(PageID:Word; Table:PTransTable):Boolean;
Description: To be documented
Return to Unit Reference