Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.repo.i18n
Interface MessageService
All Superinterfaces:
MessageLookup

public interface MessageService
extends MessageLookup
Utility class providing methods to access the Locale of the current thread and to get Localised strings. These strings may be loaded from resource bundles deployed in the Repository.

Method Summary
void
destroy()
getBaseBundleName(String resourceName)
getContentLocale()
          Get the content local for the current thread. This will revert to getLocale() if no value has been defined.
getLocale()
          Get the general local for the current thread, will revert to the default locale if none specified for this thread.
getNearestLocale(Locale templateLocale, Set<Locale> options)
          Searches for the nearest locale from the available options.
getRegisteredBundles()
          Get set of registered message resource bundles
getRepoResourceBundle(StoreRef storeRef, String path, Locale locale)
          Get message resource bundle from the repository note: also used by Web Client (ResourceBundleWrapper)
void
init()
void
onDisableTenant()
void
onEnableTenant()
parseLocale(String localeStr)
          Factory method to create a Locale from a lang_country_variant string.
void
register(org.alfresco.repo.i18n.MessageDeployer messageDeployer)
          Register message deployer with message service
void
registerResourceBundle(String bundleBasePath)
          Register a resource bundle.
void
setContentLocale(Locale locale)
          Set the content locale for the current thread.
void
setLocale(Locale locale)
          Set the locale for the current thread.
void
unregisterResourceBundle(String resBundlePath)
          Unregister a resource bundle
Methods inherited from interface org.alfresco.service.cmr.i18n.MessageLookup
getMessage, getMessage, getMessage, getMessage
Method Detail
setLocale
void setLocale(Locale locale)
Set the locale for the current thread.
Parameters:
locale - the locale

getLocale
Locale getLocale()
Get the general local for the current thread, will revert to the default locale if none specified for this thread.
Returns:
the general locale

setContentLocale
void setContentLocale(Locale locale)
Set the content locale for the current thread.
Parameters:
locale - the content locale

getContentLocale
Locale getContentLocale()
Get the content local for the current thread.
This will revert to getLocale() if no value has been defined.
Returns:
Returns the content locale

getNearestLocale
Locale getNearestLocale(Locale templateLocale,
                        Set<Locale> options)
Searches for the nearest locale from the available options. To match any locale, pass in null.
Parameters:
templateLocale - the template to search for or null to match any locale
options - the available locales to search from
Returns:
Returns the best match from the available options, or the null if all matches fail

parseLocale
Locale parseLocale(String localeStr)
Factory method to create a Locale from a lang_country_variant string.
Parameters:
localeStr - e.g. fr_FR
Returns:
Returns the locale instance, or the default if the string is invalid

registerResourceBundle
void registerResourceBundle(String bundleBasePath)
Register a resource bundle.

This should be the bundle base path eg, alfresco/messages/errors or, workspace://SpaceStore/app:company_home/app:dictionary/app:labels/cm:errors

Once registered the messages will be available via getMessage, assuming the bundle resource exists at the given path location.

Parameters:
bundleBasePath - the bundle base path

unregisterResourceBundle
void unregisterResourceBundle(String resBundlePath)
Unregister a resource bundle

This should be the bundle base path eg alfresco/messages/errors or workspace://SpaceStore/app:company_home/app:dictionary/app:labels/cm:errors

Once unregistered the messages will no longer be available via getMessage

Parameters:
resBundlePath - the bundle base path

getRepoResourceBundle
ResourceBundle getRepoResourceBundle(StoreRef storeRef,
                                     String path,
                                     Locale locale)
                              throws IOException
Get message resource bundle from the repository note: also used by Web Client (ResourceBundleWrapper)
Parameters:
storeRef - store ref
path - repository path (XPath)
locale - locale
Returns:
input stream
Throws:
IOException

getRegisteredBundles
Set<StringgetRegisteredBundles()
Get set of registered message resource bundles
Returns:
set of registered bundles

register
void register(org.alfresco.repo.i18n.MessageDeployer messageDeployer)
Register message deployer with message service
Parameters:
messageDeployer - MessageDeployer

getBaseBundleName
String getBaseBundleName(String resourceName)

onEnableTenant
void onEnableTenant()

onDisableTenant
void onDisableTenant()

init
void init()

destroy
void destroy()

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.