Generates the user info details.<p>

@param cms the cms context
@param locale the locale

@return the user info details
488561
private String generateInfoDetails(CmsObject cms, Locale locale) {

        StringBuffer infoHtml = new StringBuffer(128);
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getEmail())) {
            infoHtml.append(CmsStringUtil.escapeHtml(m_user.getEmail())).append(LINE_BREAK);
        }
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getOuFqn())) {
            infoHtml.append(CmsStringUtil.escapeHtml(m_user.getOuFqn())).append(LINE_BREAK);
        }
        for (CmsAccountInfo info : OpenCms.getWorkplaceManager().getAccountInfos()) {
            if (!info.getField().equals(Field.firstname)
                && !info.getField().equals(Field.lastname)
                && !Field.email.equals(info.getField())) {
                String value = info.getValue(m_user);
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) {
                    infoHtml.append(CmsStringUtil.escapeHtml(value)).append(LINE_BREAK);
                }
            }
        }
        if (OpenCms.getSessionManager().getSessionInfos(m_user.getId()).size() > 0) {
            infoHtml.append(
                Messages.get().getBundle(locale).key(
                    Messages.GUI_USER_INFO_ONLINE_SINCE_1,
                    DateFormat.getTimeInstance(DateFormat.DEFAULT, locale).format(
                        new Date(m_user.getLastlogin())))).append(LINE_BREAK);
        }

        return infoHtml.toString();
    }
905657
private Locale getWorkplaceLocale() {

        Locale result = OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject());
        if (result == null) {
            result = CmsLocaleManager.getDefaultLocale();
        }
        if (result == null) {
            result = Locale.getDefault();
        }
        return result;
    }
940822
protected Locale getDefaultLocale(CmsObject cms, String resource) {

        Locale locale = OpenCms.getLocaleManager().getDefaultLocale(cms, resource);
        if (locale == null) {
            List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales();
            if (locales.size() > 0) {
                locale = locales.get(0);
            } else {
                locale = Locale.ENGLISH;
            }
        }
        return locale;
    }
556575
public void updateUserLocale(HttpServletRequest request, String localeString) {

        IUserInstance ui = userInstanceManager.getUserInstance(request);
        IUserPreferencesManager upm = ui.getPreferencesManager();
        final IUserProfile userProfile = upm.getUserProfile();
        LocaleManager localeManager = userProfile.getLocaleManager();

        if (localeString != null) {

            // build a new List<Locale> from the specified locale
            Locale userLocale = localeManagerFactory.parseLocale(localeString);
            List<Locale> locales = Collections.singletonList(userLocale);

            // set this locale in the session
            localeManager.setSessionLocales(locales);

            // if the current user is logged in, also update the persisted
            // user locale
            final IPerson person = ui.getPerson();
            if (!person.isGuest()) {
                try {
                    localeManager.setUserLocales(Collections.singletonList(userLocale));
                    localeStore.updateUserLocales(person, new Locale[] {userLocale});

                    // remove person layout framgent from session since it contains some of the data
                    // in previous
                    // translation and won't be cleared until next logout-login (applies when using
                    // RDBMDistributedLayoutStore as user layout store).
                    person.setAttribute(Constants.PLF, null);
                    upm.getUserLayoutManager().loadUserLayout(true);
                } catch (Exception e) {
                    throw new PortalException(e);
                }
            }
        }
    }
1195516
public static String getMessage(String key, Locale locale) {

        ResourceBundle bundle = null;
        try {
            bundle = CmsResourceBundleLoader.getBundle("org.opencms.inactiveusers.custom", locale);
            return bundle.getString(key);
        } catch (MissingResourceException e) {
            LOG.info("Customization bundle not found: org.opencms.inactiveusers.custom", e);
            bundle = CmsResourceBundleLoader.getBundle("org.opencms.ui.messages", locale);
            return bundle.getString(key);
        }
    }
