public interface MessageService
extends org.alfresco.repo.tenant.TenantDeployer
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getBaseBundleName(java.lang.String resourceName) |
java.util.Locale |
getContentLocale()
Get the content local for the current thread.
This will revert to MessageService.getLocale() if no value has been defined. |
java.util.Locale |
getLocale()
Get the general local for the current thread, will revert to the default locale if none
specified for this thread.
|
java.lang.String |
getMessage(java.lang.String messageKey)
Get message from registered resource bundle.
|
java.lang.String |
getMessage(java.lang.String messageKey,
java.util.Locale locale)
Get a localised message string
|
java.lang.String |
getMessage(java.lang.String messageKey,
java.util.Locale locale,
java.lang.Object[] params)
Get a localised message string, parameterized using standard MessageFormatter.
|
java.lang.String |
getMessage(java.lang.String messageKey,
java.lang.Object[] params)
Get a localised message string, parameterized using standard MessageFormatter.
|
java.util.Locale |
getNearestLocale(java.util.Locale templateLocale,
java.util.Set options)
Searches for the nearest locale from the available options.
|
java.util.Set |
getRegisteredBundles()
Get set of registered message resource bundles
|
java.util.ResourceBundle |
getRepoResourceBundle(org.alfresco.service.cmr.repository.StoreRef storeRef,
java.lang.String path,
java.util.Locale locale)
Get message resource bundle from the repository
note: also used by Web Client (ResourceBundleWrapper)
|
java.util.Locale |
parseLocale(java.lang.String localeStr)
Factory method to create a Locale from a lang_country_variant string.
|
void |
register(MessageDeployer messageDeployer)
Register message deployer with message service
|
void |
registerResourceBundle(java.lang.String bundleBasePath)
Register a resource bundle.
|
void |
setContentLocale(java.util.Locale locale)
Set the content locale for the current thread.
|
void |
setLocale(java.util.Locale locale)
Set the locale for the current thread.
|
void |
unregisterResourceBundle(java.lang.String resBundlePath)
Unregister a resource bundle
|
void setLocale(java.util.Locale locale)
locale - the localejava.util.Locale getLocale()
void setContentLocale(java.util.Locale locale)
locale - the content localejava.util.Locale getContentLocale()
MessageService.getLocale() if no value has been defined.java.util.Locale getNearestLocale(java.util.Locale templateLocale,
java.util.Set options)
templateLocale - the template to search for or null to match any localeoptions - the available locales to search fromjava.util.Locale parseLocale(java.lang.String localeStr)
localeStr - e.g. fr_FRdefault if the
string is invalidvoid registerResourceBundle(java.lang.String bundleBasePath)
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.
bundleBaseName - the bundle base pathjava.lang.String getMessage(java.lang.String messageKey)
messageKey - message keyjava.lang.String getMessage(java.lang.String messageKey,
java.util.Locale locale)
messageKey - the message keylocale - override the current localejava.lang.String getMessage(java.lang.String messageKey,
java.lang.Object[] params)
messageKey - message keyparams - format parametersjava.lang.String getMessage(java.lang.String messageKey,
java.util.Locale locale,
java.lang.Object[] params)
messageKey - the message keylocale - override current localeparams - the localised message stringvoid unregisterResourceBundle(java.lang.String resBundlePath)
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
bundleBaseName - the bundle base pathjava.util.ResourceBundle getRepoResourceBundle(org.alfresco.service.cmr.repository.StoreRef storeRef,
java.lang.String path,
java.util.Locale locale)
throws java.io.IOException
storeRef - store refpath - repository path (XPath)locale - localejava.io.IOExceptionjava.util.Set getRegisteredBundles()
void register(MessageDeployer messageDeployer)
messageDeployer - java.lang.String getBaseBundleName(java.lang.String resourceName)
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.