|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.openfoundation.internationalization.XPResourceManager
public class XPResourceManager
XPResourceManager is a singleton class that loads all resouce files in a given resource folder. The resource files are primarily used to store the localized string messages. The GetString method of this class is overloaded to support placeholder substitution. The placeholder can be escaped using '\' character. The escaped placeholder will not be replaced and will appear as it is without the escape character i.e. \''. For e.g., if a string "Hello \{0} {0}" is substituted with "Test", the result is "Hello {0} Test". XPResourceManager uses XPResourceSet to load the resources from resource files.
XPResourceSet
Field Summary | |
---|---|
static java.lang.String |
LOCALES_RESOURCE_FILE
MES- The name of the file that holds the localized strings describing languages. |
Method Summary | |
---|---|
static XPResourceManager |
CreateResourceManager(java.lang.String resourceFolder)
Single access point to obtain an instance of XPResourceManager. |
static java.lang.String |
FormatMessage(java.lang.String message,
java.lang.Object argValue0)
Returns the string with the placeholders {0} replaced with the given argument value. |
static java.lang.String |
FormatMessage(java.lang.String message,
java.lang.Object argValue0,
java.lang.Object argValue1)
Returns the string with the placeholders {0} and {1} replaced with the given argument values. |
static java.lang.String |
FormatMessage(java.lang.String message,
java.lang.Object argValue0,
java.lang.Object argValue1,
java.lang.Object argValue2)
Returns the string with the placeholders {0}, {1} and {2} replaced with the given argument values. |
static java.lang.String |
FormatMessage(java.lang.String message,
java.lang.Object argValue0,
java.lang.Object argValue1,
java.lang.Object argValue2,
java.lang.Object argValue3)
Returns the string with the placeholders {0}, {1}, {2} and {3} replaced with the given argument values. |
java.lang.String |
GetDisplayLanguageFromLocaleID(java.lang.String sLocale,
java.lang.String language)
Translates from a locale or language identifier to the human readable string for the language. |
java.lang.String |
GetDisplayLocaleFromLocaleID(java.lang.String sLocale,
java.lang.String language)
Translates from a locale or language identifier to the human readable string for that locale or language. |
java.lang.String |
GetString(int messageID,
java.lang.String messageFileName,
java.lang.String language)
Returns the string corresponding to the given message ID, message file index or name and the language. |
java.lang.String |
GetString(int messageID,
java.lang.String messageFileName,
java.lang.String language,
java.lang.Object argValue0)
Returns the string corresponding to the given message ID, message file index or name and the language. |
java.lang.String |
GetString(int messageID,
java.lang.String messageFileName,
java.lang.String language,
java.lang.Object argValue0,
java.lang.Object argValue1)
Returns the string corresponding to the given message ID, message file index or name and the language. |
java.lang.String |
GetString(int messageID,
java.lang.String messageFileName,
java.lang.String language,
java.lang.Object argValue0,
java.lang.Object argValue1,
java.lang.Object argValue2)
Returns the string corresponding to the given message ID, message file index or name and the language. |
java.lang.String |
GetString(int messageID,
java.lang.String messageFileName,
java.lang.String language,
java.lang.Object argValue0,
java.lang.Object argValue1,
java.lang.Object argValue2,
java.lang.Object argValue3)
Returns the string corresponding to the given message ID, message file index or name and the language. |
java.lang.String[] |
GetSupportedLanguages()
Returns the supported languages that can be used as an argument to GetString(*) methods. |
java.lang.String[] |
GetSupportedLocales(java.lang.String language)
Returns the supported locales that can be used as an argument to GetString(*) methods. |
void |
LoadResources()
Loads the resources in all supported languages into an internal hashtable. |
java.lang.String |
MapLocaleToSupportedUILangID(java.lang.String sLocaleID)
Converts from a locale chosen by the user (e.g. |
java.lang.String |
MapLocaleToSupportedUILangID(java.lang.String sLocaleID,
java.lang.String defaultLangID)
Converts from a locale chosen by the user (e.g. |
java.lang.String |
MapLocaleToUISupportedLocaleID(java.lang.String sLocaleID,
java.lang.String defaultLocaleID)
Converts from a locale chosen by the user (e.g. |
static XPSortedDictionary |
NormalizeLocaleList(java.lang.String strAcceptsHeader)
This helper method converts an accepts header into an XPSortedDictionary in decreasing order of q value. |
static java.lang.String |
TruncateLocaleID(java.lang.String sLocaleID)
An internal use funcation to truncates a locale ID to a language. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LOCALES_RESOURCE_FILE
Method Detail |
---|
public static java.lang.String FormatMessage(java.lang.String message, java.lang.Object argValue0)
message
- String message with the placeholder {0}argValue0
- value of the placeholder {0}
public static java.lang.String FormatMessage(java.lang.String message, java.lang.Object argValue0, java.lang.Object argValue1)
message
- String message with the placeholders {0} and {1}argValue0
- value of the placeholder {0}argValue1
- value of the placeholder {1}
public static java.lang.String FormatMessage(java.lang.String message, java.lang.Object argValue0, java.lang.Object argValue1, java.lang.Object argValue2)
message
- String message with the placeholders {0}, {1} and {2}argValue0
- value of the placeholder {0}argValue1
- value of the placeholder {1}argValue2
- value of the placeholder {2}
public static java.lang.String FormatMessage(java.lang.String message, java.lang.Object argValue0, java.lang.Object argValue1, java.lang.Object argValue2, java.lang.Object argValue3)
message
- String message with the placeholders {0}, {1}, {2} and {3}argValue0
- value of the placeholder {0}argValue1
- value of the placeholder {1}argValue2
- value of the placeholder {2}argValue3
- value of the placeholder {3}
public static XPResourceManager CreateResourceManager(java.lang.String resourceFolder)
resourceFolder
- Name of the directory that contains the resource files.
public java.lang.String[] GetSupportedLanguages()
public static XPSortedDictionary NormalizeLocaleList(java.lang.String strAcceptsHeader)
strAcceptsHeader
- the accepts header.
public java.lang.String MapLocaleToUISupportedLocaleID(java.lang.String sLocaleID, java.lang.String defaultLocaleID)
sLocaleID
- The ID of the locale to be mapped,
or an RFC 2616, HTTP/1.1 string on Accept-Language
(eg. ja, en-gb;q=0.8, en;q=0.7)defaultLocaleID
- Default value to be used if the supplied locale
does not map to any of the UI supported locales
XPException
public java.lang.String MapLocaleToSupportedUILangID(java.lang.String sLocaleID, java.lang.String defaultLangID)
sLocaleID
- The ID of the locale to be mapped,
or an RFC 2616, HTTP/1.1 string on Accept-Language
(eg. ja, en-gb;q=0.8, en;q=0.7)defaultLangID
- Default value to be used if the supplied locale
does not map to any of the UI supported languages
XPException
public java.lang.String MapLocaleToSupportedUILangID(java.lang.String sLocaleID)
sLocaleID
- The ID of the locale to be mapped,
or an RFC 2616, HTTP/1.1 string on Accept-Language
(eg. ja, en-gb;q=0.8, en;q=0.7)
XPException
public static java.lang.String TruncateLocaleID(java.lang.String sLocaleID)
sLocaleID
- The ID of the locale to be trucated
public void LoadResources()
XPException
public java.lang.String GetString(int messageID, java.lang.String messageFileName, java.lang.String language)
GetString
in interface IXPResourceManager
messageID
- ID of the messagemessageFileName
- File Name of the message file that contains the string messageslanguage
- Language of the string messages (e.g. en, fr etc.)
XPException
public java.lang.String GetString(int messageID, java.lang.String messageFileName, java.lang.String language, java.lang.Object argValue0)
GetString
in interface IXPResourceManager
messageID
- ID of the messagemessageFileName
- File Name of the message file that contains the string messageslanguage
- Language of the string messages (e.g. en, fr etc.)argValue0
- The argument value for the placeholder {0}
XPException
public java.lang.String GetString(int messageID, java.lang.String messageFileName, java.lang.String language, java.lang.Object argValue0, java.lang.Object argValue1)
GetString
in interface IXPResourceManager
messageID
- ID of the messagemessageFileName
- File Name of the message file that contains the string messageslanguage
- Language of the string messages (e.g. en, fr etc.)argValue0
- The argument value for the placeholder {0}argValue1
- The argument value for the placeholder {1}
XPException
public java.lang.String GetString(int messageID, java.lang.String messageFileName, java.lang.String language, java.lang.Object argValue0, java.lang.Object argValue1, java.lang.Object argValue2)
GetString
in interface IXPResourceManager
messageID
- ID of the messagemessageFileName
- File Name of the message file that contains the string messageslanguage
- Language of the string messages (e.g. en, fr etc.)argValue0
- The argument value for the placeholder {0}argValue1
- The argument value for the placeholder {1}argValue2
- The argument value for the placeholder {2}
XPException
public java.lang.String GetString(int messageID, java.lang.String messageFileName, java.lang.String language, java.lang.Object argValue0, java.lang.Object argValue1, java.lang.Object argValue2, java.lang.Object argValue3)
GetString
in interface IXPResourceManager
messageID
- ID of the messagemessageFileName
- File Name of the message file that contains the string messageslanguage
- Language of the string messages (e.g. en, fr etc.)argValue0
- The argument value for the placeholder {0}argValue1
- The argument value for the placeholder {1}argValue2
- The argument value for the placeholder {2}argValue3
- The argument value for the placeholder {3}
XPException
public java.lang.String GetDisplayLanguageFromLocaleID(java.lang.String sLocale, java.lang.String language)
sLocale
- The locale identifier to be converted to human-readable stringlanguage
- Language of the string messages (e.g. en, fr etc.)
public java.lang.String GetDisplayLocaleFromLocaleID(java.lang.String sLocale, java.lang.String language)
sLocale
- The locale identifier to be converted to human-readablelanguage
- Language of the string messages (e.g. en, fr etc.)
public java.lang.String[] GetSupportedLocales(java.lang.String language)
language
- supported locale name.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |