Performs the save content action.<p>

This is also used when changing the element language.<p>

@param locale the locale to save the content
@throws JspException if including the error page fails
484542
public void actionSave(Locale locale) throws JspException {

        try {
            setEditorValues(locale);
            // check if content has errors
            if (!hasValidationErrors()) {
                // no errors found, write content and copy temp file contents
                writeContent();
                commitTempFile();
                // set the modified parameter
                setParamModified(Boolean.TRUE.toString());
                // update the offline search indices
                OpenCms.getSearchManager().updateOfflineIndexes();
            }
        } catch (CmsException e) {
            showErrorPage(e);
        }

    }
227534
@Override
    public void actionEdit(HttpServletRequest request) throws JspException {

        // save initialized instance of this class in request attribute for included sub-elements
        getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
        try {
            // save the changes only if resource is properly locked
            if (isEditable()) {
                performEditOperation(request);
            }
        } catch (Throwable e) {
            // Cms error defining property, show error dialog
            includeErrorpage(this, e);
        }
    }
197238
public void setLocale(Locale locale)
   {
      List<SimpleDateFormat> formats = new ArrayList<SimpleDateFormat>();
      for (SimpleDateFormat format : m_formats)
      {
         formats.add(new SimpleDateFormat(format.toPattern(), locale));
      }

      m_formats = formats.toArray(new SimpleDateFormat[formats.size()]);
   }
533737
public function setLocale(Locale $locale)
    {
        putenv('LANG='.$locale);
        setlocale(LC_ALL, [$locale.'.utf8', $locale]);
        $this->curLocale = $locale;
        $this->sessionSegment->set('locale', $locale);
    }
1123779
protected function getLocalizedTagContent(\SimpleXMLElement $element, $locale = null)
    {
        if (0 === $element->count()) {
            return '';
        }

        if (null === $locale) {
            return $this->multilineRemoveIndent((string)$element, 'true' === (string)$element->attributes()['removeIndent']);
        }

        foreach ($element as $node) {
            if ($locale == (string)$node->attributes()['locale']) {
                return $this->multilineRemoveIndent((string)$node, 'true' === (string)$node->attributes()['removeIndent']);
            }
        }

        $message = sprintf('Locale "%s" not available in node "%s".', $locale, $element->getName());
        throw new \Exception($message);
    }
637967
void setLocale(Locale locale)
   {
      m_taskNames = LocaleData.getStringArray(locale, LocaleData.TASK_NAMES);

      String name;
      m_taskNumbers.clear();

      for (int loop = 0; loop < m_taskNames.length; loop++)
      {
         name = m_taskNames[loop];

         if (name != null)
         {
            m_taskNumbers.put(name, Integer.valueOf(loop));
         }
      }
   }
825103
public void actionUpdateLanguages() throws JspException {

        if ((m_paramSelectedLanguages != null) && !m_paramSelectedLanguages.isEmpty()) {
            try {
                CmsFile file = getCms().readFile(getParamTempfile(), CmsResourceFilter.IGNORE_EXPIRATION);
                CmsXmlContent content = CmsXmlContentFactory.unmarshal(getCms(), file);

                List<Locale> toLocales = new ArrayList<Locale>();
                for (Iterator<String> i = m_paramSelectedLanguages.iterator(); i.hasNext();) {
                    String language = i.next();
                    toLocales.add(CmsLocaleManager.getLocale(language));
                }

                // now transfer the contents
                transferContents(content, getElementLocale(), toLocales);

                // write the temporary file
                String decodedContent = content.toString();
                try {
                    file.setContents(decodedContent.getBytes(content.getEncoding()));
                } catch (UnsupportedEncodingException e) {
                    throw new CmsException(
                        Messages.get().container(Messages.ERR_INVALID_CONTENT_ENC_1, getParamResource()),
                        e);
                }
                // the file content might have been modified during the write operation
                CmsObject cloneCms = OpenCms.initCmsObject(getCms());
                CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId();
                cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId));
                cloneCms.writeFile(file);

            } catch (Throwable e) {
                // show error dialog
                setParamMessage(Messages.get().getBundle(getLocale()).key(Messages.ERR_UPDATE_LANGUAGES_0));
                includeErrorpage(this, e);
            }
        }
    }
936772
public void init(CmsObject cms, Locale locale, I_CmsXmlDocument content, CmsResource resource) {

        m_cms = cms;
        m_requestedLocale = locale;
        m_content = content;
        m_resource = resource;
    }
984765
public void addAcceptLanguage(Locale locale) {
		checkCommitted();
		AcceptLanguageHeader ach = SipFactoryImpl.headerFactory
				.createAcceptLanguageHeader(locale);
		message.addHeader(ach);

	}
431170
@Override
    public boolean save(String content, String location) {
        return save(content, Charsets.UTF_8, location);
    }
305728
def _add_locale(locale, strings)
      `t = document.createElement('template');
      document.body.appendChild(t);
      t.classList.add('i18n');
      t.setAttribute('data-lang', #{locale})`

      strings.each do |k, v|
        `e=document.createElement('p');
        t.content.appendChild(e);
        e.id=#{k.gsub('.', '-')};
        e.textContent=#{v}`
      end
    end
