Package sawfowl.localeapi.api
Interface LocaleService
public interface LocaleService
-
Method Summary
Modifier and TypeMethodDescriptioncreatePluginLocale
(String pluginID, ConfigTypes configType, Locale locale) Creating a plugin localization file.createPluginLocale
(org.spongepowered.plugin.PluginContainer plugin, ConfigTypes configType, Locale locale) Creating a plugin localization file.The default locale.Class<? extends LocaleReference>
getDefaultReference
(String pluginID) Class<? extends LocaleReference>
getDefaultReference
(org.spongepowered.plugin.PluginContainer container) Get the default serialization class for plugin localizations.
No type conversion is performed.int
getItemStackSerializerVariant
(String pluginID) Getting the type number of the serialization type of an items.int
getItemStackSerializerVariant
(org.spongepowered.plugin.PluginContainer container) Getting the type number of the serialization type of an items.List of all localizations of the game.getOrDefaultLocale
(String pluginID, Locale locale) Get plugin localization with Sponge config file.getOrDefaultLocale
(org.spongepowered.plugin.PluginContainer plugin, Locale locale) Get plugin localization with Sponge config file.getPluginLocales
(String pluginID) Getting a map of plugin localizations with Sponge config files.getPluginLocales
(org.spongepowered.plugin.PluginContainer plugin) Getting a map of plugin localizations with Sponge config files.boolean
localesExist
(String pluginID) Load plugin locales if exists.boolean
localesExist
(org.spongepowered.plugin.PluginContainer plugin) Load plugin locales if exists.void
saveAssetLocales
(String pluginID) Save plugin locales from assets.void
saveAssetLocales
(org.spongepowered.plugin.PluginContainer plugin) Save plugin locales from assets.<T extends LocaleReference>
voidsetDefaultReference
(org.spongepowered.plugin.PluginContainer container, Class<T> defaultReference) Set the default serializable class object for all plugin localizations.
If no data has been previously written to this localization, it will be applied from the specified class.
This class will be applied automatically to all localizations loaded after its addition.
Automatic application of this class does not make any changes to the localization data.void
setItemStackSerializerVariant
(org.spongepowered.plugin.PluginContainer container, int variant) Selecting serialization variant for items.
1 - All NBT tags will be written in 1 line.
-
Method Details
-
getSystemOrDefaultLocale
Locale getSystemOrDefaultLocale() -
getLocalesList
List of all localizations of the game. -
getDefaultLocale
Locale getDefaultLocale()The default locale. Used in a localization map. -
getPluginLocales
Getting a map of plugin localizations with Sponge config files.- Parameters:
plugin
- - A class annotated with '@Plugin'.
-
getPluginLocales
Getting a map of plugin localizations with Sponge config files.- Parameters:
pluginID
- - Plugin ID.
-
getOrDefaultLocale
Get plugin localization with Sponge config file.
Note that getting the ConfigurationNode object in the '*.properties' configuration is not possible.
Methods for getting this object will return null.- Parameters:
plugin
- - A class annotated with '@Plugin'.locale
- - Selected localization. If the selected localization is not found, the default localization will be returned.
-
getOrDefaultLocale
Get plugin localization with Sponge config file.
Note that getting the ConfigurationNode object in the '*.properties' configuration is not possible.
Methods for getting this object will return null.- Parameters:
pluginID
- - Plugin ID.locale
- - Selected localization. If the selected localization is not found, the default localization will be returned.
-
saveAssetLocales
void saveAssetLocales(org.spongepowered.plugin.PluginContainer plugin) Save plugin locales from assets.- Parameters:
plugin
- - A class annotated with '@Plugin'.
-
saveAssetLocales
Save plugin locales from assets.- Parameters:
pluginID
- - Plugin ID.
-
createPluginLocale
PluginLocale createPluginLocale(org.spongepowered.plugin.PluginContainer plugin, ConfigTypes configType, Locale locale) Creating a plugin localization file.- Parameters:
plugin
- - A class annotated with '@Plugin'.configType
- - Selected config type. See enum class 'ConfigTypes'.
-
createPluginLocale
Creating a plugin localization file.- Parameters:
pluginID
- - Plugin ID.configType
- - Selected config type. See enum class 'ConfigTypes'.
-
localesExist
boolean localesExist(org.spongepowered.plugin.PluginContainer plugin) Load plugin locales if exists.- Parameters:
plugin
- - A class annotated with '@Plugin'.- Returns:
- true if loaded.
-
localesExist
Load plugin locales if exists.- Parameters:
pluginID
- - Plugin ID.- Returns:
- true if loaded.
-
setItemStackSerializerVariant
void setItemStackSerializerVariant(org.spongepowered.plugin.PluginContainer container, int variant) throws Exception Selecting serialization variant for items.
1 - All NBT tags will be written in 1 line. This option is the most reliable, but significantly complicates manual editing of NBT tags in config.
2 - Advanced recording. Easier to make manual changes to the config. If you have problems with this type of serialization, you should report errors to the LocaleAPI plugin developer.
3 - Using Sponge serializer. Some data will be written in 1 line. If you encounter problems with this type of serialization, you should report bugs to the Sponge developers.- Throws:
Exception
-
getItemStackSerializerVariant
int getItemStackSerializerVariant(org.spongepowered.plugin.PluginContainer container) Getting the type number of the serialization type of an items. -
getItemStackSerializerVariant
Getting the type number of the serialization type of an items. -
setDefaultReference
<T extends LocaleReference> void setDefaultReference(org.spongepowered.plugin.PluginContainer container, Class<T> defaultReference) Set the default serializable class object for all plugin localizations.
If no data has been previously written to this localization, it will be applied from the specified class.
This class will be applied automatically to all localizations loaded after its addition.
Automatic application of this class does not make any changes to the localization data.- Parameters:
defaultReference
- - The serializable class extendsLocaleReference
container
- -PluginContainer
-
getDefaultReference
Class<? extends LocaleReference> getDefaultReference(org.spongepowered.plugin.PluginContainer container) Get the default serialization class for plugin localizations.
No type conversion is performed.- Parameters:
container
- -PluginContainer
- Returns:
- Serializable class, or null if no class assignment was previously made.
-
getDefaultReference
-