Package de.xima.fc.common.locale
Interface IBoundMessageLocalizer
-
- 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 IBoundMessageLocalizer extends Serializable
Interface for objects that can localize message keys in a contextually bound locale, optional with parameters.- Since:
- 8.4.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancanLocalize(String messageKey)Checks if a message key can be localized in the given localStringlocalize(String message, Object... parameters)Localizes a message key in the given locale.
-
-
-
Method Detail
-
canLocalize
default boolean canLocalize(String messageKey)
Checks if a message key can be localized in the given localThe default implementation invokes
localize(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:
messageKey- The message key to check.- Returns:
- True if the message key can be localized, false otherwise.
-
localize
String localize(String message, Object... parameters)
Localizes a message key in the given locale.- Parameters:
message- The message key to localize.parameters- Optional parameters to replace in the message.- Returns:
- The localized message, or null when the message could not be localized.
-
-