Class BukkitLocalizationService
java.lang.Object
com.zetaplugins.zetacore.services.localization.BukkitLocalizationService
- All Implemented Interfaces:
LocalizationService
Service for handling localization and language files.
This service loads the language file based on the configuration and provides methods to retrieve localized strings.
-
Constructor Summary
ConstructorsConstructorDescriptionBukkitLocalizationService(JavaPlugin plugin, List<String> possibleLangs) BukkitLocalizationService(JavaPlugin plugin, List<String> possibleLangs, String fallbackLang, String langFolder, String langConfigOption) -
Method Summary
Modifier and TypeMethodDescriptionGet a string from the language fileGet a string from the language file with a fallbackgetStringList(String key) Get a list of strings from the language filevoidreload()Reload the language configuration from the language files
-
Constructor Details
-
BukkitLocalizationService
- Parameters:
plugin- The JavaPlugin instance to use for loading resourcespossibleLangs- List of language codes to load (The languages that are provided by the plugin)
-
BukkitLocalizationService
public BukkitLocalizationService(JavaPlugin plugin, List<String> possibleLangs, String fallbackLang, String langFolder, String langConfigOption) - Parameters:
plugin- The JavaPlugin instance to use for loading resourcespossibleLangs- List of language codes to load (The languages that are provided by the plugin)fallbackLang- The fallback language code to use if the selected language is not foundlangFolder- The folder where the language files are stored (e.g., "lang/")langConfigOption- The configuration option to use for selecting the language (e.g., "lang")
-
-
Method Details
-
reload
public void reload()Reload the language configuration from the language files -
getString
Description copied from interface:LocalizationServiceGet a string from the language file- Specified by:
getStringin interfaceLocalizationService- Parameters:
key- The key to get the string for- Returns:
- The string from the language file
-
getString
Description copied from interface:LocalizationServiceGet a string from the language file with a fallback- Specified by:
getStringin interfaceLocalizationService- Parameters:
key- The key to get the string forfallback- The fallback string- Returns:
- The string from the language file or the fallback
-
getStringList
Description copied from interface:LocalizationServiceGet a list of strings from the language file- Specified by:
getStringListin interfaceLocalizationService- Parameters:
key- The key to get the list of strings for- Returns:
- The list of strings from the language file
-