Interface ILocalizer
- All Known Implementing Classes:
ILocalizer.DummyLocalizer
,Localizer
public interface ILocalizer
Basic Interface for localizer implementations.
Also allows access to localizer instances per plugin.
- Since:
- 1.0.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ILocalizer
static final Pattern
static final Map<Class<? extends org.bukkit.plugin.Plugin>,
ILocalizer> -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLocaleCodes
(Map<String, String> runtimeLocaleCodes) Add requested locale codes in runtime.static String
String[]
Returns all available locales.getMessage
(String key) Get a message.getMessage
(String key, String language) getMessage
(String key, org.bukkit.command.CommandSender sender) static ILocalizer
getPluginLocalizer
(Class<? extends org.bukkit.plugin.Plugin> plugin) static ILocalizer
getPluginLocalizer
(org.bukkit.plugin.Plugin plugin) Returns all available locales.static boolean
isLocaleCode
(String message) localeBundle
(String language) default String
Translates a String with Placeholders.Translates a String with Placeholders.org.bukkit.plugin.Plugin
plugin()
void
registerChild
(ILocalizer localizer) void
Sets the locale of the localizer instance.
-
Field Details
-
LOCALIZER
-
DEFAULT
-
LOCALIZATION_CODE
-
-
Method Details
-
getPluginLocalizer
-
getPluginLocalizer
-
plugin
org.bukkit.plugin.Plugin plugin() -
escape
-
isLocaleCode
-
setLocale
Sets the locale of the localizer instance.- Parameters:
language
- language to set.
-
getMessage
Get a message.- Parameters:
key
- message key- Returns:
- message with replaced replacements if present.
-
getIncludedLocales
String[] getIncludedLocales()Returns all available locales.- Returns:
- array of registered locales.
-
includedLocales
Returns all available locales.- Returns:
- set of registered locales.
-
addLocaleCodes
Add requested locale codes in runtime.This has to be done before calling
setLocale(String)
Every key has one default value which will be added to the file if the key is not present.
- Parameters:
runtimeLocaleCodes
- map with locales codes to add.
-
getMessage
-
getValue
-
getMessage
-
getValue
-
getValue
-
localeBundle
-
defaultBundle
ResourceBundle defaultBundle() -
localize
Translates a String with Placeholders. Can handle multiple messages with replacements. Add replacements in the right order.- Parameters:
message
- Message to translate- Returns:
- Replaced Messages
- Since:
- 1.2.3
-
localize
Translates a String with Placeholders. Can handle multiple messages with replacements. Add replacements in the right order.- Parameters:
message
- Message to translate- Returns:
- Replaced Messages
- Since:
- 1.2.3
-
registerChild
-