542822
public static Document createDocument(Locale locale) {

        Document doc = DocumentHelper.createDocument();
        Element pages = doc.addElement(CmsXmlPage.NODE_PAGES);
        pages.add(I_CmsXmlSchemaType.XSI_NAMESPACE);
        pages.addAttribute(
            I_CmsXmlSchemaType.XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION,
            CmsXmlPage.XMLPAGE_XSD_SYSTEM_ID);

        Element page = pages.addElement(CmsXmlPage.NODE_PAGE);
        page.addAttribute(CmsXmlPage.ATTRIBUTE_LANGUAGE, locale.toString());

        return doc;
    }
700651
public void doTag()
            throws JspException
    {
        PageContext pageContext = getPageContext();

        // Were any error messages specified?
        ActionMessages errors = null;
        try {
            errors = RequestUtils.getActionMessages(pageContext, Globals.ERROR_KEY);
        }
        catch (JspException e) {
            RequestUtils.saveException(pageContext, e);
            throw e;
        }

        if ((errors == null) || errors.isEmpty()) {
            if (hasErrors())
                reportErrors();
            return;
        }

        String qualifiedBundle = InternalUtils.getQualifiedBundleName(_bundleName, pageContext.getRequest());

        boolean headerPresent = false;
        boolean footerPresent = false;
        boolean prefixPresent = false;
        boolean suffixPresent = false;

        String locale = _locale;
        if (!isMissingUserDefaultMessages(pageContext)) {
            try {
                // Check for presence of header and footer message keys
                headerPresent =
                        RequestUtils.present(pageContext, qualifiedBundle, locale, "errors.header");
                footerPresent =
                        RequestUtils.present(pageContext, qualifiedBundle, locale, "errors.footer");
                prefixPresent =
                        RequestUtils.present(pageContext, qualifiedBundle, locale, "errors.prefix");
                suffixPresent =
                        RequestUtils.present(pageContext, qualifiedBundle, locale, "errors.suffix");
            }
            catch (JspException e) {
                String s = Bundle.getString("Tags_ErrorsException",
                        new Object[]{e.getMessage()});
                registerTagError(s, null);
                reportErrors();
                return;
            }
        }

        // Render the error messages appropriately
        InternalStringBuilder results = new InternalStringBuilder(128);
        boolean headerDone = false;
        String message = null;
        Iterator reports = null;
        reports = errors.get();

        while (reports.hasNext()) {
            ActionMessage report = (ActionMessage) reports.next();
            if (!headerDone) {
                if (headerPresent) {
                    message = RequestUtils.message(pageContext, qualifiedBundle, locale, "errors.header");
                    results.append(message);
                    results.append("\r\n");
                }
                headerDone = true;
            }
            if (prefixPresent) {
                message = RequestUtils.message(pageContext, qualifiedBundle, locale, "errors.prefix");
                results.append(message);
            }
            message = getErrorMessage(report, qualifiedBundle);
            if (message != null) {
                results.append(message);
                results.append("\r\n");
            }
            if (suffixPresent) {
                message = RequestUtils.message(pageContext, qualifiedBundle, locale, "errors.suffix");
                results.append(message);
            }
        }
        if (headerDone && footerPresent) {
            message = RequestUtils.message(pageContext, qualifiedBundle, locale, "errors.footer");
            results.append(message);
            results.append("\r\n");
        }

        if (hasErrors())
            reportErrors();

        // Print the results to our output writer
        write(results.toString());
    }
1235535
void ensureSingleLocale(CmsXmlContainerPage containerPage, CmsResource localeRes) throws CmsException {

        CmsObject cms = getCmsObject();
        Locale mainLocale = CmsLocaleManager.getMainLocale(cms, localeRes);
        OpenCms.getLocaleManager();
        Locale defaultLocale = CmsLocaleManager.getDefaultLocale();
        if (containerPage.hasLocale(mainLocale)) {
            removeAllLocalesExcept(containerPage, mainLocale);
            // remove other locales
        } else if (containerPage.hasLocale(defaultLocale)) {
            containerPage.copyLocale(defaultLocale, mainLocale);
            removeAllLocalesExcept(containerPage, mainLocale);
        } else if (containerPage.getLocales().size() > 0) {
            containerPage.copyLocale(containerPage.getLocales().get(0), mainLocale);
            removeAllLocalesExcept(containerPage, mainLocale);
        } else {
            containerPage.addLocale(cms, mainLocale);
        }
    }
835452
public void setLocale(String locale) {

        try {
            m_locale = LocaleUtils.toLocale(locale);
        } catch (IllegalArgumentException e) {
            LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e);
            m_locale = null;
        }
    }
1316631
public void writeContainerPage(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException {

        // keep unused containers
        CmsContainerPageBean savePage = cleanupContainersContainers(cms, cntPage);
        savePage = removeEmptyContainers(cntPage);
        // Replace existing locales with master locale
        for (Locale locale : getLocales()) {
            removeLocale(locale);
        }
        Locale masterLocale = CmsLocaleManager.MASTER_LOCALE;
        addLocale(cms, masterLocale);

        // add the nodes to the raw XML structure
        Element parent = getLocaleNode(masterLocale);
        saveContainerPage(cms, parent, savePage);
        initDocument(m_document, m_encoding, m_contentDefinition);
    }
490489
@Override
    public boolean save(String content, Charset charset, String location) {
        File file = new File(location);
        try {
            Files.writeToFile(file, content, charset);
        } catch (IOException ex) {
            return false;
        }
        return true;
    }