@Service @Transactional(propagation=REQUIRES_NEW) public class LocalizationManagement extends Object
Constructor and Description |
---|
LocalizationManagement() |
Modifier and Type | Method and Description |
---|---|
Map<Language,Message> |
getAvailableLanguages(String messageKey,
boolean resourceBundleFallback)
Return for a given message key the localized message for each of the currently available
languages
|
String |
getCustomMessage(String messageKey,
Locale locale)
Method to get a custom localized message from the database.
|
LocalizedMessage |
getCustomMessageFallback(String messageKey)
Get a fallback that was set with
setCustomMessageFallback(String, LocalizedMessage) |
Message |
getMessage(String messageKey,
Locale locale)
Method to get a custom localized message from the database.
|
void |
removeCustomMessageFallback(String messageKey)
Remove a fallback which was set with
setCustomMessageFallback(String, LocalizedMessage) |
void |
setCustomMessageFallback(String messageKey,
LocalizedMessage fallback)
Set a falback for a custom message.
|
void |
setMessage(String messageKey,
String messageValue,
String languageCode,
boolean isHtml)
Method to update or create message.
|
@Transactional(readOnly=true) public Map<Language,Message> getAvailableLanguages(String messageKey, boolean resourceBundleFallback)
messageKey
- The message key to load.resourceBundlefallback
- whether to return a fallback with the same key from the resource bundle if there
is no message for the given key in the database@Transactional(readOnly=true) public String getCustomMessage(String messageKey, Locale locale)
messageKey
- The message key.locale
- The locale.setCustomMessageFallback(String, LocalizedMessage)
or from the local
resources.@Transactional(propagation=SUPPORTS) public LocalizedMessage getCustomMessageFallback(String messageKey)
setCustomMessageFallback(String, LocalizedMessage)
messageKey
- the key of the message@Transactional(readOnly=true) public Message getMessage(String messageKey, Locale locale)
messageKey
- The message key.locale
- The locale.@Transactional(propagation=SUPPORTS) public void removeCustomMessageFallback(String messageKey)
setCustomMessageFallback(String, LocalizedMessage)
messageKey
- the key of the fallback to remove@Transactional(propagation=SUPPORTS) public void setCustomMessageFallback(String messageKey, LocalizedMessage fallback)
messageKey
- the key of the fallbackfallback
- the fallbackCopyright © 2019 Communote team. All rights reserved.