Internationalization

Commands related to internationalization

SYNOPSIS

package require twapi
extract_primary_langid LANGID
extract_sublanguage_langid LANGID
format_currency NUMBER LCID ?options?
format_number NUMBER LCID ?options?
get_locale_info LCID ?options?
get_system_default_langid
get_system_default_lcid
get_system_ui_langid
get_user_default_langid
get_user_default_lcid
get_user_ui_langid
map_code_page_to_name CODEPAGENUM
map_langid_to_name LANGID

DESCRIPTION

This package provides procedures related to internationalization capabilities on Windows platforms.

Locales

A locale defines user preferences related to languages and culture-dependent formatting of numbers, currencies etc.. A locale identifier (LCID) is an integer or one of the keywords systemdefault or userdefault corresponding to the system and user default locales respectively.

The system maintains locale settings for the system as well as the user. These can be retrieved through the commands get_system_default_lcid and get_user_default_lcid respectively.

The command get_locale_info can be used to retrieve the settings associated with a particular locale.

Languages

Languages are identified by a 16 bit integer (LANGID) that includes the primary and sublanguage information. The commands extract_primary_langid and extract_sublanguage_langid may be used to retrieve these from the language identifier.

The system maintains several language settings. These can be retrieved through the commands get_system_default_langid, get_system_ui_langid, get_user_default_langid and get_user_ui_langid. Information related to a LANGID, such as it full name, can be retrieved by passing it to get_locale_info.

Formatting

Windows provides functions for formatting data as per local conventions. The command format_number formats numbers using a given locale as a base and with the ability to override particular format settings.

Commands

extract_primary_langid LANGID
Returns the primary language identifier for the language identifier specified by LANGID.
extract_sublanguage_langid LANGID
Returns the sublanguage identifier for the language identifier specified by LANGID.
format_currency NUMBER LCID ?options?
Formats NUMBER as a currency string per the given formatting specifications. LCID is a locale identifier. NUMBER must be in decimal format (the fractional part is optional) and may have a leading negative sign.

If no options are specified, the settings in the locale identified by LCID are used for formatting NUMBER.

If one or more of the following options are specified, they override the settings in the locale given by LCID.
-icurrency CURRENCYFORMAT Controls how positive currency numbers are formatted including spacing, position of the currency symbol etc.. See the documentation for LOCALE_ICURRENCY in the Windows SDK for possible values of CURRENCYFORMAT.
-idigits DECIMALPLACES Indicates the number of digits after the decimal point to include in the result. If specified as -1, the number of decimal places in the result is the same as in NUMBER.
-ilzero BOOLEAN Specifies whether the result includes leading zeroes (true) or not (false) when NUMBER is a pure fraction.
-inegcurr NEGFORMAT Controls how negative numbers are formatted including location of the currency symbol, the negative number indicator etc.. See the documentation for LOCALE_INEGCURR in the Windows SDK for possible values of NEGFORMAT.
-scurrency SYMBOL Specifies that the string SYMBOL should be used as the monetary symbol.
-sdecimal DECIMALSEPARATOR Specifies the string to be used to represent the decimal point.
-sgrouping GROUPNUM Specifies the size of each group of digits to the left of the decimal point. GROUPNUM may be any integer between 0 and 9 or the value 32 which indicates the Indic convention of the grouping by the first thousand (3 digits) followed by groups of 2 digits.
-sthousand THOUSANDSEPARATOR Specifies the string to be used as the thousands' separator.
format_number NUMBER LCID ?options?
Formats the number NUMBER as per the given formatting specifications. LCID is a locale identifier. NUMBER must be in decimal format (the fractional part is optional) and may have a leading negative sign.

If no options are specified, the settings in the locale identified by LCID are used for formatting NUMBER.

