Package de.presti.ree6.language
Class LanguageService
java.lang.Object
de.presti.ree6.language.LanguageService
Utility used to work with Languages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionA Hashmap containing the locale as key and the YamlConfiguration as value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCalled to download every Language file from the GitHub Repository.static @NotNull StringgetByEvent(@NotNull CommandEvent commandEvent, @NotNull String key, @Nullable Object... parameter) Called to get a specific String from the Guild specific Language file.static @NotNull StringgetByEvent(@NotNull net.dv8tion.jda.api.events.guild.GenericGuildEvent commandEvent, @NotNull String key, @Nullable Object... parameter) Called to get a specific String from the Guild specific Language file.static @NotNull StringgetByGuild(long guildId, @NotNull String key, @Nullable Object... parameter) Called to get a specific String from the Language file.static @NotNull StringgetByGuild(net.dv8tion.jda.api.entities.Guild guild, @NotNull String key, @Nullable Object... parameter) Called to get a specific String from the Language file.static @NotNull StringgetByGuildOrInteraction(net.dv8tion.jda.api.entities.Guild guild, net.dv8tion.jda.api.interactions.Interaction interaction, @NotNull String key, @Nullable Object... parameter) Called to get a specific String from the Language file.static @NotNull StringgetByInteraction(net.dv8tion.jda.api.interactions.Interaction interaction, @NotNull String key, @Nullable Object... parameter) Called to get a specific String from the Language file.static @NotNull StringgetByLocale(@NotNull String locale, @NotNull String key, @Nullable Object... parameters) Called to get a specific String from the Language file.static @NotNull StringgetByLocale(@NotNull net.dv8tion.jda.api.interactions.DiscordLocale discordLocale, @NotNull String key, @Nullable Object... parameters) Called to get a specific String from the Language file.static @NotNull StringgetDefault(@NotNull String key, @Nullable Object... parameter) Called to get a specific String from the default Language file.static Set<net.dv8tion.jda.api.interactions.DiscordLocale>Called to retrieve all supported Locals.static voidCalled to load every Language file into memory.static @Nullable LanguageloadLanguageFromFile(@NotNull net.dv8tion.jda.api.interactions.DiscordLocale discordLocale) Called to load a Language from a YamlConfiguration.
-
Field Details
-
Constructor Details
-
LanguageService
public LanguageService()
-
-
Method Details
-
initializeLanguages
public static void initializeLanguages()Called to load every Language file into memory. -
downloadLanguages
public static void downloadLanguages()Called to download every Language file from the GitHub Repository. -
loadLanguageFromFile
@Nullable public static @Nullable Language loadLanguageFromFile(@NotNull @NotNull net.dv8tion.jda.api.interactions.DiscordLocale discordLocale) Called to load a Language from a YamlConfiguration.- Parameters:
discordLocale- The DiscordLocale of the Language.- Returns:
- The Language.
-
getByEvent
@NotNull public static @NotNull String getByEvent(@NotNull @NotNull CommandEvent commandEvent, @NotNull @NotNull String key, @Nullable @Nullable Object... parameter) Called to get a specific String from the Guild specific Language file.- Parameters:
commandEvent- the CommandEvent.key- the key of the String.parameter- the parameter to replace.- Returns:
- the String.
-
getByEvent
@NotNull public static @NotNull String getByEvent(@NotNull @NotNull net.dv8tion.jda.api.events.guild.GenericGuildEvent commandEvent, @NotNull @NotNull String key, @Nullable @Nullable Object... parameter) Called to get a specific String from the Guild specific Language file.- Parameters:
commandEvent- the GuildEvent.key- the key of the String.parameter- the parameter to replace.- Returns:
- the String.
-
getByGuildOrInteraction
@NotNull public static @NotNull String getByGuildOrInteraction(net.dv8tion.jda.api.entities.Guild guild, net.dv8tion.jda.api.interactions.Interaction interaction, @NotNull @NotNull String key, @Nullable @Nullable Object... parameter) Called to get a specific String from the Language file.- Parameters:
guild- The Guild to receive the locale from.interaction- The Interaction to receive the locale from.key- The key of the String.parameter- The Parameters to replace placeholders in the String.- Returns:
- The String.
-
getByGuild
@NotNull public static @NotNull String getByGuild(net.dv8tion.jda.api.entities.Guild guild, @NotNull @NotNull String key, @Nullable @Nullable Object... parameter) Called to get a specific String from the Language file.- Parameters:
guild- The Guild to receive the locale from.key- The key of the String.parameter- The Parameters to replace placeholders in the String.- Returns:
- The String.
-
getByGuild
@NotNull public static @NotNull String getByGuild(long guildId, @NotNull @NotNull String key, @Nullable @Nullable Object... parameter) Called to get a specific String from the Language file.- Parameters:
guildId- The Guild ID to receive the locale from.key- The key of the String.parameter- The Parameters to replace placeholders in the String.- Returns:
- The String.
-
getByInteraction
@NotNull public static @NotNull String getByInteraction(net.dv8tion.jda.api.interactions.Interaction interaction, @NotNull @NotNull String key, @Nullable @Nullable Object... parameter) Called to get a specific String from the Language file.- Parameters:
interaction- The Interaction to receive the locale from.key- The key of the String.parameter- The Parameters to replace placeholders in the String.- Returns:
- The String.
-
getDefault
@NotNull public static @NotNull String getDefault(@NotNull @NotNull String key, @Nullable @Nullable Object... parameter) Called to get a specific String from the default Language file.- Parameters:
key- The key of the String.parameter- The Parameters to replace placeholders in the String.- Returns:
- The String.
-
getByLocale
@NotNull public static @NotNull String getByLocale(@NotNull @NotNull String locale, @NotNull @NotNull String key, @Nullable @Nullable Object... parameters) Called to get a specific String from the Language file.- Parameters:
locale- The locale of the Language file.key- The key of the String.parameters- The Parameters to replace placeholders in the String.- Returns:
- The String.
-
getByLocale
@NotNull public static @NotNull String getByLocale(@NotNull @NotNull net.dv8tion.jda.api.interactions.DiscordLocale discordLocale, @NotNull @NotNull String key, @Nullable @Nullable Object... parameters) Called to get a specific String from the Language file.- Parameters:
discordLocale- The locale of the Language file.key- The key of the String.parameters- The Parameters to replace placeholders in the String.- Returns:
- The String.
-
getSupported
Called to retrieve all supported Locals.- Returns:
- The supported Locals.
-