TranslatableString

API

TranslatableString.java
class TranslatableString {
  TranslatableString tr(final String pattern, final Object... paramArgs)     (1)
  TranslatableString trn(final String singularPattern, final String pluralPattern, final int number, final Object... paramArgs)     (2)
  String getSingularText()     (3)
  String getPluralText()     (4)
  boolean isPluralForm()
  Map<String, Object> getArgumentsByParameterName()     (5)
  String translate(final TranslationService translationService, final TranslationContext context)     (6)
  String getPattern()     (7)
  String translated(final String translatedText)
  String format(String format, Map<String, Object> values)
  boolean equals(final 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 true then used only for the singular form.

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 null if #isPluralForm() is false .

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

tr(String, Object)

A translatable string with a single pattern for both singular and plural forms.

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 .

getArgumentsByParameterName()

The arguments; excluded from #equals(Object) comparison.

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.isis.applib.exceptions.TranslatableException can return a non-null Exception#getMessage() message when only a translatable message has been provided.