When the current locale is initialized, new LCMessages,
LCMonetary,
LCNumeric, and
LCTime objects are created, initialized, and stored. The current
LCMessages,
LCMonetary,
LCNumeric, and
LCTime objects can be retrieved by sending the
lcMessages,
lcMonetary,
lcNumeric, and
lcTime messages to the current locale (
Locale current).
VA Smalltalk supports the use of multiple LCMessages,
LCMonetary,
LCNumeric, and
LCTime objects. Each instance of these classes maintains information for a particular locale and can be created using the
for: protocol. The argument to the
for: message is an array of two strings specifying the language and territory for which information is to be retrieved.
New instances of the LCMessages,
LCMonetary,
LCNumeric, and
LCTime classes can be created and initialized for the platform default locale using the
for: protocol and an array of two empty strings--that is, #('' '')--as the parameter. This platform default value is always guaranteed to be available. The following code example answers a new
LCMonetary object initialized for the platform default locale.
New instances of the LCMessages,
LCMonetary,
LCNumeric, and
LCTime classes can be created, and initialized, for a particular locale using the
for: protocol and an array containing the language and territory strings of the requested locale as the argument. For a complete list of valid language and territory combinations, refer to
Table 53. You can see what language and territory combinations your operating system supports by evaluating
Locale knownLocales.
If the information for the requested locale is not available, the for: message answers
nil. Otherwise, the newly created and initialized object is answered. The following code fragment queries the operating system for the monetary formatting information for the territory
'us' and language
'english.' Note that the territory and language strings must be in lowercase.
Copyright 2005, 2020 Instantiations, Inc. All rights reserved.