Package com.lokalized
Class LocalizedString.Builder
java.lang.Object
com.lokalized.LocalizedString.Builder
- Enclosing class:
LocalizedString
Builder used to construct instances of
LocalizedString
.
This class is intended for use by a single thread.
- Author:
- Mark Allen
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionalternatives
(List<LocalizedString> alternatives) Applies alternative expression-driven translations to this builder.build()
Constructs an instance ofLocalizedString
.commentary
(String commentary) Applies commentary (usage/translation notes) to this builder.languageFormTranslationsByPlaceholder
(Map<String, LocalizedString.LanguageFormTranslation> languageFormTranslationsByPlaceholder) Applies per-language-form translations to this builder.translation
(String translation) Applies a default translation to this builder.
-
Constructor Details
-
Builder
Constructs a localized string builder with the given key.- Parameters:
key
- this string's translation key, not null
-
-
Method Details
-
translation
Applies a default translation to this builder.- Parameters:
translation
- a default translation, may be null- Returns:
- this builder instance, useful for chaining. not null
-
commentary
Applies commentary (usage/translation notes) to this builder.- Parameters:
commentary
- commentary (usage/translation notes), may be null- Returns:
- this builder instance, useful for chaining. not null
-
languageFormTranslationsByPlaceholder
@Nonnull public LocalizedString.Builder languageFormTranslationsByPlaceholder(@Nullable Map<String, LocalizedString.LanguageFormTranslation> languageFormTranslationsByPlaceholder) Applies per-language-form translations to this builder.- Parameters:
languageFormTranslationsByPlaceholder
- per-language-form translations, may be null- Returns:
- this builder instance, useful for chaining. not null
-
alternatives
Applies alternative expression-driven translations to this builder.- Parameters:
alternatives
- alternative expression-driven translations, may be null- Returns:
- this builder instance, useful for chaining. not null
-
build
Constructs an instance ofLocalizedString
.- Returns:
- an instance of
LocalizedString
, not null
-