Package org.incendo.cloud.translations
Interface TranslationBundle<C>
- Type Parameters:
C- command sender type
- All Superinterfaces:
CaptionProvider<C>
A bundle of translations.
This can be registered to the command manager by accessing the caption registry using
CommandManager.captionRegistry() and then registering the provider using
CaptionRegistry.registerProvider(CaptionProvider):
TranslationBundle<C> bundle = TranslationBundle.core(sender -> sender.locale());
manager.captionRegistry().registerProvider(translationBundle);-
Method Summary
Modifier and TypeMethodDescriptionstatic <C> @NonNull TranslationBundle<C>core(@NonNull LocaleExtractor<C> localeExtractor) Returns the translation bundle for the cloud-core translations.Returns the extractor that extract locales from senders of typeTranslationBundle.static <C> @NonNull TranslationBundle<C>resourceBundle(@NonNull String baseName, @NonNull LocaleExtractor<C> localeExtractor) Creates a new translation bundle backed by aResourceBundlewith the givenbaseName.translations(@NonNull Locale locale) Returns the translations for the givenlocale.
-
Method Details
-
resourceBundle
static <C> @NonNull TranslationBundle<C> resourceBundle(@NonNull String baseName, @NonNull LocaleExtractor<C> localeExtractor) Creates a new translation bundle backed by aResourceBundlewith the givenbaseName.- Type Parameters:
C- command sender type- Parameters:
baseName- resource bundle base namelocaleExtractor- locale extractor- Returns:
- the translation bundle
-
core
Returns the translation bundle for the cloud-core translations.- Type Parameters:
C- command sender type- Parameters:
localeExtractor- locale extractor- Returns:
- the translation bundle
-
localeExtractor
@NonNull LocaleExtractor<C> localeExtractor()Returns the extractor that extract locales from senders of typeTranslationBundle.- Returns:
- locale extractor
-
translations
Returns the translations for the givenlocale.- Parameters:
locale- translation locale- Returns:
- the translations, or
nullif the givenlocaleis not supported
-
provide
- Specified by:
providein interfaceCaptionProvider<C>
-