Class I18nUtil
java.lang.Object
com.serinity.accesscontrol.util.I18nUtil
Utility class for application internationalization (i18n)
Provides helper methods to manage the current Locale,
load message ResourceBundles based on
PropertyBundle, retrieve
localized messages, and ensure that the active locale is one of the
configured supported languages.
I18nUtil.applySupportedLocale();
- Since:
- 2026-01-29 I18nUtil.java
- Version:
- 1.0
- Author:
- @ZouariOmar (zouariomar20@gmail.com)
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidApplies the best matching supported locale to the current runtime locale.static ResourceBundleReturns the currently loadedResourceBundle.static LocaleReturns the currently activeLocale.Returns the list of supportedLocaleinstances loaded from thesupported-languagesproperty bundle.Returns the list of supported language tags (e.g.,"en","fr") as plain strings, suitable for populating UI combo-boxes.static StringReturns the localized string for the given message key.static voidChanges the active locale and reloads the resource bundle accordingly.
-
Method Details
-
getValue
-
setLocale
-
getLocale
-
getBundle
Returns the currently loadedResourceBundle.- Returns:
- the active resource bundle
-
getSupportedLanguages
-
getSupportedLanguagesToString
-
applySupportedLocale
public static void applySupportedLocale()Applies the best matching supported locale to the current runtime locale.First tries an exact match; if none is found, falls back to matching by language tag only (e.g.,
en_US→en). If no match is found at all, the current locale remains unchanged.
-