Class Language

java.lang.Object
ch.njol.skript.localization.Language

public class Language extends Object
  • Field Details

    • F_PLURAL

      public static final int F_PLURAL
      Some flags
      See Also:
      Constant Field Values
    • F_DEFINITE_ARTICLE

      public static final int F_DEFINITE_ARTICLE
      Some flags
      See Also:
      Constant Field Values
    • F_INDEFINITE_ARTICLE

      public static final int F_INDEFINITE_ARTICLE
      Some flags
      See Also:
      Constant Field Values
    • NO_ARTICLE_MASK

      public static final int NO_ARTICLE_MASK
      masks 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

      public static String getName()
    • get

      public static String get(String key)
      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_

      public static @Nullable String get_(String key)
      Equal to get(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

      public static void missingEntryError(String key)
    • format

      public static String format(String key, Object... args)
      Gets a string and uses it as format in String.format(String, Object...).
      Parameters:
      args - The arguments to pass to String.format(String, Object...)
      Returns:
      The formatted string
    • getSpaced

      public static String getSpaced(String key)
      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

      public static String[] getList(String key)
      Gets a list of strings.
      Returns:
      a non-null String array with at least one element
    • keyExists

      public static boolean keyExists(String key)
      Returns:
      Whether the given key exists in any loaded language file.
    • keyExistsDefault

      public static boolean keyExistsDefault(String key)
      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

      public static void loadDefault(SkriptAddon addon)
    • load

      public static boolean load(String name)
    • addListener

      public static void addListener(LanguageChangeListener listener)
      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)