Package ch.njol.skript.localization
Class Language
java.lang.Object
ch.njol.skript.localization.Language
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intSome flagsstatic intSome flagsstatic intSome flagsstatic intmasks out article flags - useful if the article has been added already (e.g. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddListener(LanguageChangeListener listener)Registers a listener.static voidaddListener(LanguageChangeListener listener, Language.LanguageListenerPriority priority)static StringGets a string and uses it as format inString.format(String, Object...).static StringGets a string from the language file with the given key, or the key itself if the key does not exist.static @Nullable StringEqual toget(String), but returns null instead of the key if the key cannot be found.static String[]Gets a list of strings.static StringgetName()static StringGets a localized string surrounded by spaces, or a space if the string is emptystatic booleanstatic booleanstatic booleankeyExistsDefault(String key)static booleanstatic voidloadDefault(SkriptAddon addon)static voidmissingEntryError(String key)
-
Field Details
-
F_PLURAL
public static final int F_PLURALSome flags- See Also:
- Constant Field Values
-
F_DEFINITE_ARTICLE
public static final int F_DEFINITE_ARTICLESome flags- See Also:
- Constant Field Values
-
F_INDEFINITE_ARTICLE
public static final int F_INDEFINITE_ARTICLESome flags- See Also:
- Constant Field Values
-
NO_ARTICLE_MASK
public static final int NO_ARTICLE_MASKmasks out article flags - useful if the article has been added already (e.g. by an adjective)- See Also:
- Constant Field Values
-
-
Constructor Details
-
Language
public Language()
-
-
Method Details
-
getName
-
get
Gets a string from the language file with the given key, or the key itself if the key does not exist.- Parameters:
key- The message's key (case-insensitive)- Returns:
- The requested message if it exists or the key otherwise
-
get_
Equal toget(String), but returns null instead of the key if the key cannot be found.- Parameters:
key- The message's key (case-insensitive)- Returns:
- The requested message or null if it doesn't exist
-
missingEntryError
-
format
Gets a string and uses it as format inString.format(String, Object...).- Parameters:
args- The arguments to pass toString.format(String, Object...)- Returns:
- The formatted string
-
getSpaced
Gets a localized string surrounded by spaces, or a space if the string is empty- Returns:
- The message surrounded by spaces, a space if the entry is empty, or " "+key+" " if the entry is missing.
-
getList
Gets a list of strings.- Returns:
- a non-null String array with at least one element
-
keyExists
- Returns:
- Whether the given key exists in any loaded language file.
-
keyExistsDefault
- Returns:
- Whether the given key exists in the default language file.
-
isInitialized
public static boolean isInitialized()- Returns:
- whether the default language file is loaded.
-
loadDefault
-
load
-
addListener
Registers a listener. The listener will immediately be called if a language has already been loaded.- Parameters:
listener- the listener to register
-
addListener
public static void addListener(LanguageChangeListener listener, Language.LanguageListenerPriority priority)
-