Adds a message to the default locale.
@param code The code
@param message The the message
@return This message source
970378
public @Nonnull StaticMessageSource addMessage(@Nonnull String code, @Nonnull String message) {
        if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(message)) {
            messageMap.put(new MessageKey(Locale.getDefault(), code), message);
        }
        return this;
    }
11421
@Override
    public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
        return activity.getActivityContext().getMessageSource().getMessage(code, args, defaultMessage, locale);
    }
826731
public String getMessage(String key, Locale locale)
	{
		if (null == locale)
		{
			return getMessage(key);
		}
		return CollectionTools.getString(getResourceBundle(locale), key, getBehaviourOnMissingMessage().getValueOnMissingMessage(key));
	}
960696
private function createMessage($message, int $code): string
    {
        if (is_array($message)) {
            if (!array_key_exists('code', $message)) {
                $message['code'] = $code;
            }
            $callback = function ($m) use ($message) {
                $key = trim($m[1]);
                if (!isset($message[$key])) {
                    return '';
                }
                $value = $message[$key];
                if (is_object($value)) {
                    if (method_exists($value, '__toString')) {
                        $value = (string)$value;
                    } else {
                        $value = get_class($value);
                    }
                }
                return $value;
            };
            return preg_replace_callback('~\{\{(.*?)\}\}~', $callback, $this->defaultMessage);
        }
        return ($message !== null) ? $message : $this->defaultMessage;
    }
984765
public void addAcceptLanguage(Locale locale) {
		checkCommitted();
		AcceptLanguageHeader ach = SipFactoryImpl.headerFactory
				.createAcceptLanguageHeader(locale);
		message.addHeader(ach);

	}
608883
public TranslationRequest addCode(String theSystem, String theCode) {
		Validate.notBlank(theSystem, "theSystem must not be null");
		Validate.notBlank(theCode, "theCode must not be null");
		if (getCodeableConcept() == null) {
			setCodeableConcept(new CodeableConcept());
		}
		getCodeableConcept().addCoding(new Coding().setSystem(theSystem).setCode(theCode));
		return this;
	}
976623
private void addMessage(final WMessageBox box, final Message message, final boolean encode) {
		String code = message.getMessage();

		if (!Util.empty(code)) {
			box.addMessage(encode, code, message.getArgs());
		}
	}
220975
function (msg) {
            if (this.utilsType.isObject(msg)) {
                this.message = msg;
                this.localized_message = msg.localizedMessage;
            } else if (this.utilsType.isString(msg)) {
                this.localized_message = msg;
                this.message = ariaUtilsData.createMessage(msg);
            }
        }
993847
public static void setLocale(Locale locale) {
        if (RepositoryUtils.locale == null) {
            RepositoryUtils.locale = locale;
        } else {
            if (RepositoryUtils.locale != locale) {
                RepositoryUtils.locale = locale;
                messages = null;
                installMessages = null;
            }
        }
    }
677284
public void addMessage(final boolean encode, final String msg, final Serializable... args) {
		MessageModel model = getOrCreateComponentModel();
		model.messages.add(new Duplet<>(I18nUtilities.asMessage(msg, args), encode));
		// Potential for leaking memory here
		MemoryUtil.checkSize(model.messages.size(), this.getClass().getSimpleName());
	}
727588
public Locale getLocaleOrDefault(String language) {
        String lang = getLanguageOrDefault(language);
        return Locale.forLanguageTag(lang);
    }
614974
private String getMessage(boolean localized) {
        String msg = localized ? super.getLocalizedMessage() : super.getMessage();
        StringBuilder sb = new StringBuilder(msg == null ? "" : msg);
        
        for (Throwable exception : exceptions) {
            msg = localized ? exception.getLocalizedMessage() : exception.getMessage();
            
            if (msg != null) {
                sb.append(sb.length() == 0 ? "" : "\n\n").append(msg);
            }
        }
        
        return sb.toString();
    }
645527
public String getMessage(String key, Locale locale, Object[] parameters)
	{
		if (null == locale)
		{
			return getMessage(key, parameters);
		}
		if (null == parameters)
		{
			return getMessage(key, locale);
		}
		if (null != key)
		{
			MessageFormat _messageFormat = new MessageFormat(getMessage(key, locale));
			return _messageFormat.format(parameters);
		}

		return null;
	}
1151781
public static String getLocalisedText(final Locale locale, final String text) {
		String message = null;
		String resourceBundleBaseName = getResourceBundleBaseName();

		if (!Util.empty(resourceBundleBaseName)) {
			Locale effectiveLocale = locale;

			if (effectiveLocale == null) {
				effectiveLocale = getEffectiveLocale();
			}

			try {
				// TODO: This is slow
				ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleBaseName, effectiveLocale);
				message = bundle.getString(text);
			} catch (MissingResourceException e) {
				// Fall back to the Configuration mechanism for the default internal messages
				if (text != null && text.startsWith(ConfigurationProperties.INTERNAL_MESSAGE_PREFIX)) {
					message = ConfigurationProperties.getInternalMessage(text);
				}

				if (message == null && !MISSING_RESOURCES.contains(locale)) {
					LOG.error("Missing resource mapping for locale: " + locale + ", text: " + text);
					MISSING_RESOURCES.add(locale);
				}
			}
		} else if (text != null && text.startsWith(ConfigurationProperties.INTERNAL_MESSAGE_PREFIX)) {
			// Fall back to the Configuration mechanism for the default internal messages
			message = ConfigurationProperties.getInternalMessage(text);
		}

		return message;
	}
1367499
@NotNull
    @ObjectiveCName("addPreferredLanguage:")
    public ConfigurationBuilder addPreferredLanguage(String language) {
        if (!preferredLanguages.contains(language)) {
            preferredLanguages.add(language);
        }
        return this;
    }
776311
@Override
    protected MessageFormat resolveCode(String code, Locale locale)
    {
        String ret = null;
        String country = locale.getCountry();
        String language = locale.getLanguage();
        String variant = locale.getVariant();
        logger.debug("Code {} Initial locale {}",code,locale.toString());
        Locale thisLocale = null;
        if (!StringUtils.isEmpty(variant))
        {
            thisLocale = new Locale(language,country,variant);
            Map<String,String> m = m_map.get(thisLocale);
            if (m != null)
            {
                ret = m.get(code);
            }
            logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);

        }
        if (ret == null)
        {
            if (!StringUtils.isEmpty(country))
            {
                thisLocale = new Locale(language,country);
                Map<String,String> m = m_map.get(thisLocale);
                if (m != null)
                {
                    ret = m.get(code);
                }
                logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);
            }
        }
        if (ret == null)
        {
            if (!StringUtils.isEmpty(language))
            {
                thisLocale = new Locale(language);
                Map<String,String> m = m_map.get(thisLocale);
                if (m != null)
                {
                    ret = m.get(code);
                }
                logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);
            }
        }
        if (ret == null)
        {
           thisLocale = Locale.getDefault();
            Map<String,String> m = m_map.get(thisLocale);
            if (m != null)
            {
                ret = m.get(code);
            }
            logger.debug("tried locale {} result: {}",thisLocale.toString(),ret);
        }
        if (ret == null)
        {
            return null;
        }
        return new MessageFormat(ret, locale);
    }
446701
public static String getText(String code, Object[] args, Locale locale) {
        Preconditions.checkState(messageSource != null,
                "If i18n is enabled, please make sure MessageSource is properly set as a member in "
                        + "MessageSupport");
        return messageSource.getMessage(code, args, locale);
    }