code: public static String getLocalizedMessage(ResourceBundle bundle, String key, Object... args) {
          String pattern;
          try {
              pattern = bundle.getString(key);
          } catch (MissingResourceException e) {
              pattern = key;
          }
  
          if (ArrayUtils.isNotEmpty(args)) {
              return MessageFormat.format(pattern, args);
          } else {
              return pattern;
          }
      }
docs: Returns a formatted, localized message according to the specified resource bundle and key.
  
  @param bundle the resource bundle where the message format should be
  @param key    the key of the message format
  @param args   the args of the message format
  @return the formatted, localized message