Package net.blueva.arcade.api.config
Interface LanguageAPI<P>
- Type Parameters:
P- platform player type
public interface LanguageAPI<P>
Locale-aware translation API for core and module messages.
- Since:
- 3.4
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclearManualLocale(P player) Clear a player's manual locale override so automatic/default resolution is used again.default voidclearPlayerLocale(P player) Deprecated.Return locale codes currently available from Core and loaded modules.getEffectiveLocale(P player) Resolve the locale that should be used for a player right now.default StringFinal fallback locale used when the player and server default locales do not contain a translation.default StringgetManualLocale(P player) Return the manually stored player locale override, if one exists.getModuleLocales(String moduleId) default StringgetPlayerLocale(P player) Deprecated.usegetEffectiveLocale(Object)for the active locale orgetManualLocale(Object)for the stored manual override.booleanhasTranslation(String moduleId, String locale, String key) default booleanisLocaleAvailable(String locale) Check whether a locale can be selected.voidregisterModuleTranslation(String moduleId, String locale, String resourcePath) Register a module translation file with the runtime.voidsetManualLocale(P player, String locale) Store a manual locale override for a player.default voidsetPlayerLocale(P player, String locale) Deprecated.default StringtranslateList(P player, String moduleId, String key) Look up a translated string list for module UI such as scoreboards, lore, and result messages.translateList(P player, String moduleId, String key, String... placeholders) Look up a translated string list and replace MiniMessage placeholder tokens.translateListOrDefault(P player, String moduleId, String key, List<String> defaultValue, String... placeholders) translateListOrDefault(P player, String moduleId, String key, List<String> defaultValue, Map<String, String> placeholders) default StringtranslateOrDefault(P player, String moduleId, String key, String defaultValue) default StringtranslateOrDefault(P player, String moduleId, String key, String defaultValue, String... placeholders) default StringtranslateOrDefault(P player, String moduleId, String key, String defaultValue, Map<String, String> placeholders)
-
Method Details
-
getEffectiveLocale
Resolve the locale that should be used for a player right now. Implementations may combine a manual player override, client auto-detection, server default locale, and fallback locale.- Parameters:
player- platform player, ornullto use the server default locale- Returns:
- effective locale code
-
getManualLocale
Return the manually stored player locale override, if one exists. This does not include client auto-detection or server defaults.- Parameters:
player- platform player- Returns:
- manual locale code, or
nullwhen the player uses automatic/default resolution
-
setManualLocale
Store a manual locale override for a player.- Parameters:
player- platform playerlocale- locale code
-
clearManualLocale
Clear a player's manual locale override so automatic/default resolution is used again.- Parameters:
player- platform player
-
getPlayerLocale
Deprecated.usegetEffectiveLocale(Object)for the active locale orgetManualLocale(Object)for the stored manual override. -
setPlayerLocale
Deprecated. -
clearPlayerLocale
Deprecated. -
getDefaultLocale
String getDefaultLocale() -
getFallbackLocale
Final fallback locale used when the player and server default locales do not contain a translation.enis recommended because the Core defaults are authored in English. -
registerModuleTranslation
Register a module translation file with the runtime.Normal modules should not call this. Core runtimes auto-discover
files/language/<locale>.ymlresources and register them internally. This method remains public only for custom runtime adapters. -
translate
-
translate
-
translate
-
translateOrDefault
-
translateOrDefault
-
translateOrDefault
-
translateList
Look up a translated string list for module UI such as scoreboards, lore, and result messages.- Since:
- 3.4
-
translateList
Look up a translated string list and replace MiniMessage placeholder tokens. Placeholders are passed as pairs:"{name}", "value".- Since:
- 3.4
-
translateList
-
translateListOrDefault
-
translateListOrDefault
-
translateListOrDefault
-
hasTranslation
-
getModuleLocales
-
getAvailableLocales
Return locale codes currently available from Core and loaded modules. This is intended for validation and command suggestions.- Returns:
- available locale codes
- Since:
- 3.4
-
isLocaleAvailable
Check whether a locale can be selected. Implementations may normalize Minecraft locale tags such ases_esores-EStoes.- Parameters:
locale- requested locale code- Returns:
- true if the locale is available
- Since:
- 3.4
-
clearManualLocale(Object).