lib/index.js
function translate(messageObj) {
  // Default to English if we don't have this message, or don't support this
  // language at all
  var language = messageObj.language && this[messageObj.language] &&
    this[messageObj.language][messageObj.messageKey] ?
    messageObj.language :
    'en';
  var rv = this[language][messageObj.messageKey];

  if (messageObj.messageParam) {
    rv = rv.replace('%s', messageObj.messageParam);
  }
  return rv;
}
function translate(messageObj) {
  // Default to English if we don't have this message, or don't support this
  // language at all
  var language = messageObj.language && this[messageObj.language] &&
    this[messageObj.language][messageObj.messageKey] ?
    messageObj.language :
    'en';
  var rv = this[language][messageObj.messageKey];

  if (messageObj.messageParam) {
    rv = rv.replace('%s', messageObj.messageParam);
  }
  return rv;
}
function translate ( messageObj ) { // Default to English if we don't have this message, or don't support this // language at all var language = messageObj . language && this [ messageObj . language ] && this [ messageObj . language ] [ messageObj . messageKey ] ? messageObj . language : 'en' ; var rv = this [ language ] [ messageObj . messageKey ] ; if ( messageObj . messageParam ) { rv = rv . replace ( '%s' , messageObj . messageParam ) ; } return rv ; }
Very basic translation function. To translate or customize the UI messages,
set options.messages. To also customize the translation function itself, set
option.translateFn to a function that handles the same message object format.

@param {Object} messageObj
the message object
@param {String} messageObj.messageKey
an identifier used for looking up the message in i18n files
@param {String} messageObj.messageParam
for substitution of %s for filename and description in the respective
messages
@param {String} [messageObj.language='en']
a language code, ignored in the default implementation
@this {Object}
the built-in default messages, or options.messages if set
Very basic translation function . To translate or customize the UI messages set options . messages . To also customize the translation function itself set option . translateFn to a function that handles the same message object format .