Search in sources :

Example 1 with LocalizableMessageList

use of com.evolveum.midpoint.util.LocalizableMessageList in project midpoint by Evolveum.

the class LocalizationServiceImpl method translate.

// todo deduplicate with similar method in WebComponentUtil
public String translate(LocalizableMessageList msgList, Locale locale) {
    String separator = translateIfPresent(msgList.getSeparator(), locale);
    String prefix = translateIfPresent(msgList.getPrefix(), locale);
    String suffix = translateIfPresent(msgList.getPostfix(), locale);
    return msgList.getMessages().stream().map(m -> translate(m, locale)).collect(Collectors.joining(separator, prefix, suffix));
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) NoSuchMessageException(org.springframework.context.NoSuchMessageException) URL(java.net.URL) SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) Trace(com.evolveum.midpoint.util.logging.Trace) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) URLClassLoader(java.net.URLClassLoader) PolyStringTranslationArgumentType(com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationArgumentType) SingleLocalizableMessage(com.evolveum.midpoint.util.SingleLocalizableMessage) Locale(java.util.Locale) LocalizableMessageList(com.evolveum.midpoint.util.LocalizableMessageList) LocalizableMessage(com.evolveum.midpoint.util.LocalizableMessage) MessageSource(org.springframework.context.MessageSource) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) CommonException(com.evolveum.midpoint.util.exception.CommonException) List(java.util.List) SystemException(com.evolveum.midpoint.util.exception.SystemException) PolyStringTranslationType(com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationType) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) NotNull(org.jetbrains.annotations.NotNull) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Aggregations

MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)1 LocalizableMessage (com.evolveum.midpoint.util.LocalizableMessage)1 LocalizableMessageList (com.evolveum.midpoint.util.LocalizableMessageList)1 SingleLocalizableMessage (com.evolveum.midpoint.util.SingleLocalizableMessage)1 CommonException (com.evolveum.midpoint.util.exception.CommonException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 Trace (com.evolveum.midpoint.util.logging.Trace)1 TraceManager (com.evolveum.midpoint.util.logging.TraceManager)1 PolyStringTranslationArgumentType (com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationArgumentType)1 PolyStringTranslationType (com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationType)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1 File (java.io.File)1 IOException (java.io.IOException)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 StandardCharsets (java.nio.charset.StandardCharsets)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1