code: private String getAvailableLocalVariant(String path, String baseName) {
  
          //First look for a bundle with the locale of the folder..
          try {
              CmsProperty propLoc = m_clonedCms.readPropertyObject(path, CmsPropertyDefinition.PROPERTY_LOCALE, true);
              if (!propLoc.isNullProperty()) {
                  if (m_clonedCms.existsResource(path + baseName + "_" + propLoc.getValue())) {
                      return baseName + "_" + propLoc.getValue();
                  }
              }
          } catch (CmsException e) {
              LOG.error("Can not read locale property", e);
          }
  
          //If no bundle was found with the locale of the folder, or the property was not set, search for other locales
          A_CmsUI.get();
          List<String> localVariations = CmsLocaleManager.getLocaleVariants(
              baseName,
              UI.getCurrent().getLocale(),
              false,
              true);
  
          for (String name : localVariations) {
              if (m_clonedCms.existsResource(path + name)) {
                  return name;
              }
          }
  
          return null;
      }
docs: Returns the correct varaint of a resource name accoreding to locale.<p>
  
  @param path where the considered resource is.
  @param baseName of the resource
  @return localized name of resource