TranslatableString (record)
API
record TranslatableString {
TranslatableString tr(String pattern, Object... paramArgs) (1)
TranslatableString trn(String singularPattern, String pluralPattern, int number, Object... paramArgs) (2)
String translate(TranslationService translationService, TranslationContext context) (3)
String pattern() (4)
boolean equals(Object o)
int hashCode()
String toString()
String translated(String translatedText)
}
1 | tr(String, Object)
A translatable string with a single pattern for both singular and plural forms. |
2 | trn(String, String, int, Object)
A translatable string with different patterns for singular and plural forms, selected automatically by the number |
3 | translate(TranslationService, TranslationContext)
Translates this string using the provided TranslationService , selecting either the single or plural form as per #pattern() . |
4 | pattern()
The text to be translated; depends on whether #isPluralForm() and whether to be translated. |
Members
trn(String, String, int, Object)
A translatable string with different patterns for singular and plural forms, selected automatically by the number
translate(TranslationService, TranslationContext)
Translates this string using the provided TranslationService , selecting either the single or plural form as per #pattern() .
pattern()
The text to be translated; depends on whether #isPluralForm() and whether to be translated.
Any placeholders will not have been replaced.
NB: this method is exposed only so that implementations of org.apache.causeway.applib.exceptions.TranslatableException can return a non-null Exception#getMessage() message when only a translatable message has been provided.