Class I18n


  • public class I18n
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      I18n()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getLocalizedValue​(java.lang.String language, java.lang.String key, java.lang.String defaultValue)
      Retrieves a localized value for a given language and key, with the option to specify a default value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • I18n

        public I18n()
    • Method Detail

      • getLocalizedValue

        public static java.lang.String getLocalizedValue​(java.lang.String language,
                                                         java.lang.String key,
                                                         java.lang.String defaultValue)
        Retrieves a localized value for a given language and key, with the option to specify a default value.
        Parameters:
        language - the language code (e.g., "en", "cn", "fr"); if null, the default locale's language is used
        key - the key for the message to retrieve; must not be null
        defaultValue - the fallback value to return if no translation is found; must not be null
        Returns:
        the localized value corresponding to the key, or the defaultValue if no match is found
        Throws:
        java.lang.IllegalArgumentException - if key or defaultValue is null