Package com.lokalized
Class LocalizedString
java.lang.Object
com.lokalized.LocalizedString
Represents a single localized string - its key, translated value, and any associated translation rules.
Normally instances are sourced from a file which contains all localized strings for a given locale.
- Author:
- Mark Allen
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder used to construct instances ofLocalizedString
.static class
Container for per-language-form (gender, cardinal, ordinal) translation information.static class
Container for per-language-form cardinality translation information over a range (start, end) of values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if this object is equal to another one.Gets alternative expression-driven translations for this string.Gets this string's commentary (usage/translation notes).getKey()
Gets this string's translation key.Gets per-language-form translations that correspond to a placeholder value.Gets this string's default translation, if available.int
hashCode()
A hash code for this object.toString()
Generates aString
representation of this object.
-
Method Details
-
toString
Generates aString
representation of this object. -
equals
Checks if this object is equal to another one. -
hashCode
A hash code for this object. -
getKey
Gets this string's translation key.- Returns:
- this string's translation key, not null
-
getTranslation
Gets this string's default translation, if available.- Returns:
- this string's default translation, not null
-
getCommentary
Gets this string's commentary (usage/translation notes).- Returns:
- this string's commentary, not null
-
getLanguageFormTranslationsByPlaceholder
@Nonnull public Map<String,LocalizedString.LanguageFormTranslation> getLanguageFormTranslationsByPlaceholder()Gets per-language-form translations that correspond to a placeholder value.For example, language form
MASCULINE
might be translated asHe
for placeholdersubject
.- Returns:
- per-language-form translations that correspond to a placeholder value, not null
-
getAlternatives
Gets alternative expression-driven translations for this string.In this context, the
key
for each alternative is a localization expression, not a translation key.For example, if
bookCount == 0
you might want to sayI haven't read any books
instead ofI read 0 books
.- Returns:
- alternative expression-driven translations for this string, not null
-