Package de.xima.fc.common.locale
Interface IMessageLocalizer
-
- All Superinterfaces:
Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface IMessageLocalizer extends Serializable
Interface for objects that can localize message keys in a given locale, optional with parameters.- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancanLocalize(Locale locale, String messageKey)Checks if a message key can be localized in the given localStringlocalize(Locale locale, String messageKey, Object... parameters)Localizes a message key in the given locale.
-
-
-
Method Detail
-
canLocalize
default boolean canLocalize(Locale locale, String messageKey)
Checks if a message key can be localized in the given localThe default implementation invokes
localize(Locale, String, Object...)and checks if the result is not null and does not start or end with a question mark (which indicates a missing localization in our convention).- Parameters:
locale- The locale to check.messageKey- The message key to check.- Returns:
- True if the message key can be localized, false otherwise.
-
localize
String localize(Locale locale, String messageKey, Object... parameters)
Localizes a message key in the given locale.- Parameters:
locale- The locale to localize the message in.messageKey- The message key to localize.parameters- Optional parameters to replace in the message.- Returns:
- The localized message.
-
-