public class BukkitLocale extends Locale
Constructor and Description |
---|
BukkitLocale(java.lang.String plugin)
Creates a new locale manager for the given plugin.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
_INVALID_getMessage(java.lang.String key)
Retrieves the message with the given key from the
current locale.
|
java.lang.String |
_INVALID_getMessage(java.lang.String key,
java.lang.String... replacements)
Retrieves the message with the given key from the
current locale, and replaces placeholder sequences
(
%i ) with the corresponding vararg
parameter. |
boolean |
equals(java.lang.Object otherLocale) |
Localizable |
getMessage(java.lang.String key,
java.lang.Object... replacements)
Retrieves the message with the given key from the
current locale, and replaces placeholder sequences
(
%i ) with the corresponding vararg
parameter. |
java.lang.String |
getPlugin()
Returns the name of the plugin which this Locale belongs to.
|
int |
hashCode() |
boolean |
isLegacy()
Returns whether this object was loaded from a legacy
locale file.
|
initialize
public BukkitLocale(java.lang.String plugin)
MGLib attempts to load locales first from the "locales" directory in the plugin's data folder, then from the locales directory in the plugin JAR's root.
plugin
- the plugin to create a locale manager forpublic java.lang.String getPlugin()
Locale
public java.lang.String _INVALID_getMessage(java.lang.String key)
Locale
This method is included for the sake of reverse-compatibility. It will not exist at runtime and thus should not be used under any circumstances.
_INVALID_getMessage
in class Locale
key
- the key of the message to retrievepublic java.lang.String _INVALID_getMessage(java.lang.String key, java.lang.String... replacements)
Locale
%i
) with the corresponding vararg
parameter.
This method is included for the sake of reverse-compatibility. It will not exist at runtime and thus should not be used under any circumstances.
_INVALID_getMessage
in class Locale
key
- the key of the message to retrievereplacements
- an array or vararg list of
strings to replace placeholder sequences (%i) withpublic Localizable getMessage(java.lang.String key, java.lang.Object... replacements)
Locale
%i
) with the corresponding vararg
parameter. This method will never return null
.
Note: placeholder sequences should start at index 1.
getMessage
in class Locale
key
- the key of the message to retrievereplacements
- an array or vararg list of objects to replace
placeholder sequences (%i) with. If an object in this
list is an instance of a Localizable, it will be
localized appropriately. Otherwise, toString() will
be invoked upon it.Localizable
associated with the given keypublic boolean isLegacy()
Locale
public boolean equals(java.lang.Object otherLocale)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object