ColdBox Platform Version 3.7.0

coldbox.system.plugins
Class ResourceBundle

WEB-INF.cftags.component
        extended by coldbox.system.FrameworkSupertype
            extended by coldbox.system.Plugin
                extended by coldbox.system.plugins.ResourceBundle

public class ResourceBundle
extends Plugin

Reads and parses java resource bundles per locale


Constructor Summary
init(any controller)
          Constructor
 
Method Summary
 string formatRBString(string rbString, any substituteValues)
          performs messageFormat like operation on compound rb string
 array getRBKeys(any rbFile, [any rbLocale=''])
          returns array of keys in java resource bundle per locale
 any getRBString(any rbFile, any rbKey, [any rbLocale=''], [any default])
          returns text for given key in given java resource bundle per locale
 any getResource(any resource, [any default], [any locale='[runtime expression]'], [any values])
          Returns bundle resource from loaded bundle, if it exists, according to locale
 any getResourceBundle(any rbFile, [any rbLocale='en_US'])
          Reads,parses and RETURNS a resource bundle in structure format
 struct getVersion()
          Returns version of this CFC and java library it uses
 void loadBundle(string rbFile, [string rbLocale='en_US'])
          Reads,parses and saves the resource bundle per locale in internal ColdBox structures
 string messageFormat(string thisPattern, any args, [any thisLocale=''])
          performs messageFormat on compound rb string
 boolean verifyPattern(string pattern)
          performs verification on MessageFormat pattern
 
Methods inherited from class coldbox.system.Plugin
getPluginDescription, getPluginName, getPluginVersion, getRequestCollection, getRequestContext, getpluginAuthor, getpluginAuthorURL, getpluginPath, setPluginDescription, setPluginName, setPluginVersion, setpluginAuthor, setpluginAuthorURL
 
Methods inherited from class coldbox.system.FrameworkSupertype
$abort, $dump, $htmlhead, $include, $rethrow, $throw, addAsset, announceInterception, getColdboxOCM, getController, getDatasource, getDebugMode, getInterceptor, getMailService, getMailSettings, getMemento, getModel, getModuleSettings, getMyPlugin, getNewMail, getPlugin, getSetting, getSettingStructure, getSettingsBean, getValidationManager, getfwLocale, includeUDF, loadGlobalUDFLibraries, locateDirectoryPath, locateFilePath, persistVariables, populateModel, relocate, renderExternalView, renderLayout, renderView, runEvent, setDebugMode, setNextEvent, setNextRoute, setSetting, setfwLocale, settingExists, validateModel
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(any controller)
Constructor

Parameters:
controller
Method Detail

formatRBString

public string formatRBString(string rbString, any substituteValues)
performs messageFormat like operation on compound rb string. So if you have a string with {1} it will replace it. You can also have multiple and send in an array to do replacements.

Parameters:
rbString
substituteValues - Array, Struct or single value to format.

getRBKeys

public array getRBKeys(any rbFile, [any rbLocale=''])
returns array of keys in java resource bundle per locale

Parameters:
rbFile - This must be the path + filename UP to but NOT including the locale. We auto-add the local and .properties to the end.
rbLocale - The locale to use, if not passed, defaults to default locale.

getRBString

public any getRBString(any rbFile, any rbKey, [any rbLocale=''], [any default])
returns text for given key in given java resource bundle per locale

Parameters:
rbFile - This must be the path + filename UP to but NOT including the locale. We auto-add the local and .properties to the end.
rbKey - The key to retrieve
rbLocale - The locale of the bundle. Default is en_US
default - A default value to send back if resource not found

getResource

public any getResource(any resource, [any default], [any locale='[runtime expression]'], [any values])
Returns bundle resource from loaded bundle, if it exists, according to locale. To get a resource string from non loaded RB's, use getRBString

Overrides:
getResource in class FrameworkSupertype
Parameters:
resource - The resource to retrieve from the loaded bundle.
default - A default value to send back if resource not found
locale - Pass in which locale to take the resource from. By default it uses the user's current set locale
values - An array, struct or simple string of value replacements to use on the resource string

getResourceBundle

public any getResourceBundle(any rbFile, [any rbLocale='en_US'])
Reads,parses and RETURNS a resource bundle in structure format

Parameters:
rbFile - This must be the path + filename UP to but NOT including the locale. We auto-add the local and .properties to the end.
rbLocale - The locale of the resource bundle

getVersion

public struct getVersion()
Returns version of this CFC and java library it uses.


loadBundle

public void loadBundle(string rbFile, [string rbLocale='en_US'])
Reads,parses and saves the resource bundle per locale in internal ColdBox structures.

Parameters:
rbFile - This must be the path + filename UP to but NOT including the locale. We auto-add .properties to the end.
rbLocale

messageFormat

public string messageFormat(string thisPattern, any args, [any thisLocale=''])
performs messageFormat on compound rb string

Parameters:
thisPattern - pattern to use in formatting
args - substitution values, simple or array
thisLocale - locale to use in formatting, defaults to en_US

verifyPattern

public boolean verifyPattern(string pattern)
performs verification on MessageFormat pattern

Parameters:
pattern - format pattern to test

ColdBox Platform Version 3.7.0