Class LocalizationUtil

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.localization.LocalizationUtil

public final class LocalizationUtil extends Object
Represents a utility class with methods that can be used for the localization system.
  • Method Details

    • getLocaleFilesInJar

      public static List<String> getLocaleFilesInJar(Path jarFile) throws IOException
      Gets the names of all locale files in a jar.

      The name of each locale file is the name of the file itself, with optional relative path.

      Parameters:
      jarFile - The jar file to search in.
      Returns:
      The names of all locale files in the jar.
      Throws:
      IOException - If an I/O error occurs.
    • parseLocale

      public static @Nullable Locale parseLocale(@Nullable String locale)
      Parses a Locale from a String representing a locale. E.g. "en_US".

      When the provided locale is null or blank, Locale.ROOT is returned.

      Parameters:
      locale - A String representing a locale.
      Returns:
      The parse Locale.