code: public static String getLocalizedMessage(PageContext pageContext,
                                               String key,
                                               Object[] args,
                                               String basename) {
          LocalizationContext locCtxt = null;
          String message = JakartaInline.UNDEFINED_KEY + key + JakartaInline.UNDEFINED_KEY;
  
          if (basename != null) {
              locCtxt = JakartaInline.getLocalizationContext(pageContext, basename);
          } else {
              locCtxt = JakartaInline.getLocalizationContext(pageContext);
          }
  
          if (locCtxt != null) {
              ResourceBundle bundle = locCtxt.getResourceBundle();
              if (bundle != null) {
                  try {
                      message = bundle.getString(key);
                      if (args != null) {
                          MessageFormat formatter = new MessageFormat("");
                          if (locCtxt.getLocale() != null) {
                              formatter.setLocale(locCtxt.getLocale());
                          }
                          formatter.applyPattern(message);
                          message = formatter.format(args);
                      }
                  } catch (MissingResourceException mre) {
                  }
              }
          }
  
          return message;
      }
docs: Retrieves the localized message corresponding to the given key, and
  performs parametric replacement using the arguments specified via
  <tt>args</tt>.
  <p> See the specification of the &lt;fmt:message&gt; action for a description
  of how parametric replacement is implemented.
  <p> The localized message is retrieved as in
  {@link #getLocalizedMessage(javax.servlet.jsp.PageContext,java.lang.String, java.lang.String) getLocalizedMessage(pageContext, key, basename)}.
  
  @param pageContext the page in which to get the localized message
  corresponding to the given key
  @param key         the message key
  @param args        the arguments for parametric replacement
  @param basename    the resource bundle base name
  @return the localized message corresponding to the given key