code: private Properties getMessagesForLanguage(String language) {
          if (StringUtils.isNullOrEmpty(language)) {
              return languageMessages.get("");
          }
  
          String supportedLanguage = languages.getLanguageOrDefault(language);
          if (StringUtils.isNullOrEmpty(supportedLanguage)) {
              log.debug("Messages for '{}' were requested. Using default messages.", language);
              return languageMessages.get("");
          }
  
          // try the supported language
          Properties messages = languageMessages.get(supportedLanguage);
          if (messages != null) {
              return messages;
          }
  
          // check the supported language component
          String langComponent = languages.getLanguageComponent(supportedLanguage);
  
          messages = languageMessages.get(langComponent);
          if (messages != null) {
              return messages;
          }
  
          // return the default messages resource
          return languageMessages.get("");
      }
docs: Retrieves the messages from an arbitrary one or two component language
  String ("en-US", or "en" or "de"...).
  <p/>
  
  @param language A one or two component language code such as "en", "en-US", or
  "en-US,en;q=0.8,de;q=0.6".
  @return The messages for the requested language or the default messages.