Interface TranslationSource
- All Known Subinterfaces:
BundleTranslationSource,TranslationSourceRegistry
public interface TranslationSource
A helper class for adding translations to your plugin.
-
Method Summary
Modifier and TypeMethodDescription@Nullable TranslationgetTranslation(String key, Locale locale) Returns a translation for the given key ornullif absent.default TranslationgetTranslationOrDefault(String key, Locale locale, Function<String, Translation> fallback) Returns a translation for the given key or a default translation if absent.default TranslationgetTranslationOrMissing(String key, Locale locale) Returns a translation for the given key or a missing translation if absent.static TranslationSourcerouter()Returns aTranslationSourcefor the router language:^).
-
Method Details
-
router
Returns aTranslationSourcefor the router language:^). -
getTranslation
Returns a translation for the given key ornullif absent.- Parameters:
key- the key- Returns:
- the translation, or
nullif no suitable translation was found.
-
getTranslationOrDefault
default Translation getTranslationOrDefault(String key, Locale locale, Function<String, Translation> fallback) Returns a translation for the given key or a default translation if absent.- Parameters:
key- the keylocale- the localefallback- the fallback translation- Returns:
- the translation
-
getTranslationOrMissing
Returns a translation for the given key or a missing translation if absent.- Parameters:
key- the keylocale- the locale- Returns:
- the translation
-