public void copyLocale(List<Locale> possibleSources, Locale destination) throws CmsXmlException {

        if (hasLocale(destination)) {
            throw new CmsXmlException(Messages.get().container(Messages.ERR_LOCALE_ALREADY_EXISTS_1, destination));
        }
        Iterator<Locale> i = possibleSources.iterator();
        Locale source = null;
        while (i.hasNext() && (source == null)) {
            // check all locales and try to find the first match
            Locale candidate = i.next();
            if (hasLocale(candidate)) {
                // locale has been found
                source = candidate;
            }
        }
        if (source != null) {
            // found a locale, copy this to the destination
            copyLocale(source, destination);
        } else {
            // no matching locale has been found
            throw new CmsXmlException(
                Messages.get().container(
                    Messages.ERR_LOCALE_NOT_AVAILABLE_1,
                    CmsLocaleManager.getLocaleNames(possibleSources)));
        }
    }
public void copyLocale ( List < Locale > possibleSources , Locale destination ) throws CmsXmlException { if ( hasLocale ( destination ) ) { throw new CmsXmlException ( Messages . get ( ) . container ( Messages . ERR_LOCALE_ALREADY_EXISTS_1 , destination ) ) ; } Iterator < Locale > i = possibleSources . iterator ( ) ; Locale source = null ; while ( i . hasNext ( ) && ( source == null ) ) { Locale candidate = i . next ( ) ; if ( hasLocale ( candidate ) ) { source = candidate ; } } if ( source != null ) { copyLocale ( source , destination ) ; } else { throw new CmsXmlException ( Messages . get ( ) . container ( Messages . ERR_LOCALE_NOT_AVAILABLE_1 , CmsLocaleManager . getLocaleNames ( possibleSources ) ) ) ; } }
@see org.opencms.xml.I_CmsXmlDocument#copyLocale(java.util.List, java.util.Locale)