-
- All Known Implementing Classes:
Context
,LocalizationService
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Translator
A class implementing this interface is able to translate strings.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Locale
getLocale()
Gets the locale used by this translator.static Translator
to(Locale locale)
Creates a newTranslator
that translates to the target locale.default String
translate(String bundle, String key, Object... args)
Translates a string.
-
-
-
Method Detail
-
to
static Translator to(Locale locale)
Creates a newTranslator
that translates to the target locale.- Parameters:
locale
- the target locale- Returns:
- a new
Translator
-
translate
default String translate(String bundle, String key, Object... args)
Translates a string.- Parameters:
bundle
- the name of the bundle where to find the stringskey
- the key identifying the stringargs
- the arguments of the string, if any- Returns:
- the translated string
-
getLocale
Locale getLocale()
Gets the locale used by this translator.- Returns:
- the locale
-
-