public void switchToLocale(Locale locale) throws CmsException {

        CmsObject cms = A_CmsUI.getCmsObject();
        CmsLocaleGroupService groupService = cms.getLocaleGroupService();
        CmsLocaleGroup localeGroup = groupService.readDefaultFileLocaleGroup(m_currentRoot);
        Collection<CmsResource> resources = localeGroup.getResourcesForLocale(locale);
        if (resources.isEmpty()) {
            LOG.error(
                "Can not switch to locale "
                    + locale
                    + ": no page found in locale group of "
                    + m_currentRoot.getRootPath());
        }
        CmsResource localeVariant = resources.iterator().next();
        if (!localeVariant.isFolder()) {
            CmsResource parentFolder = cms.readParentFolder(localeVariant.getStructureId());
            if (m_comparisonLocale.equals(locale)) {
                m_comparisonLocale = m_rootLocale;
                m_rootLocale = locale;
            } else {
                m_rootLocale = locale;
            }
            updateLocaleWidgets();
            initTree(parentFolder);
        } else {
            LOG.error("locale variant should not be a folder: " + localeVariant.getRootPath());
        }
    }
public void switchToLocale ( Locale locale ) throws CmsException { CmsObject cms = A_CmsUI . getCmsObject ( ) ; CmsLocaleGroupService groupService = cms . getLocaleGroupService ( ) ; CmsLocaleGroup localeGroup = groupService . readDefaultFileLocaleGroup ( m_currentRoot ) ; Collection < CmsResource > resources = localeGroup . getResourcesForLocale ( locale ) ; if ( resources . isEmpty ( ) ) { LOG . error ( "Can not switch to locale " + locale + ": no page found in locale group of " + m_currentRoot . getRootPath ( ) ) ; } CmsResource localeVariant = resources . iterator ( ) . next ( ) ; if ( ! localeVariant . isFolder ( ) ) { CmsResource parentFolder = cms . readParentFolder ( localeVariant . getStructureId ( ) ) ; if ( m_comparisonLocale . equals ( locale ) ) { m_comparisonLocale = m_rootLocale ; m_rootLocale = locale ; } else { m_rootLocale = locale ; } updateLocaleWidgets ( ) ; initTree ( parentFolder ) ; } else { LOG . error ( "locale variant should not be a folder: " + localeVariant . getRootPath ( ) ) ; } }
Switches the root locale to the given value.<p>

@param locale the new root locale
@throws CmsException if something goes wrong