java.lang.Object
org.vaadin.addons.componentfactory.schedulexcalendar.util.LocaleUtils

public class LocaleUtils extends Object
Utility class for working with Locale objects.

This class provides methods to:

  • Convert Locale to Schedule-X compatible language tags (e.g., "en-US", "fr-FR")
  • Validate that a given Locale is supported by Schedule-X
  • Handle edge cases like Serbian with script variants ("sr-Latn-RS", "sr-RS")
See Also:
  • Constructor Details

    • LocaleUtils

      public LocaleUtils()
  • Method Details

    • validateLocale

      public static void validateLocale(Locale locale)
      Validates whether the given Locale is supported by Schedule-X.

      If the locale is not supported, throws an IllegalArgumentException with an informative message.

      Parameters:
      locale - the Locale to validate
      Throws:
      IllegalArgumentException - if the locale is not supported by Schedule-X
    • toScheduleXLocale

      public static String toScheduleXLocale(Locale locale)
      Converts the given Locale to a Schedule-X compatible language tag (e.g., "en-US", "fr-FR").

      Special handling is included for Serbian to differentiate between Latin and Cyrillic scripts.

      Parameters:
      locale - the Locale to convert (must not be null)
      Returns:
      a language tag string compatible with Schedule-X (e.g., "en-US")
    • isSupported

      public static boolean isSupported(Locale locale)
      Checks whether the given Locale is supported by Schedule-X.
      Parameters:
      locale - the Locale to check
      Returns:
      true if the locale is supported, false otherwise