It is sometimes desirable for applications to use message catalog files to store information other than localized messages. To avoid confusing the language, territory, and character set triples used to store this additional information with those that contain localized messages the notion of extended locale has been adopted. An extended locale is defined as a language, territory, character set triple where the language string begins with the '$' character.
Extended locales are intended to be used to identify objects other than localized messages which are stored in message catalog files. For example, the #('$Comment' 'Comment' 'Comment') extended locale could be used by an application to maintain a comment about the message catalog file.
The following protocols are provided to determine what language, territory, and character set combinations are supported by a message catalog file. Each of the following protocols answers a collection of ordered triples representing the language, territory, and character sets for which application-defined objects or localized messages have been stored. The following protocols report errors by answering nil.
The following example illustrates the use of the preceding protocols:
"A code fragment to determine the locales and character sets supported by a message catalog file." | catalog translations extendedLocales allIdentifiers | catalog := NlsMessageCatalog on: 'demo.cat'. translations := catalog messageIdentifiers. extendedLocales := catalog hiddenMessageIdentifiers. allIdentifiers := catalog allMessageIdentifiers ^Array with: translations with: extendedLocales with: allIdentifiers
As a convenience, the NlsMessageCatalog provides the supportsLanguage:territory:characterSet: message to determine if a message catalog file supports a particular language, territory, and character set combination. This message answers a Boolean value indicating whether or not the requested combination is supported. The following example demonstrates how to use the supportsLanguage:territory:characterSet: protocol.
"Testing a message catalog file to determine if messages are stored for #('english' 'us' 'iso8859-1')." | catalog | catalog := NlsMessageCatalog on: 'demo.cat'. ^catalog supportsLanguage: 'english' territory: 'us' characterSet: 'iso8859-1'