IRISLIB database
MessageDictionary Class Reference
Inheritance diagram for MessageDictionary:
Collaboration diagram for MessageDictionary:

Public Member Functions

_.Library.String FormatMessage (_.Library.String id, _.Library.String default, args)
 Get and format message text from this Message Dictionary. More...
 
_.Library.String GetMessage (_.Library.String id, _.Library.String default)
 Get message text from this Message Dictionary. More...
 
_.Library.String GetNextMessage (_.Library.String id)
 Return the text and id of the next message. More...
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Static Public Member Functions

_.Library.Status Delete (_.Library.String languages, _.Library.String flag)
 Delete all Message Dictionary(s) for the specified languages. More...
 
_.Library.Status Export (_.Library.String file, _.Library.String languages, _.Library.String flag)
 Export Message Dictionaries to XML file(s). More...
 
_.Library.Status ExportDomainList (_.Library.String file, _.Library.String domainList, _.Library.String language)
 Export Message Dictionaries for the specified languages and domains. More...
 
_.Library.String FormatText (_.Library.String text, args)
 Format the specified message text. More...
 
_.Library.Status GenerateInclude (_.Library.String includeName, _.Library.String flag, DomainList, _.Library.Boolean UseDomainName)
 Generate an include file mapping the Name attributes of each message in any. More...
 
_.Library.ListOfDataTypes GetDomains (_.Library.String language, _.Library.String flag)
 GetDomains returns a list of all domains that have messages loaded for the specified language. More...
 
_.Library.ListOfDataTypes GetLanguages (_.Library.String domain, _.Library.String flag)
 GetLanguages returns a list of all languages that have messages loaded. More...
 
_.Library.String GetSessionLanguage ()
 GetSessionLanguage retrieves the default session language for the messages in the Message Dictionary. More...
 
_.Library.Status Import (_.Library.String filepath, _.Library.String flag)
 Import the Message Dictionary(s) in an XML file specified by filepath. More...
 
_.Library.Status ImportDir (_.Library.String directory, _.Library.String flag)
 Import the Message Dictionary(s) in all of the XML file in the specified. More...
 
_.Library.String MatchLanguage (_.Library.String languages, _.Library.String domain, _.Library.String flag)
 Get the best language match to a language in the list languages. More...
 
_.Library.String SetSessionLanguage (_.Library.String language)
 SetSessionLanguage sets the default session language for the messages in the Message Dictionary. More...
 

Public Attributes

 Domain
 The Domain attribute defines the logical grouping of messages in the. More...
 
 Language
 The Language attribute defines the language of the messages. More...
 

Additional Inherited Members

- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Detailed Description

For information on this class, see String Localization and Message Dictionaries.

The <class>MessageDictionary</class> is introduced to allow easy localization of program messages and CSP page content. A MessageDictionary is a dictionary of messages. Each message in the dictionary is any ObjectScript string and is indexed by any ObjectScript value. A MessageDictionary is then defined for each language and domain needed by your application. Each message is indexed by language, domain and id.

