Files
alfresco-community-repo/source/java/org/alfresco/repo/i18n/MessageService.java
Raluca Munteanu 8674e2bfc8 Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125603 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
      125484 slanglois: MNT-16155 Update source headers - remove old Copyrights from Java and JSP dource files


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2016-04-26 12:48:49 +00:00

127 lines
4.1 KiB
Java

package org.alfresco.repo.i18n;
import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Set;
import org.alfresco.api.AlfrescoPublicApi;
import org.alfresco.repo.tenant.TenantDeployer;
import org.alfresco.service.cmr.i18n.MessageLookup;
import org.alfresco.service.cmr.repository.StoreRef;
/**
* 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.
*/
@AlfrescoPublicApi
public interface MessageService extends TenantDeployer, MessageLookup
{
/**
* Set the locale for the current thread.
*
* @param locale the locale
*/
public void setLocale(Locale locale);
/**
* Get the general local for the current thread, will revert to the default locale if none
* specified for this thread.
*
* @return the general locale
*/
public Locale getLocale();
/**
* Set the <b>content locale</b> for the current thread.
*
* @param locale the content locale
*/
public void setContentLocale(Locale locale);
/**
* Get the content local for the current thread.<br/>
* This will revert to {@link #getLocale()} if no value has been defined.
*
* @return Returns the content locale
*/
public Locale getContentLocale();
/**
* Searches for the nearest locale from the available options. To match any locale, pass in
* <tt>null</tt>.
*
* @param templateLocale the template to search for or <tt>null</tt> to match any locale
* @param options the available locales to search from
* @return Returns the best match from the available options, or the <tt>null</tt> if
* all matches fail
*/
public Locale getNearestLocale(Locale templateLocale, Set<Locale> options);
/**
* Factory method to create a Locale from a <tt>lang_country_variant</tt> string.
*
* @param localeStr e.g. fr_FR
* @return Returns the locale instance, or the {@link Locale#getDefault() default} if the
* string is invalid
*/
public Locale parseLocale(String localeStr);
/**
* Register a resource bundle.
* <p>
* This should be the bundle base path
* eg, alfresco/messages/errors
* or, workspace://SpaceStore/app:company_home/app:dictionary/app:labels/cm:errors
* <p>
* Once registered the messages will be available via getMessage, assuming the
* bundle resource exists at the given path location.
*
* @param bundleBasePath the bundle base path
*/
public void registerResourceBundle(String bundleBasePath);
/**
* Unregister a resource bundle
* <p>
* This should be the bundle base path
* eg alfresco/messages/errors
* or workspace://SpaceStore/app:company_home/app:dictionary/app:labels/cm:errors
* <p>
* Once unregistered the messages will no longer be available via getMessage
*
* @param resBundlePath the bundle base path
*/
public void unregisterResourceBundle(String resBundlePath);
/**
* Get message resource bundle from the repository
*
* note: also used by Web Client (ResourceBundleWrapper)
*
* @param storeRef store ref
* @param path repository path (XPath)
* @param locale locale
* @return input stream
*/
public ResourceBundle getRepoResourceBundle(StoreRef storeRef, String path, Locale locale) throws IOException;
/**
* Get set of registered message resource bundles
*
* @return set of registered bundles
*/
public Set<String> getRegisteredBundles();
/**
* Register message deployer with message service
*
* @param messageDeployer MessageDeployer
*/
public void register(MessageDeployer messageDeployer);
public String getBaseBundleName(String resourceName);
}