/** * Gets the list of secondary translation locales.<p> * * @return the list of secondary translation locales */ public List<Locale> getSecondaryTranslationLocales() { List<Locale> result = Lists.newArrayList(); Map<String, String> params = getParameters(); String value = params.get(PARAM_SECONDARY_LOCALES); if (!CmsStringUtil.isEmpty(value)) { String[] tokens = value.trim().split(" *, *"); for (String token : tokens) { Locale locale = CmsLocaleManager.getLocale(token); if (!result.contains(locale)) { result.add(locale); } } } return result; }
/** * Gets the main translation locale for this site.<p> * * @param defaultValue the value to return as a default when no main translation locale is set * @return the main translation locale */ public Locale getMainTranslationLocale(Locale defaultValue) { Map<String, String> params = getParameters(); String value = params.get(PARAM_MAIN_LOCALE); if (!CmsStringUtil.isEmpty(value)) { return CmsLocaleManager.getLocale(value); } else { return defaultValue; } }
/** * Sets a site parameter and writes back the updated system configuration.<p> * * @param siteRoot the root path used to identify the site * * @param key the parameter key * @param value the parameter value */ public void setSiteParam(String siteRoot, String key, String value) { CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(siteRoot); if (site == null) { throw new IllegalArgumentException("No site found for path: " + siteRoot); } else { site.getParameters().put(key, value); OpenCms.writeConfiguration(CmsSystemConfiguration.class); } }
m_siteParams = site.getParameters(); m_aliases = site.getAliases();
if ((site.getParameters() != null) && !site.getParameters().isEmpty()) { Element parametersElem = siteElement.addElement(N_PARAMETERS); for (Map.Entry<String, String> entry : site.getParameters().entrySet()) { Element paramElem = parametersElem.addElement(N_PARAM); paramElem.addAttribute(A_NAME, entry.getKey());