[[Dashboard | << Back to Dashboard ]] {| align="right" | __TOC__ |} = Exploring the ResourceBundle Plugin = == Overview == Reads and parses java resource bundles per locale == getVersion == Returns version of this CFC and java library it uses. === Returns === * This function returns ''struct'' === Examples === == verifyPattern == performs verification on MessageFormat pattern === Returns === * This function returns ''boolean'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | pattern || string || Yes || --- || format pattern to test |} === Examples === == getRBKeys == returns array of keys in java resource bundle per locale === Returns === * This function returns ''array'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | rbFile || any || Yes || --- || This must be the path + filename UP to but NOT including the locale. We auto-add the local and .properties to the end. |- | rbLocale || any || No || || The locale to use, if not passed, defaults to default locale. |} === Examples === == getResourceBundle == Reads,parses and RETURNS a resource bundle in structure format === Returns === * This function returns ''any'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | rbFile || any || Yes || --- || This must be the path + filename UP to but NOT including the locale. We auto-add the local and .properties to the end. |- | rbLocale || any || No || en_US || The locale of the resource bundle |} === Examples === == formatRBString == 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. === Returns === * This function returns ''string'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | rbString || string || Yes || --- || |- | substituteValues || any || Yes || --- || Array or single value to format. |} === Examples === == loadBundle == Reads,parses and saves the resource bundle per locale in internal ColdBox structures. === Returns === * This function returns ''void'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | rbFile || string || Yes || --- || This must be the path + filename UP to but NOT including the locale. We auto-add .properties to the end. |- | rbLocale || string || No || en_US || |} === Examples === == getRBString == returns text for given key in given java resource bundle per locale === Returns === * This function returns ''any'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | rbFile || any || Yes || --- || This must be the path + filename UP to but NOT including the locale. We auto-add the local and .properties to the end. |- | rbKey || any || Yes || --- || The key to retrieve |- | rbLocale || any || No || || The locale of the bundle. Default is en_US |- | default || any || No || --- || A default value to send back if resource not found |} === Examples === == getResource == Returns bundle resource from loaded bundle, if it exists, according to locale. To get a resource string from non loaded RB's, use getRBString === Returns === * This function returns ''any'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | resource || any || Yes || --- || The resource to retrieve from the loaded bundle. |- | default || any || No || --- || A default value to send back if resource not found |- | locale || any || No || [runtime expression] || Pass in which locale to take the resource from. By default it uses the user's current set locale |} === Examples === == messageFormat == performs messageFormat on compound rb string === Returns === * This function returns ''string'' === Arguments === {| cellpadding="5", class="tablelisting" ! '''Key''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description''' |- | thisPattern || string || Yes || --- || pattern to use in formatting |- | args || any || Yes || --- || substitution values, simple or array |- | thisLocale || any || No || || locale to use in formatting, defaults to en_US |} === Examples ===