Gets the decorated content for this decoration object.<p>

@param config the configuration used
@param text the text to be decorated
@param contentLocale the locale of the content to be decorated
@return decorated content
8674
public String getContentDecoration(I_CmsDecoratorConfiguration config, String text, String contentLocale) {

        StringBuffer content = new StringBuffer();
        // TODO: we have to handle with word phrases, too

        // add the pretext
        if (!config.hasUsed(m_decorationKey) && m_decorationDefinition.isMarkFirst()) {
            content.append(m_decorationDefinition.getPreTextFirst());
        } else {
            content.append(m_decorationDefinition.getPreText());
        }
        // now add the original word
        content.append(text);

        // add the posttext
        if (!config.hasUsed(m_decorationKey) && m_decorationDefinition.isMarkFirst()) {
            content.append(m_decorationDefinition.getPostTextFirst());
            config.markAsUsed(m_decorationKey);
        } else {
            content.append(m_decorationDefinition.getPostText());
        }

        // replace the occurance of the ${decoration} makro in the decorated text
        return replaceMacros(content.toString(), contentLocale);
    }
643327
public void setContentLanguage(Locale locale) {
		checkCommitted();
		ContentLanguageHeader contentLanguageHeader =
			SipFactoryImpl.headerFactory.createContentLanguageHeader(locale);
		this.message.setContentLanguage(contentLanguageHeader);
	}
287907
public String importMessage(String key, Locale locale) {

        key = key.trim();
        String[] tokens = key.split("#");
        if (tokens.length != 2) {
            return null;
        }
        String className = tokens[0];
        String messageName = tokens[1];
        try {
            Method messagesGet = Class.forName(className).getMethod("get");
            I_CmsMessageBundle bundle = (I_CmsMessageBundle)(messagesGet.invoke(null));
            return bundle.getBundle(locale).key(messageName);
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return null;
        }
    }
220740
public static Optional<CmsResource> getDetailOnlyPage(
        CmsObject cms,
        CmsResource detailContent,
        String contentLocale) {

        try {
            CmsObject rootCms = OpenCms.initCmsObject(cms);
            rootCms.getRequestContext().setSiteRoot("");
            String path = getDetailOnlyPageNameWithoutLocaleCheck(detailContent.getRootPath(), contentLocale);
            if (rootCms.existsResource(path, CmsResourceFilter.ALL)) {
                CmsResource detailOnlyRes = rootCms.readResource(path, CmsResourceFilter.ALL);
                return Optional.of(detailOnlyRes);
            }
            return Optional.absent();
        } catch (CmsException e) {
            LOG.warn(e.getLocalizedMessage(), e);
            return Optional.absent();
        }
    }
1375002
public static TextComponent of(final @NonNull String content, final @Nullable TextColor color) {
    return of(content, color, Collections.emptySet());
  }
477822
public void load(Configuration config)
	{
		String comment = "";
		for (String c : comments)
		{
			if (MalisisCore.isClient())
				comment += I18n.format(c) + " ";
			else
				comment += c + " ";
		}

		property = config.get(category, key, writeValue(defaultValue), comment, type);
		value = readValue(property.getString());
		if (value == null)
			throw new NullPointerException("readPropertyValue should not return null!");
	}
727475
@Nonnull
  public static Pattern string2pattern(@Nonnull final String text, final int patternFlags) {
    final StringBuilder result = new StringBuilder();

    for (final char c : text.toCharArray()) {
      result.append("\\u"); //NOI18N
      final String code = Integer.toHexString(c).toUpperCase(Locale.ENGLISH);
      result.append("0000", 0, 4 - code.length()).append(code); //NOI18N
    }

    return Pattern.compile(result.toString(), patternFlags);
  }
439839
@NonNull
    public static SpannableString getColorText(@NonNull CharSequence content, int start, int end, @ColorInt int color) {
        SpannableString stringSpan = new SpannableString(content);
        stringSpan.setSpan(new ForegroundColorSpan(color), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        return stringSpan;
    }
826582
protected void initLocalizationContent(String configurationFileName) {

        CmsObject cms = null;
        try {
            // this will always be in the root site
            cms = OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest());
        } catch (CmsException e) {
            // error initializing cms object, log error
            if (LOG.isErrorEnabled()) {
                LOG.error(
                    Messages.get().getBundle().key(
                        Messages.ERR_INVALID_INIT_USER_1,
                        OpenCms.getDefaultUsers().getUserGuest()));
            }
        }
        if ((cms != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(configurationFileName)) {
            // try to get XML content from cache
            Object o = CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(cms, configurationFileName);
            if (o != null) {
                // found the cached XML content, use it
                m_localizationContent = (CmsXmlContent)o;
                return;
            }
            try {
                CmsFile configFile = cms.readFile(configurationFileName);
                m_localizationContent = CmsXmlContentFactory.unmarshal(cms, configFile);
                // store unmarshaled content in cache
                CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(
                    cms,
                    configurationFileName,
                    m_localizationContent);
            } catch (CmsException e) {
                // ignore, no configuration file found
            }
        }
    }
1171849
public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) {

        return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle);

    }
1297542
public String getConfigurationContentStringValue(String path) {

        if (getConfigurationContent() != null) {
            return getConfigurationContent().getStringValue(getCms(), path, getLocale());
        }
        return "";
    }
1230757
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;
        }
    }
165962
public static String getDetailContainerLocale(CmsObject cms, String contentLocale, CmsResource resource) {

        boolean singleLocale = useSingleLocaleDetailContainers(cms.getRequestContext().getSiteRoot());
        if (!singleLocale) {
            try {
                CmsProperty prop = cms.readPropertyObject(
                    resource,
                    CmsPropertyDefinition.PROPERTY_LOCALE_INDEPENDENT_DETAILS,
                    true);
                singleLocale = Boolean.parseBoolean(prop.getValue());
            } catch (Exception e) {
                LOG.warn(e.getMessage(), e);
            }
        }
        return singleLocale ? LOCALE_ALL : contentLocale;
    }
483780
@NonNull
    public static Context applyLanguageForContext(@NonNull Context context, @NonNull Locale locale) {
        Resources resources = context.getResources();
        Configuration config = resources.getConfiguration();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            config.setLocale(locale);
            return context.createConfigurationContext(config);
        } else {
            config.locale = locale;
            resources.updateConfiguration(config, resources.getDisplayMetrics());
            return context;
        }
    }
478832
public static Config newConfigFromText(String text) {
        Config c = new Config();
        c.parseBuffer(new BufferedReader(new StringReader(text)));
        return c;
    }
130364
public static Content content(String somePlainText) {
		Content c = null;
		try {
			c = new Content("text/plain; charset=UTF-8", somePlainText.getBytes("UTF-8"));
		} catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */
		}
		return c;
	}
128082
private static String getTextContent(final Element element) {
		if (element != null) {
			String content = element.getTextContent();
			if (content != null) {
				content = content.trim();
			}
			return content;
		}
		return null;
	}