Package net.caseif.rosetta
Class LocaleManager
java.lang.Object
net.caseif.rosetta.LocaleManager
Provides localization support for a particular
Plugin
.
Locales are loaded as .properties
files from the
/lang
directory of the archive of the plugin owning this
LocaleManager
.
- Since:
- 1.0
-
Constructor Summary
ConstructorDescriptionLocaleManager
(org.bukkit.plugin.Plugin plugin) Constructs a newLocaleManager
owned by the givenPlugin
. -
Method Summary
Modifier and TypeMethodDescriptionGets the default locale of thisLocaleManager
.getLocalizable
(String key) Gets theLocalizable
associated with the given key.org.bukkit.plugin.Plugin
Gets the plugin owning thisLocaleManager
.void
setDefaultLocale
(String locale) Sets the default locale of thisLocaleManager
.
-
Constructor Details
-
LocaleManager
public LocaleManager(org.bukkit.plugin.Plugin plugin) Constructs a newLocaleManager
owned by the givenPlugin
.- Parameters:
plugin
- The plugin owning the newLocaleManager
.- Since:
- 1.0
-
-
Method Details
-
getOwningPlugin
public org.bukkit.plugin.Plugin getOwningPlugin()Gets the plugin owning thisLocaleManager
.- Returns:
- The plugin owning this
LocaleManager
- Since:
- 1.0
-
getDefaultLocale
Gets the default locale of thisLocaleManager
.- Returns:
- A string representing the default locale. This should
follow the
ISO 639-1
andISO 3166-1
standards, respectively (e.g.en_US
) and defaults toen_US
. - Since:
- 1.0
-
setDefaultLocale
Sets the default locale of thisLocaleManager
.- Parameters:
locale
- A string representing the default locale. This should follow theISO 639-1
andISO 3166-1
standards, respectively (e.g.en_US
orenUS
) and defaults toen_US
.- Since:
- 1.0
-
getLocalizable
Gets theLocalizable
associated with the given key.- Parameters:
key
- The key of the message to retrieve- Returns:
- The retrieved message as a
Localizable
- Since:
- 1.0
-