code: private List<Locale> getMainLocaleSelectOptions(
          CmsObject cms,
          CmsResource res,
          Locale mainLocale,
          List<Locale> secondaryLocales) {
  
          try {
              CmsLocaleGroup localeGroup = cms.getLocaleGroupService().readDefaultFileLocaleGroup(res);
              List<Locale> result = Lists.newArrayList();
              if (localeGroup.hasLocale(mainLocale)) {
                  result.add(mainLocale);
              }
              for (Locale locale : secondaryLocales) {
                  if (localeGroup.hasLocale(locale)) {
                      result.add(locale);
                  }
              }
              return result;
          } catch (CmsException e) {
              LOG.error(e.getLocalizedMessage(), e);
              return Lists.newArrayList();
          }
      }
docs: Gets the possible locale values selectable as main locale.<p>
  
  @param cms the CMS context
  @param res the resource
  @param mainLocale the main locale
  @param secondaryLocales the secondary locales
  
  @return the possible locale selections