docs: public String buildSelectElementLanguage(String attributes, String resourceName, Locale selectedLocale) {
  
          // get locale names based on properties and global settings
          List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales(getCms(), resourceName);
          List<String> options = new ArrayList<String>(locales.size());
          List<String> selectList = new ArrayList<String>(locales.size());
          int currentIndex = -1;
  
          //get the locales already used in the resource
          List<Locale> contentLocales = new ArrayList<Locale>();
          try {
  
              CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION);
              String temporaryFilename = CmsWorkplace.getTemporaryFileName(resourceName);
              if (getCms().existsResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION)) {
                  res = getCms().readResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION);
              }
              CmsFile file = getCms().readFile(res);
              CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
              contentLocales = xmlContent.getLocales();
          } catch (CmsException e) {
              // to nothing here in case the resource could not be opened
              if (LOG.isErrorEnabled()) {
                  LOG.error(Messages.get().getBundle().key(Messages.LOG_GET_LOCALES_1, resourceName), e);
              }
          }
  
          for (int counter = 0; counter < locales.size(); counter++) {
              // create the list of options and values
              Locale curLocale = locales.get(counter);
              selectList.add(curLocale.toString());
              StringBuffer buf = new StringBuffer();
              buf.append(curLocale.getDisplayName(getLocale()));
              if (!contentLocales.contains(curLocale)) {
                  buf.append(EMPTY_LOCALE);
              }
              options.add(buf.toString());
              if (curLocale.equals(selectedLocale)) {
                  // set the selected index of the selector
                  currentIndex = counter;
              }
          }
  
          if (currentIndex == -1) {
              // no matching element language found, use first element language in list
              if (selectList.size() > 0) {
                  currentIndex = 0;
                  setParamElementlanguage(selectList.get(0));
              }
          }
  
          return buildSelect(attributes, options, selectList, currentIndex, false);
      }