Module ultimategdbot.api
Class LocalizationService
- java.lang.Object
-
- com.github.alex1304.ultimategdbot.api.localization.LocalizationService
-
- All Implemented Interfaces:
Translator
public final class LocalizationService extends Object implements Translator
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_RESOURCE_NAME
-
Constructor Summary
Constructors Constructor Description LocalizationService(BotConfig botConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Locale
getLocale()
Gets the locale used by this translator.Locale
getLocaleForGuild(long guildId)
Finds the locale specific to the given guild.Set<Locale>
getSupportedLocales()
Gets the set of locales supported by this service.void
setLocaleForGuild(long guildId, Locale locale)
Sets a locale specific for the given guild.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.alex1304.ultimategdbot.api.Translator
translate
-
-
-
-
Field Detail
-
CONFIG_RESOURCE_NAME
public static final String CONFIG_RESOURCE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LocalizationService
public LocalizationService(BotConfig botConfig)
-
-
Method Detail
-
getLocaleForGuild
public Locale getLocaleForGuild(long guildId)
Finds the locale specific to the given guild.- Parameters:
guildId
- the guild id- Returns:
- the locale used by the guild
-
setLocaleForGuild
public void setLocaleForGuild(long guildId, @Nullable Locale locale)
Sets a locale specific for the given guild. If one was already set for the same guild, it is overwritten.- Parameters:
guildId
- the guild idlocale
- the new locale. May be null, in which case the locale is removed.
-
getSupportedLocales
public Set<Locale> getSupportedLocales()
Gets the set of locales supported by this service.- Returns:
- the locales supported
-
getLocale
public Locale getLocale()
Description copied from interface:Translator
Gets the locale used by this translator.- Specified by:
getLocale
in interfaceTranslator
- Returns:
- the locale
-
-