Translates the given message into the appropriate user text. This takes the current locale into consideration, if
set.

@param messageObject the message to translate.
@return the translated message.
346428
private String translate(final Object messageObject) {
		if (messageObject instanceof Message) {
			Message message = (Message) messageObject;
			return I18nUtilities.format(locale, message.getMessage(), (Object[]) message.getArgs());
		} else if (messageObject != null) {
			return I18nUtilities.format(locale, messageObject.toString());
		}

		return null;
	}
1035332
public Object map(final Value message) throws ObjectToIdMappingException {
        final UUID valueId = message.getObservableObjectId();
        if (valueId != null) {
            return objectRegistry.getByIdOrFail(valueId);
        } else {
            return message.getSimpleObjectValue();
        }
    }
740250
protected String getMessageInternal(Locale locale, String code, Object[] args) {
		if(code == null) {
			return null;
		}

		if(locale == null) {
			locale = I18nUtils.getLocale();
		}

		final MessageFormat messageFormat = resolveMessageFormat(locale, code);
		if(messageFormat != null) {
			synchronized(messageFormat) {
				return messageFormat.format(args);
			}
		}

		return null;
	}
729299
public function translate($message, $textDomain = 'default', $locale = null)
    {
        $textDomain = $textDomain !== 'default' ? $textDomain : $this->domain();
        $locale = $locale ?: (string) $this->currentLanguage();

        return $this->translationService()->translate($message, $textDomain, $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);
    }
235515
public MessageVersion getMessageVersion(String version)
    {
        MessageVersion recMessageVersion = this.getMessageVersion();
        recMessageVersion.setKeyArea(MessageVersion.CODE_KEY);
        version = MessageControl.fixVersion(version);
        recMessageVersion.getField(MessageVersion.CODE).setString(version);
        try {
            if (version != null)
                if (recMessageVersion.seek(DBConstants.EQUALS))
            {
                return recMessageVersion;
            }
        } catch (DBException e) {
            e.printStackTrace();
        }
        return (MessageVersion)((ReferenceField)this.getField(MessageControl.DEFAULT_VERSION_ID)).getReference();
    }
889773
public Object toObject(String pStr){
        String decoded = null;
        try{
            decoded = decoder.decode(pStr);
        }catch(DecoderException ex){
             ex.printStackTrace();
             throw new TranslationException(ex.getMessage());
        }
        return decoded;
    }
468038
public MonolingualTextValue copy(MonolingualTextValue object) {
		return dataObjectFactory.getMonolingualTextValue(object.getText(), object.getLanguageCode());
	}
1308618
public String getMessage(final MSLocale locale, final String key, final String defaultValue) {
        String message = getMessage(locale, key);
        return message == null ? defaultValue : message;
    }
1053242
public static LocalizedMessages getInstance(Locale locale)
  {
    LocalizedMessages instance = null;

    if (locale == null)
    {
      locale = Locale.getDefault();
    }

    String localeKey = locale.getLanguage();
    if (localizedMessages.containsKey(localeKey))
    {
      instance = localizedMessages.get(localeKey);
    } 
    else
    {
      synchronized (LocalizedMessages.class)
      {
        if (instance == null)
        {
          instance = new LocalizedMessages(locale);
          localizedMessages.put(localeKey, instance);
        }
      }
    }

    return instance;
  }
1303753
@Override
    public JsMessage getMessage()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getMessage");

        JsMessage localMsg = getJSMessage(true);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getMessage", localMsg);

        return localMsg;
    }
1323915
static String getMessage(CmsObject cms, String message, Object... args) {

        Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
        return Messages.get().getBundle(locale).key(message, args);
    }
785013
private void extractMessage(JsonObject object) {
        // Prefer to pull the message out of meta
        JsonObject meta = object.getAsJsonObject("meta");
        if (meta != null) {
            JsonPrimitive msg = meta.getAsJsonPrimitive("msg");
            if (msg != null) {
                this.message = msg.getAsString();
                return;
            }
        }

        // Fall back on error
        JsonPrimitive error = object.getAsJsonPrimitive("error");
        if (error != null) {
            this.message = error.getAsString();
            return;
        }

        // Otherwise set a default
        this.message = "Unknown Error";
    }
240266
private String messageImportInvalidFormat(Locale locale) {

        return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_BAD_FORMAT_0);
    }
304385
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        // ICU 4.8 custom deserialization.
        String languageTag = (String)in.readObject();
        ulocale = ULocale.forLanguageTag(languageTag);
        MessagePattern.ApostropheMode aposMode = (MessagePattern.ApostropheMode)in.readObject();
        if (msgPattern == null || aposMode != msgPattern.getApostropheMode()) {
            msgPattern = new MessagePattern(aposMode);
        }
        String msg = (String)in.readObject();
        if (msg != null) {
            applyPattern(msg);
        }
        // custom formatters
        for (int numFormatters = in.readInt(); numFormatters > 0; --numFormatters) {
            int formatIndex = in.readInt();
            Format formatter = (Format)in.readObject();
            setFormat(formatIndex, formatter);
        }
        // skip future (int, Object) pairs
        for (int numPairs = in.readInt(); numPairs > 0; --numPairs) {
            in.readInt();
            in.readObject();
        }
    }
495815
@SuppressWarnings("unchecked")
    public <T> T convertMessage(@NotNull final Message message, final Class<T> clazz) {
        checkMessageBody(message);
        message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME,
                clazz.getName());
        return (T) rabbitTemplate.getMessageConverter().fromMessage(message);
    }
695530
function translateObject(language, key, destObj, keysArray, valuesArray) {
	return new Promise(function (resolve, reject) {
		translateService.translate(valuesArray, language, function (err, res) {
			if (err || !res) {
				reject(err);
			} else {
				// Google-translate doesn't return an array if we only send a single string to translate
				res = _.concat(res);
				for (var i = 0; i < keysArray.length; i++) {
					destObj[key][keysArray[i]] = res[i].translatedText;
				}

				resolve(destObj);
			}
		});
	});
}