TranslatableException
Exceptions that provide translations should implement this interface.
The org.apache.causeway.applib.services.exceprecog.ExceptionRecognizer will automatically detect and use the translation. In addition, the integration testing support provides a rule ( ExceptionRecognizerTranslations
) that will exercise any thrown exceptions, ensuring tha the message is captured in the translations.po
file so that it can be translated.
API
interface TranslatableException {
TranslatableString getTranslatableMessage() (1)
}
1 | getTranslatableMessage()
In the spirit of Exception#getLocalizedMessage() , but using TranslatableString instead. |
Members
getTranslatableMessage()
In the spirit of Exception#getLocalizedMessage() , but using TranslatableString instead.
If returns null
, then Exception#getMessage() will be used as a fallback. This design allows the Causeway-provided RecoverableException and UnrecoverableException to provide constructors that accept a TranslatableString , but can be left as null for any existing code.