The %MessageDictionary 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 "<language>:<domain>".
<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".
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.
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.
Inherited description: This callback method is invoked by the %New() method to
provide notification that a new instance of an object is being created.
If this method returns an error then the object will not be created.
It is passed the arguments provided in the %New call.
When customizing this method, override the arguments with whatever variables and types you expect to receive from %New().
For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:
Method %OnNew(dob as %Date = "", name as %Name = "") as %Status
If instead of returning a %Status code this returns an oref and this oref is a subclass of the current
class then this oref will be the one returned to the caller of %New method.
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 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 "<filepath>.<ext>".
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.
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.
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.
classmethod FormatText(text As %String, args...) as %String
Format the specified message text.
Arguments of the form %1, %2, etc will be replaced by arguments
that follow the text argument.
classmethod GenerateInclude(includeName As %String, flag As %String = "", DomainList="", UseDomainName As %Boolean = 0) as %Status
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 "" 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 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 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.
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.
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 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 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 <instance base directory>\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:
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.
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.
classmethod SetSessionLanguage(language As %String) as %String
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.