Class LocalizationService
java.lang.Object
io.github.thebusybiscuit.slimefun4.core.services.localization.SlimefunLocalization
io.github.thebusybiscuit.slimefun4.core.services.LocalizationService
- All Implemented Interfaces:
Keyed
As the name suggests, this Service is responsible for Localization.
It is used for managing the
Language
of a Player
and the entire Server
.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorDescriptionLocalizationService
(Slimefun plugin, String prefix, String serverDefaultLanguage) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addLanguage
(String id, String texture) This method adds a newLanguage
with the given id and texture.double
calculateProgress
(Language lang) This returns the progress of translation for any givenLanguage
.This returns the chat prefix for our messages.getKey()
getLanguage
(String id) This method attempts to return theLanguage
with the given language code.This method returns a fullCollection
of everyLanguage
that was found.boolean
hasLanguage
(String id) This returns whether aLanguage
with the given id exists within the project resources.boolean
This method returns whether translations are enabled on thisServer
.boolean
This returns whether the givenLanguage
is loaded or not.Methods inherited from class io.github.thebusybiscuit.slimefun4.core.services.localization.SlimefunLocalization
getConfig, getDefaultMessages, getItemGroupName, getKeys, getMessage, getMessage, getMessages, getMessages, getRecipeTypeItem, getResearchName, getResourceString, getTotalKeys, loadEmbeddedLanguages, save, sendActionbarMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessages, sendMessages, sendMessages
-
Constructor Details
-
LocalizationService
-
-
Method Details
-
isEnabled
public boolean isEnabled()This method returns whether translations are enabled on thisServer
.- Returns:
- Whether translations are enabled
-
getChatPrefix
Description copied from class:SlimefunLocalization
This returns the chat prefix for our messages. Every message (unless explicitly omitted) will have this prefix prepended.- Overrides:
getChatPrefix
in classSlimefunLocalization
- Returns:
- The chat prefix
-
getKey
-
getLanguage
Description copied from class:SlimefunLocalization
This method attempts to return theLanguage
with the given language code.- Specified by:
getLanguage
in classSlimefunLocalization
- Parameters:
id
- The language code- Returns:
- A
Language
with the given id or null
-
getLanguages
Description copied from class:SlimefunLocalization
This method returns a fullCollection
of everyLanguage
that was found.- Specified by:
getLanguages
in classSlimefunLocalization
- Returns:
- A
Collection
that contains every installedLanguage
-
hasLanguage
Description copied from class:SlimefunLocalization
This returns whether aLanguage
with the given id exists within the project resources.- Specified by:
hasLanguage
in classSlimefunLocalization
- Parameters:
id
- TheLanguage
id- Returns:
- Whether the project contains a
Language
with that id
-
isLanguageLoaded
This returns whether the givenLanguage
is loaded or not. -
getDefaultLanguage
Description copied from class:SlimefunLocalization
- Specified by:
getDefaultLanguage
in classSlimefunLocalization
- Returns:
- The default
Language
-
getLanguage
Description copied from class:SlimefunLocalization
- Specified by:
getLanguage
in classSlimefunLocalization
- Parameters:
p
- ThePlayer
to query- Returns:
- The
Language
that was selected by the givenPlayer
-
addLanguage
Description copied from class:SlimefunLocalization
This method adds a newLanguage
with the given id and texture.- Specified by:
addLanguage
in classSlimefunLocalization
- Parameters:
id
- TheLanguage
idtexture
- The texture of how thisLanguage
should be displayed
-
calculateProgress
-