1289565
public static CmsJspContentAttachmentsBean getAttachmentsForLocale(
        CmsObject cms,
        CmsResource content,
        String locale) {

        Optional<CmsResource> detailOnly = CmsDetailOnlyContainerUtil.getDetailOnlyPage(cms, content, locale);
        if (!detailOnly.isPresent()) {
            return new CmsJspContentAttachmentsBean();
        } else {
            try {
                return new CmsJspContentAttachmentsBean(cms, detailOnly.get());
            } catch (Exception e) {
                LOG.error(e.getLocalizedMessage(), e);
                return new CmsJspContentAttachmentsBean();
            }
        }
    }
444066
public String getContent(String target, String element, Locale locale) {

        I_CmsResourceLoader loader;
        CmsFile file;
        target = toAbsolute(target);

        try {
            file = getCmsObject().readFile(target);
            loader = OpenCms.getResourceManager().getLoader(file);
        } catch (ClassCastException e) {
            // no loader implementation found
            return CmsMessages.formatUnknownKey(e.getMessage());
        } catch (CmsException e) {
            // file might not exist or no read permissions
            return CmsMessages.formatUnknownKey(e.getMessage());
        }

        try {
            byte[] result = loader.dump(getCmsObject(), file, element, locale, getRequest(), getResponse());
            return new String(result, getRequestContext().getEncoding());
        } catch (UnsupportedEncodingException uee) {
            // encoding unsupported
            return CmsMessages.formatUnknownKey(uee.getMessage());
        } catch (Throwable t) {
            // any other exception, check for hidden root cause first
            Throwable cause = CmsFlexController.getThrowable(getRequest());
            if (cause == null) {
                cause = t;
            }
            handleException(cause);
            return CmsMessages.formatUnknownKey(cause.getMessage());
        }
    }
215629
public static LocaleData get(Locale locale) {
        if (locale == null) {
            throw new NullPointerException("locale == null");
        }

        final String languageTag = locale.toLanguageTag();
        synchronized (localeDataCache) {
            LocaleData localeData = localeDataCache.get(languageTag);
            if (localeData != null) {
                return localeData;
            }
        }
        LocaleData newLocaleData = initLocaleData(locale);
        synchronized (localeDataCache) {
            LocaleData localeData = localeDataCache.get(languageTag);
            if (localeData != null) {
                return localeData;
            }
            localeDataCache.put(languageTag, newLocaleData);
            return newLocaleData;
        }
    }
