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 StringCONFIG_RESOURCE_NAME
-
Constructor Summary
Constructors Constructor Description LocalizationService(BotConfig botConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalegetLocale()Gets the locale used by this translator.LocalegetLocaleForGuild(long guildId)Finds the locale specific to the given guild.Set<Locale>getSupportedLocales()Gets the set of locales supported by this service.voidsetLocaleForGuild(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:TranslatorGets the locale used by this translator.- Specified by:
getLocalein interfaceTranslator- Returns:
- the locale
-
-