If one or more of the following options are specified, they override the settings in the locale given by LCID.
-idigits DECIMALPLACES Indicates the number of digits after the decimal point to include in the result. If specified as -1, the number of decimal places in the result is the same as in NUMBER.
-ilzero BOOLEAN Specifies whether the result the result includes leading zeroes (true) or not (false).
-inegnumber NEGFORMAT Controls how negative numbers are formatted. See the documentation for LOCALE_INEGNUMBER in the Windows SDK for possible values of NEGFORMAT.
-sgrouping GROUPNUM Specifies the size of each group of digits to the left of the decimal point. GROUPNUM may be any integer between 0 and 9 or the value 32 which indicates the Indic convention of the grouping by the first thousand (3 digits) followed by groups of 2 digits.
-sdecimal DECIMALSEPARATOR Specifies the string to be used to represent the decimal point.
-sthousand THOUSANDSEPARATOR Specifies the string to be used as the thousands' separator.
get_locale_info LCID ?options?
Returns a list containing information about the locale identified by LCID. The information returned depends on the options specified and is formatted as a list of the form "option VALUE...".
-ilanguage language id
-slanguage localized name of language
-senglanguage English name of language
-sabbrevlangname abbreviated language name
-snativelangname native name of language
-icountry country code
-scountry localized name of country
-sengcountry English name of country
-sabbrevctryname abbreviated country name
-snativectryname native name of country
-idefaultlanguage default language id
-idefaultcountry default country code
-idefaultcodepage default oem code page
-idefaultansicodepage default ansi code page
-idefaultmaccodepage default mac code page
-slist list item separator
-imeasure 0 = metric, 1 = US
-sdecimal decimal separator
-sthousand thousand separator
-sgrouping digit grouping
-idigits number of fractional digits
-ilzero leading zeros for decimal
-inegnumber negative number mode
-snativedigits native ascii 0-9
-scurrency local monetary symbol
-sintlsymbol intl monetary symbol
-smondecimalsep monetary decimal separator
-smonthousandsep monetary thousand separator
-smongrouping monetary grouping
-icurrdigits # local monetary digits
-iintlcurrdigits # intl monetary digits
-icurrency positive currency mode
-inegcurr negative currency mode
-sdate date separator
-stime time separator
-sshortdate short date format string
-slongdate long date format string
-stimeformat time format string
-idate short date format ordering
-ildate long date format ordering
-itime time format specifier
-itimemarkposn time marker position
-icentury century format specifier (short date)
-itlzero leading zeros in time field
-idaylzero leading zeros in day field (short date)
-imonlzero leading zeros in month field (short date)
-s1159 AM designator
-s2359 PM designator
-icalendartype type of calendar specifier
-ioptionalcalendar additional calendar types specifier
-ifirstdayofweek first day of week specifier
-ifirstweekofyear first week of year specifier
-sdayname1 long name for Monday
-sdayname2 long name for Tuesday
-sdayname3 long name for Wednesday
-sdayname4 long name for Thursday
-sdayname5 long name for Friday
-sdayname6 long name for Saturday
-sdayname7 long name for Sunday
-sabbrevdayname1 abbreviation for Monday
-sabbrevdayname2 abbreviation for Tuesday
-sabbrevdayname3 abbreviation for Wednesday
-sabbrevdayname4 abbreviation for Thursday
-sabbrevdayname5 abbreviation for Friday
-sabbrevdayname6 abbreviation for Saturday
-sabbrevdayname7 abbreviation for Sunday
-smonthname1 long name for January
-smonthname2 long name for February
-smonthname3 long name for March
-smonthname4 long name for April
-smonthname5 long name for May
-smonthname6 long name for June
-smonthname7 long name for July
-smonthname8 long name for August
-smonthname9 long name for September
-smonthname10 long name for October
-smonthname11 long name for November
-smonthname12 long name for December
-smonthname13 long name for 13th month (if exists)
-sabbrevmonthname1 abbreviation for January
-sabbrevmonthname2 abbreviation for February
-sabbrevmonthname3 abbreviation for March
-sabbrevmonthname4 abbreviation for April
-sabbrevmonthname5 abbreviation for May
-sabbrevmonthname6 abbreviation for June
-sabbrevmonthname7 abbreviation for July
-sabbrevmonthname8 abbreviation for August
-sabbrevmonthname9 abbreviation for September
-sabbrevmonthname10 abbreviation for October
-sabbrevmonthname11 abbreviation for November
-sabbrevmonthname12 abbreviation for December
-sabbrevmonthname13 abbreviation for 13th month (if exists)
-spositivesign positive sign
-snegativesign negative sign
-ipossignposn positive sign position
-inegsignposn negative sign position
-ipossymprecedes mon sym precedes pos amt
-ipossepbyspace mon sym sep by space from pos amt
-inegsymprecedes mon sym precedes neg amt
-inegsepbyspace mon sym sep by space from neg amt
-fontsignature font signature
-siso639langname ISO language abbreviation
-siso3166ctryname ISO country name abbreviation
-idefaultebcdiccodepage default ebcdic code page
-ipapersize 1 = letter, 5 = legal, 8 = a3, 9 = a4
-sengcurrname english name of currency
-snativecurrname native name of currency
-syearmonth year month format string
-ssortname sort name
-idigitsubstitution 0 = context, 1 = none, 2 = national
get_system_default_langid
Returns the default language identifier for the system.
get_system_default_lcid
Returns the default locale identifier for the system.
get_system_ui_langid
Returns the language identifier for the system default UI language.
get_user_default_langid
Returns the default user language identifier.
get_user_default_lcid
Returns the default user-locale identifier.
get_user_ui_langid
Returns the language identifier for the user's UI language.
map_code_page_to_name CODEPAGENUM
Returns the name of the code page identified by CODEPAGENUM.
map_langid_to_name LANGID
Returns the name of the language identified by LANGID.

COPYRIGHT

Copyright © 2005-2009 Ashok P. Nadkarni

Tcl Windows API 2.2.3 Privacy policy