Class GUILanguageManager

java.lang.Object
me.eddie.inventoryguiapi.language.GUILanguageManager

public class GUILanguageManager extends Object
Created by Edward on 28/12/2016.
  • Field Details

  • Constructor Details

    • GUILanguageManager

      public GUILanguageManager(Locale locale)
    • GUILanguageManager

      public GUILanguageManager()
  • Method Details

    • initResources

      public void initResources(Locale locale)
      Initialize the resource bundle to use. Will attempt to find the closest matching available for the given locale.
      Parameters:
      locale - The locale to attempt to match
    • getPreferredLocale

      public Locale getPreferredLocale()
      Get the locale this LanguageManager was initialized with and therefore should be used if possible
      Returns:
      The Locale
    • getResources

      public PropertyResourceBundle getResources()
      Get the resource bundle being used to determine which messages to display
      Returns:
      The currently used resource bundle
    • getString

      public String getString(String key)
      Convenience method that calls to the resource bundle
      Parameters:
      key - The key to get the value of in the resource bundle
      Returns:
      The value matching the specified key
    • getFormattedString

      public String getFormattedString(String key, Object... args)
      Get a formatted string. This will get a java-style string to format (Same as used for printf) from the resource bundle and then will format it with the given arguments.
      Parameters:
      key - The key of the string in the resource bundle
      args - The arguments to use to format the string
      Returns:
      The formatted string