code: public HttpResponse doResourceBundle(StaplerRequest request) {
          String baseName = request.getParameter("baseName");
  
          if (baseName == null) {
              return HttpResponses.errorJSON("Mandatory parameter 'baseName' not specified.");
          }
  
          String language = request.getParameter("language");
          String country = request.getParameter("country");
          String variant = request.getParameter("variant");
          // https://www.w3.org/International/questions/qa-lang-priorities
          // in case we have regions/countries in the language query parameter
          if (language != null) {
              String[] languageTokens = language.split("-|_");
              language = languageTokens[0];
              if (country == null && languageTokens.length > 1) {
                  country = languageTokens[1];
                  if (variant == null && languageTokens.length > 2) {
                      variant = languageTokens[2];
                  }
              }
          }
          try {
              Locale locale = request.getLocale();
  
              if (language != null && country != null && variant != null) {
                  locale = new Locale(language, country, variant);
              } else if (language != null && country != null) {
                  locale = new Locale(language, country);
              } else if (language != null) {
                  locale = new Locale(language);
              }
  
              return HttpResponses.okJSON(ResourceBundleUtil.getBundle(baseName, locale));
          } catch (Exception e) {
              return HttpResponses.errorJSON(e.getMessage());
          }
      }
docs: Get a localised resource bundle.
  <p>
  URL: {@code i18n/resourceBundle}.
  <p>
  Parameters:
  <ul>
  <li>{@code baseName}: The resource bundle base name.</li>
  <li>{@code language}: {@link Locale} Language. (optional)</li>
  <li>{@code country}: {@link Locale} Country. (optional)</li>
  <li>{@code variant}: {@link Locale} Language variant. (optional)</li>
  </ul>
  
  @param request The request.
  @return The JSON response.