In order for a MessageDictionary object to be created (New'ed), a language and domain must be specified for the message dictionary. The format of the specification string is "&lt;language&gt;:&lt;domain&gt;".
<language> is an optional RFC 1766 language tag. If not specified the default system language is used. <domain> is a required domain specification, for example "en-us:titles" or ":names".

Member Function Documentation

◆ Delete()

_.Library.Status Delete ( _.Library.String  languages,
_.Library.String  flag 
)
static

Delete all Message Dictionary(s) for the specified languages.

Languages is an optional comma separated list of languages whose Message Dictionaries are to be deleted. If languages is not specified, Message Dictionaries for all languages are deleted. The "s", system flag, is an optional flag indicating whether system "s" or application Message Dictionaries are to be dleeted. The default value is to delete application Message Dictionaries.

The messages names associated with include files are always deleted, but not any previously geenrated include files. The "d", display, flag is supported.

◆ Export()

_.Library.Status Export ( _.Library.String  file,
_.Library.String  languages,
_.Library.String  flag 
)
static

Export Message Dictionaries to XML file(s).

languages is an optional comma separated list of languages. If languages is not specified, all languages are exported.
Each language in the list is exported to a separate file. The template for the filename is given by the file argument that is of the format "&lt;filepath&gt;.&lt;ext&gt;". The file will be named by concatenating the language to the <filepath> with an extension of <ext>. The "s", system flag, is an optional flag indicating whether system "s" or application Message Dictionaries are to be exported.

◆ ExportDomainList()

_.Library.Status ExportDomainList ( _.Library.String  file,
_.Library.String  domainList,
_.Library.String  language 
)
static

Export Message Dictionaries for the specified languages and domains.

fil is the path of the file to be written. domainList is a comma separated list of domains to be exported. language is an optional language that default to the current session language, $$$SessionLanguage.

◆ FormatMessage()

_.Library.String FormatMessage ( _.Library.String  id,
_.Library.String  default,
  args 
)

Get and format message text from this Message Dictionary.

The default argument is used for the message if no message is found for id. If the default argument is not specified, then string for the default language or English is used as the default. Arguments of the form %1, %2, etc will be replaced by arguments that follow the id argument.

◆ FormatText()

_.Library.String FormatText ( _.Library.String  text,
  args 
)
static

Format the specified message text.

Arguments of the form %1, %2, etc will be replaced by arguments that follow the text argument.

◆ GenerateInclude()

_.Library.Status GenerateInclude ( _.Library.String  includeName,
_.Library.String  flag,
  DomainList,
_.Library.Boolean  UseDomainName 
)
static

Generate an include file mapping the Name attributes of each message in any.

Message Dictionary to the message id.

The name of the include file to be generated is includeName. The DomainList argument is a comma separated list of names of the domains for which the include file is to generated. If Domain is not specified or "", then all domains are included in the include file. If UseDomainName is true (1), then the domain name as "<domain>" is prepended to the message code in the include file. The "s", system flag, is an optional flag indicating whether system, "s", or application Message Dictionaries are to be exported. The "d", display, flag is supported.

◆ GetDomains()

_.Library.ListOfDataTypes GetDomains ( _.Library.String  language,
_.Library.String  flag 
)
static

GetDomains returns a list of all domains that have messages loaded for the specified language.


If language="" is specifed, the default language is used. The "s", system flag, is an optional flag indicating whether languages supported by system ("s") or application Message Dictionaries are to be returned. The default value is to return the domains for application Message Dictionaries.

◆ GetLanguages()

_.Library.ListOfDataTypes GetLanguages ( _.Library.String  domain,
_.Library.String  flag 
)
static

GetLanguages returns a list of all languages that have messages loaded.

for the specified domain or all languages if domain="" Each language is in the standard RFC1766 format and all in lower case. The "s", system flag, is an optional flag indicating whether languages supported by system ("s") or application Message Dictionaries are to be returned. The default value is to return the languages for application Message Dictionaries.

◆ GetMessage()

_.Library.String GetMessage ( _.Library.String  id,
_.Library.String  default 
)

Get message text from this Message Dictionary.

The default argument is used for the message if no message is found for id. No message formatting is supported by this method.

◆ GetNextMessage()

_.Library.String GetNextMessage ( _.Library.String  id)

Return the text and id of the next message.

The text and id of the message with the next id are returned. If the input id = "", then the text and id of the first message are returned. Return an empty string for the message text and id, if the input id was for the last message. Language is optional and the current language is used if language is "" or not specified.
Language will be converted to lower case before being used. Domain can be a system domain beginning with % or a application domain.

◆ GetSessionLanguage()

_.Library.String GetSessionLanguage ( )
static

GetSessionLanguage retrieves the default session language for the messages in the Message Dictionary.

The language returned is a RFC 1766 defined language tag.
In summary, a language tag is composed of 1 or more parts: A primary language tag optionally followed by a hyphen (-) separated secondary subtag. The Language string will be normalized to all lower case characters.

◆ Import()

_.Library.Status Import ( _.Library.String  filepath,
_.Library.String  flag 
)
static

Import the Message Dictionary(s) in an XML file specified by filepath.

All Message Dictionaries in the file will be imported. The "d", display, flag is supported.

One or more Message Dictionaries may be specified by the XML file in the format given by the DTD at &ltinstance base directory&gt\dev\csp\rules\CacheMessages.dtd, or url /studio/rules/CacheMessages.dtd. The file may contain Message Dictionaries for only one language and multiple domains. In summary, the file looks like:

<?xml version="1.0" encoding="UTF-8"?> <MsgFile Language="language"> <MsgDomain Domain="domain"> <Message Id="message_id" Name="message name">message text</Message> </MsgDomain> </MsgFile>

We recommend using the UTF-8 encoding for these files whenever possible.
Sometimes local platform encodings, such as shift-jis, are needed for ease of editing. The encoding that is picked must be supported by the locale for the application and be able to express the messages for this file's language.

◆ ImportDir()

_.Library.Status ImportDir ( _.Library.String  directory,
_.Library.String  flag 
)
static

Import the Message Dictionary(s) in all of the XML file in the specified.

directory. The "d", display, flag is supported.

The format of the XML files is described with the <method>Import</method>.

◆ MatchLanguage()

_.Library.String MatchLanguage ( _.Library.String  languages,
_.Library.String  domain,
_.Library.String  flag 
)
static

Get the best language match to a language in the list languages.

for the specified domain using HTTP 1.1 matching rules (RFC 2616). The list of languages is a comma separated list of RFC 1766 format language names. Each language in the list MAY be given an associated quality value which represents an estimate of the user's preference for the languages specified by the input list. The quality value defaults to "q=1". For example, "da, en-gb;q=0.8, en;q=0.7" would mean: "I prefer Danish, but will accept British English and other types of English." A language from the list matches a supported language tag if it exactly equals the tag, or if it exactly equals a prefix of the tag such that the first tag character following the prefix is "-". The special language "*", if present in the input list, matches every supported language not matched by any other language present in the list.

The language quality factor assigned to a supported language tag by the is the quality value of the longest language in the list thatt matches the language-tag. The language that is returned is the supported language that has been assigned the highest quality factor.

The "s", system flag, is an optional flag indicating whether system, "s", or application Message Dictionaries are to be matched.

◆ SetSessionLanguage()

_.Library.String SetSessionLanguage ( _.Library.String  language)
static

SetSessionLanguage sets the default session language for the messages in the Message Dictionary.

The language argument is a RFC 1766 defined language tag. The return value is the previous default session language. In summary, a language tag is composed of 1 or more parts: A primary language tag optionally followed by a hyphen (-) separated secondary subtag. The Language string will be normalized to all lower case characters.

Member Data Documentation

◆ Domain

Domain

The Domain attribute defines the logical grouping of messages in the.

Message Dictionary. If the domain name begins with %, then the Message Dictionary is considered a system Message Dictionary that is visible in all namespaces. Application Message Dictionaries are visible in only the namespace in which they are defined.  

◆ Language

Language

The Language attribute defines the language of the messages.

in the Message Dictionary. Language is any RFC 1766 defined language tag.
In summary, a language tag is composed of 1 or more parts: A primary language tag optionally followed by a hyphen (-) separated secondary subtag. The Language string will be normalized to all lower case characters.