1090783
private Map<Locale, Map<String, String>> getData() {

        @SuppressWarnings("unchecked")
        Map<Locale, Map<String, String>> result = (Map<Locale, Map<String, String>>)m_cache.getCachedObject(
            m_cms,
            getFilePath());
        if (result == null) {
            try {
                result = m_loader.loadData(m_cms, m_parameters);
                m_cache.putCachedObject(m_cms, getFilePath(), result);
            } catch (Exception e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return result;
    }
363755
public void setContentLocale(Locale locale) {

        m_contentLocale = locale;
        m_dateFieldKey = CmsSearchField.FIELD_INSTANCEDATE + "_" + m_contentLocale.toString() + "_dt";
    }
849587
private List<CmsSelectWidgetOption> getLanguages() {

        List<CmsSelectWidgetOption> locales = new ArrayList<CmsSelectWidgetOption>();

        Locale defLocale = null;
        if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
            defLocale = new CmsUserSettings(m_user).getLocale();
        }
        if (defLocale == null) {
            defLocale = getCms().getRequestContext().getLocale();
        }

        Iterator<Locale> itLocales = OpenCms.getLocaleManager().getAvailableLocales().iterator();
        while (itLocales.hasNext()) {
            Locale locale = itLocales.next();
            boolean selected = locale.equals(defLocale);
            locales.add(
                new CmsSelectWidgetOption(locale.toString(), selected, locale.getDisplayName(getLocale()), null));
        }
        return locales;
    }
152139
public List<Locale> getAvailableLocales(CmsObject cms, CmsResource resource) {

        String availableNames = null;
        try {
            availableNames = cms.readPropertyObject(
                resource,
                CmsPropertyDefinition.PROPERTY_AVAILABLE_LOCALES,
                true).getValue();
        } catch (CmsException exc) {
            LOG.debug("Could not read available locales property for resource " + resource.getRootPath(), exc);
        }

        List<Locale> result = null;
        if (availableNames != null) {
            result = getAvailableLocales(availableNames);
        }
        if ((result == null) || (result.size() == 0)) {
            return Collections.unmodifiableList(m_availableLocales);
        } else {
            return result;
        }
    }
534342
public static String getSiteSelectOptionsStatic(CmsObject cms, Locale locale) {

        List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(
            cms,
            true,
            false,
            cms.getRequestContext().getOuFqn());

        StringBuffer resultBuffer = new StringBuffer();
        Iterator<CmsSite> i = sites.iterator();
        int counter = 0;
        while (i.hasNext()) {
            CmsSite site = i.next();
            String siteRoot = site.getSiteRoot();
            if (!siteRoot.endsWith("/")) {
                siteRoot += "/";
            }
            if (counter != 0) {
                resultBuffer.append("|");
            }
            resultBuffer.append(siteRoot).append(":").append(
                CmsWorkplace.substituteSiteTitleStatic(site.getTitle(), locale));
            counter++;
        }

        if (sites.size() < 1) {
            // no site found, assure that at least the current site is shown in the selector
            String siteRoot = cms.getRequestContext().getSiteRoot();
            CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
            if (!siteRoot.endsWith("/")) {
                siteRoot += "/";
            }
            String title = "";
            if (site != null) {
                title = site.getTitle();
            }
            resultBuffer.append(siteRoot).append(":").append(title);
        }
        return resultBuffer.toString();
    }
446157
protected String generateProjectDescription(CmsObject userCms) {

        CmsUser user = userCms.getRequestContext().getCurrentUser();
        OpenCms.getLocaleManager();
        Locale locale = CmsLocaleManager.getDefaultLocale();
        long time = System.currentTimeMillis();
        Date date = new Date(time);
        DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale);
        String dateString = format.format(date);
        String result = Messages.get().getBundle(locale).key(
            Messages.GUI_WORKFLOW_PROJECT_DESCRIPTION_2,
            user.getName(),
            dateString);
        return result;
    }
1076912
public void setLocale(String locale) {

        if (CmsStringUtil.isEmpty(locale)) {
            m_locale = null;
            m_contentLocale = null;
        } else {
            m_locale = CmsLocaleManager.getLocale(locale);
            m_contentLocale = m_locale;
        }
    }
965380
protected List<CmsResourceStatusRelationBean> getSiblings(CmsObject cms, String locale, CmsResource resource)
    throws CmsException {

        List<CmsResourceStatusRelationBean> result = new ArrayList<CmsResourceStatusRelationBean>();
        for (CmsResource sibling : cms.readSiblings(resource, CmsResourceFilter.ALL)) {
            if (sibling.getStructureId().equals(resource.getStructureId())) {
                continue;
            }
            try {
                CmsPermissionInfo permissionInfo = OpenCms.getADEManager().getPermissionInfo(
                    cms,
                    sibling,
                    resource.getRootPath());
                if (permissionInfo.hasViewPermission()) {
                    CmsResourceStatusRelationBean relationBean = createRelationBean(
                        cms,
                        locale,
                        sibling,
                        permissionInfo);
                    result.add(relationBean);
                }
            } catch (CmsException e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return result;
    }
365043
public static List<String> getAttachmentLocales(CmsObject cms, CmsResource content) {

        List<CmsResource> detailOnlyResources = CmsDetailOnlyContainerUtil.getDetailOnlyResources(cms, content);
        Set<String> validLocaleNames = Sets.newHashSet();
        List<String> result = Lists.newArrayList();
        for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
            validLocaleNames.add(locale.toString());
        }
        validLocaleNames.add(CmsDetailOnlyContainerUtil.LOCALE_ALL);
        for (CmsResource resource : detailOnlyResources) {
            String parent = CmsResource.getParentFolder(resource.getRootPath());
            String parentName = CmsResource.getName(parent);
            parentName = CmsFileUtil.removeTrailingSeparator(parentName);
            if (validLocaleNames.contains(parentName)) {
                result.add(parentName);
            }
        }
        return result;

    }