TranslatableString
API
class TranslatableString {
TranslatableString tr(String pattern, Object... paramArgs) (1)
TranslatableString trn(String singularPattern, String pluralPattern, int number, Object... paramArgs) (2)
String getSingularText() (3)
String getPluralText() (4)
boolean isPluralForm()
Map<String, Object> getArgumentsByParameterName() (5)
String translate(TranslationService translationService, TranslationContext context) (6)
String getPattern() (7)
String translated(String translatedText)
String format(String format, Map<String, Object> values)
boolean equals(Object o)
int hashCode()
String toString()
}
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 | getSingularText()
The text as provided in (either of the #tr(String, Object…) factory #trn(String, String, int, Object…) method s, with placeholders rather than substituted arguments; if #isPluralForm() is |
4 | getPluralText()
The plural text as provided in the #trn(String, String, int, Object…) factory method , with placeholders rather than substituted arguments; but will be |
5 | getArgumentsByParameterName()
The arguments; excluded from #equals(Object) comparison. |
6 | translate(TranslationService, TranslationContext)
Translates this string using the provided TranslationService , selecting either the single or plural form as per #getPattern() . |
7 | getPattern()
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
getSingularText()
The text as provided in (either of the #tr(String, Object…) factory #trn(String, String, int, Object…) method s, with placeholders rather than substituted arguments; if #isPluralForm() is true
then used only for the singular form.
getPluralText()
The plural text as provided in the #trn(String, String, int, Object…) factory method , with placeholders rather than substituted arguments; but will be null
if #isPluralForm() is false
.
translate(TranslationService, TranslationContext)
Translates this string using the provided TranslationService , selecting either the single or plural form as per #getPattern() .
getPattern()
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.