Class ResourceBundleLocalizationFunction.Builder
java.lang.Object
net.dv8tion.jda.api.interactions.commands.localization.ResourceBundleLocalizationFunction.Builder
- Enclosing class:
ResourceBundleLocalizationFunction
Builder for
Use the factory methods in
ResourceBundleLocalizationFunction
Use the factory methods in
ResourceBundleLocalizationFunction
to create instances of this builder- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddBundle
(ResourceBundle resourceBundle, DiscordLocale locale) Adds a resource bundle to this builderaddBundles
(String baseName, DiscordLocale... locales) Adds a resource bundle to this builder
This will insert the resource bundles with the specified name, with each specified locale.build()
Builds the resource bundle localization function.
-
Method Details
-
addBundle
@Nonnull public ResourceBundleLocalizationFunction.Builder addBundle(@Nonnull ResourceBundle resourceBundle, @Nonnull DiscordLocale locale) Adds a resource bundle to this builderYou can see
ResourceBundleLocalizationFunction.fromBundle(ResourceBundle, DiscordLocale)
for an example- Parameters:
resourceBundle
- TheResourceBundle
to get the localized strings fromlocale
- TheDiscordLocale
of the resources- Returns:
- This builder for chaining convenience
- Throws:
IllegalArgumentException
-- If the resource bundle is null
- If the locale is null
- If the locale is
DiscordLocale.UNKNOWN
- See Also:
-
addBundles
@Nonnull public ResourceBundleLocalizationFunction.Builder addBundles(@Nonnull String baseName, @Nonnull DiscordLocale... locales) Adds a resource bundle to this builder
This will insert the resource bundles with the specified name, with each specified locale.You can see
ResourceBundleLocalizationFunction.fromBundles(String, DiscordLocale...)
for an example- Parameters:
baseName
- The base name of the resource bundle, for example, the base name of"MyBundle_fr_FR.properties"
would be"MyBundle"
locales
- The locales to get from the resource bundle- Returns:
- This builder for chaining convenience
- Throws:
IllegalArgumentException
-- If the base name is null
- If the locales or one of the locale is null
- If one of the locale is
DiscordLocale.UNKNOWN
- See Also:
-
build
Builds the resource bundle localization function.- Returns:
- The new
ResourceBundleLocalizationFunction
-