|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.loom.i18n.DefaultMessagesRepositoryFactory
@Singleton public class DefaultMessagesRepositoryFactory
Default MessagesRepositoryFactory implementation. Searches for the specified properties files in the classpath.
Constructor Summary | |
---|---|
DefaultMessagesRepositoryFactory()
|
Method Summary | |
---|---|
void |
addBrowserMessage(java.lang.String messageKey)
Add a message key that should be forwarded to the browser. |
protected boolean |
checkResourceExists(java.lang.String resourceName)
|
java.util.Set<java.lang.String> |
getBrowserMessages()
|
java.util.Locale |
getDefaultLocale()
|
java.util.List<java.lang.String> |
getLocations()
|
MissingMessageHandler |
getMissingMessagesHandler()
|
protected java.util.Locale |
getNearestSupportedLocale(java.util.Locale locale)
Will look in the list of configured locations and return the first partial locale match |
MessagesRepository |
getRepository(java.util.Locale locale)
Get a repository (if already created) or creates a new one if not. |
java.util.List<org.springframework.core.io.Resource> |
getResources(java.util.Locale locale)
|
protected MessagesRepository |
initRepository(java.util.Locale locale)
Initialize a new repository instance. |
void |
setBrowserMessages(java.util.Set<java.lang.String> browserKeys)
Add a set of Json keys |
void |
setDefaultLocale(java.util.Locale defaultLocale)
|
void |
setIncludeLoomResourcesInJson(boolean includeLoomResourcesInJson)
|
void |
setLocations(java.util.List<java.lang.String> locations)
Replace this factory locations with the provided list |
void |
setMissingMessagesHandler(MissingMessageHandler missingMessagesHandler)
|
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultMessagesRepositoryFactory()
Method Detail |
---|
public MessagesRepository getRepository(java.util.Locale locale)
MessagesRepository
instance will be created for the first Locale fragment
that is a match for any properties file.
For example, if messages_es and messages_en are found in the classpath and a
request for es_ES_CA is received, a MessagesRepository for "es" (the first supported Locale)
will be returned.
If not found, a Messagesrepository for defaultLocale will be returned.
getRepository
in interface MessagesRepositoryFactory
public java.util.List<org.springframework.core.io.Resource> getResources(java.util.Locale locale)
locale
-
protected MessagesRepository initRepository(java.util.Locale locale)
protected java.util.Locale getNearestSupportedLocale(java.util.Locale locale)
protected boolean checkResourceExists(java.lang.String resourceName)
public void addBrowserMessage(java.lang.String messageKey)
addBrowserMessage
in interface MessagesRepositoryFactory
messageKey
- the message key to be addedpublic void setBrowserMessages(java.util.Set<java.lang.String> browserKeys)
setBrowserMessages
in interface MessagesRepositoryFactory
browserKeys
- the new set of JSON keyspublic java.util.Locale getDefaultLocale()
getDefaultLocale
in interface MessagesRepositoryFactory
public void setDefaultLocale(java.util.Locale defaultLocale)
public void setLocations(java.util.List<java.lang.String> locations)
locations
- new list of properties file locations@Inject public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
public java.util.List<java.lang.String> getLocations()
public java.util.Set<java.lang.String> getBrowserMessages()
public MissingMessageHandler getMissingMessagesHandler()
public void setMissingMessagesHandler(MissingMessageHandler missingMessagesHandler)
public void setIncludeLoomResourcesInJson(boolean includeLoomResourcesInJson)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |