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
ConstructorsConstructorDescriptionLocalizationService(Slimefun plugin, String prefix, String serverDefaultLanguage) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddLanguage(String id, String texture) This method adds a newLanguagewith the given id and texture.doublecalculateProgress(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 theLanguagewith the given language code.This method returns a fullCollectionof everyLanguagethat was found.booleanhasLanguage(String id) This returns whether aLanguagewith the given id exists within the project resources.booleanThis method returns whether translations are enabled on thisServer.booleanThis returns whether the givenLanguageis 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:SlimefunLocalizationThis returns the chat prefix for our messages. Every message (unless explicitly omitted) will have this prefix prepended.- Overrides:
getChatPrefixin classSlimefunLocalization- Returns:
- The chat prefix
-
getKey
-
getLanguage
Description copied from class:SlimefunLocalizationThis method attempts to return theLanguagewith the given language code.- Specified by:
getLanguagein classSlimefunLocalization- Parameters:
id- The language code- Returns:
- A
Languagewith the given id or null
-
getLanguages
Description copied from class:SlimefunLocalizationThis method returns a fullCollectionof everyLanguagethat was found.- Specified by:
getLanguagesin classSlimefunLocalization- Returns:
- A
Collectionthat contains every installedLanguage
-
hasLanguage
Description copied from class:SlimefunLocalizationThis returns whether aLanguagewith the given id exists within the project resources.- Specified by:
hasLanguagein classSlimefunLocalization- Parameters:
id- TheLanguageid- Returns:
- Whether the project contains a
Languagewith that id
-
isLanguageLoaded
This returns whether the givenLanguageis loaded or not. -
getDefaultLanguage
Description copied from class:SlimefunLocalization- Specified by:
getDefaultLanguagein classSlimefunLocalization- Returns:
- The default
Language
-
getLanguage
Description copied from class:SlimefunLocalization- Specified by:
getLanguagein classSlimefunLocalization- Parameters:
p- ThePlayerto query- Returns:
- The
Languagethat was selected by the givenPlayer
-
addLanguage
Description copied from class:SlimefunLocalizationThis method adds a newLanguagewith the given id and texture.- Specified by:
addLanguagein classSlimefunLocalization- Parameters:
id- TheLanguageidtexture- The texture of how thisLanguageshould be displayed
-
calculateProgress
-