/*
Método getText()
metodo magico que trabalha recursivamente nos filhos e netos desse objeto
prepara as linhas para serem exportadas para txt
174976
public function getText()
    {
        $retorno = '';
        foreach ($this->meta as $key => $value) {
            $retorno .= $this->$key;
        }
        RemessaAbstract::$retorno[] = $retorno;
        if ($this->children) {
            // percorre todos objetos filhos
            foreach ($this->children as $child) {
                $child->getText();
            }
        }
    }
999104
public Object[][] getContents() {
        Object[][] contents = new Object[][] {
            {   MsgKey.BAD_MSGKEY,
                "A chave de mensagem ''{0}'' n\u00e3o est\u00e1 na classe de mensagem ''{1}''" },

            {   MsgKey.BAD_MSGFORMAT,
                "O formato da mensagem ''{0}'' na classe de mensagem ''{1}'' falhou." },

            {   MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
                "A classe de serializador ''{0}'' n\u00e3o implementa org.xml.sax.ContentHandler." },

            {   MsgKey.ER_RESOURCE_COULD_NOT_FIND,
                    "O recurso [ {0} ] n\u00e3o p\u00f4de ser encontrado.\n{1}" },

            {   MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
                    "O recurso [ {0} ] n\u00e3o p\u00f4de carregar: {1} \n {2} \t {3}" },

            {   MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
                    "Tamanho do buffer <=0" },

            {   MsgKey.ER_INVALID_UTF16_SURROGATE,
                    "Detectado substituto UTF-16 inv\u00e1lido: {0} ?" },

            {   MsgKey.ER_OIERROR,
                "Erro de E/S" },

            {   MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
                "Imposs\u00edvel incluir atributo {0} depois de n\u00f3s filhos ou antes da gera\u00e7\u00e3o de um elemento. O atributo ser\u00e1 ignorado." },

            /*
             * Note to translators:  The stylesheet contained a reference to a
             * namespace prefix that was undefined.  The value of the substitution
             * text is the name of the prefix.
             */
            {   MsgKey.ER_NAMESPACE_PREFIX,
                "O espa\u00e7o de nomes do prefixo ''{0}'' n\u00e3o foi declarado. " },

            /*
             * Note to translators:  This message is reported if the stylesheet
             * being processed attempted to construct an XML document with an
             * attribute in a place other than on an element.  The substitution text
             * specifies the name of the attribute.
             */
            {   MsgKey.ER_STRAY_ATTRIBUTE,
                "Atributo ''{0}'' fora do elemento. " },

            /*
             * Note to translators:  As with the preceding message, a namespace
             * declaration has the form of an attribute and is only permitted to
             * appear on an element.  The substitution text {0} is the namespace
             * prefix and {1} is the URI that was being used in the erroneous
             * namespace declaration.
             */
            {   MsgKey.ER_STRAY_NAMESPACE,
                "Declara\u00e7\u00e3o de espa\u00e7o de nomes ''{0}''=''{1}'' fora do elemento. " },

            {   MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
                "N\u00e3o foi poss\u00edvel carregar ''{0}'' (verifique CLASSPATH) agora , utilizando somente os padr\u00f5es" },

            {   MsgKey.ER_ILLEGAL_CHARACTER,
                "Tentativa de processar o caractere de um valor integral {0} que n\u00e3o \u00e9 representado na codifica\u00e7\u00e3o de sa\u00edda especificada de {1}." },

            {   MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
                "N\u00e3o foi poss\u00edvel carregar o arquivo de propriedade ''{0}'' para o m\u00e9todo de sa\u00edda ''{1}'' (verifique CLASSPATH)" },

            {   MsgKey.ER_INVALID_PORT,
                "N\u00famero de porta inv\u00e1lido" },

            {   MsgKey.ER_PORT_WHEN_HOST_NULL,
                "A porta n\u00e3o pode ser definida quando o host \u00e9 nulo" },

            {   MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
                "O host n\u00e3o \u00e9 um endere\u00e7o formado corretamente" },

            {   MsgKey.ER_SCHEME_NOT_CONFORMANT,
                "O esquema n\u00e3o est\u00e1 em conformidade." },

            {   MsgKey.ER_SCHEME_FROM_NULL_STRING,
                "Imposs\u00edvel definir esquema a partir da cadeia nula" },

            {   MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
                "O caminho cont\u00e9m seq\u00fc\u00eancia de escape inv\u00e1lida" },

            {   MsgKey.ER_PATH_INVALID_CHAR,
                "O caminho cont\u00e9m caractere inv\u00e1lido: {0}" },

            {   MsgKey.ER_FRAG_INVALID_CHAR,
                "O fragmento cont\u00e9m caractere inv\u00e1lido" },

            {   MsgKey.ER_FRAG_WHEN_PATH_NULL,
                "O fragmento n\u00e3o pode ser definido quando o caminho \u00e9 nulo" },

            {   MsgKey.ER_FRAG_FOR_GENERIC_URI,
                "O fragmento s\u00f3 pode ser definido para um URI gen\u00e9rico" },

            {   MsgKey.ER_NO_SCHEME_IN_URI,
                "Nenhum esquema encontrado no URI" },

            {   MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
                "Imposs\u00edvel inicializar URI com par\u00e2metros vazios" },

            {   MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
                "O fragmento n\u00e3o pode ser especificado no caminho e fragmento" },

            {   MsgKey.ER_NO_QUERY_STRING_IN_PATH,
                "A cadeia de consulta n\u00e3o pode ser especificada na cadeia de consulta e caminho" },

            {   MsgKey.ER_NO_PORT_IF_NO_HOST,
                "Port n\u00e3o pode ser especificado se host n\u00e3o for especificado" },

            {   MsgKey.ER_NO_USERINFO_IF_NO_HOST,
                "Userinfo n\u00e3o pode ser especificado se host n\u00e3o for especificado" },
            {   MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
                "Aviso:  A vers\u00e3o do documento de sa\u00edda precisa ser ''{0}''.  Essa vers\u00e3o do XML n\u00e3o \u00e9 suportada. A vers\u00e3o do documento de sa\u00edda ser\u00e1 ''1.0''." },

            {   MsgKey.ER_SCHEME_REQUIRED,
                "O esquema \u00e9 obrigat\u00f3rio!" },

            /*
             * Note to translators:  The words 'Properties' and
             * 'SerializerFactory' in this message are Java class names
             * and should not be translated.
             */
            {   MsgKey.ER_FACTORY_PROPERTY_MISSING,
                "O objeto Properties transmitido para SerializerFactory n\u00e3o tem uma propriedade ''{0}''." },

            {   MsgKey.ER_ENCODING_NOT_SUPPORTED,
                "Aviso:  A codifica\u00e7\u00e3o ''{0}'' n\u00e3o \u00e9 suportada pelo Java Runtime." },

             {MsgKey.ER_FEATURE_NOT_FOUND,
             "O par\u00e2metro ''{0}'' n\u00e3o \u00e9 reconhecido."},

             {MsgKey.ER_FEATURE_NOT_SUPPORTED,
             "O par\u00e2metro ''{0}'' \u00e9 reconhecido, mas o valor pedido n\u00e3o pode ser definido. "},

             {MsgKey.ER_STRING_TOO_LONG,
             "A cadeia resultante \u00e9 muito longa para caber em uma DOMString: ''{0}''. "},

             {MsgKey.ER_TYPE_MISMATCH_ERR,
             "O tipo de valor para este nome de par\u00e2metro \u00e9 incompat\u00edvel com o tipo de valor esperado. "},

             {MsgKey.ER_NO_OUTPUT_SPECIFIED,
             "O destino de sa\u00edda para os dados a serem gravados era nulo. "},

             {MsgKey.ER_UNSUPPORTED_ENCODING,
             "Uma codifica\u00e7\u00e3o n\u00e3o suportada foi encontrada. "},

             {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE,
             "O n\u00f3 n\u00e3o p\u00f4de ser serializado."},

             {MsgKey.ER_CDATA_SECTIONS_SPLIT,
             "A Se\u00e7\u00e3o CDATA cont\u00e9m um ou mais marcadores de t\u00e9rmino ']]>'."},

             {MsgKey.ER_WARNING_WF_NOT_CHECKED,
                 "Uma inst\u00e2ncia do verificador Well-Formedness n\u00e3o p\u00f4de ser criada. O par\u00e2metro well-formed foi definido como true, mas a verifica\u00e7\u00e3o well-formedness n\u00e3o pode ser executada."
             },

             {MsgKey.ER_WF_INVALID_CHARACTER,
                 "O n\u00f3 ''{0}'' cont\u00e9m caracteres XML inv\u00e1lidos. "
             },

             { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT,
                 "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado no coment\u00e1rio. "
             },

             { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI,
                 "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado no processo instructiondata."
             },

             { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA,
                 "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado nos conte\u00fados do CDATASection. "
             },

             { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT,
                 "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado no conte\u00fado dos dados de caractere dos n\u00f3s. "
             },

             { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                 "Um caractere inv\u00e1lido foi encontrado no {0} do n\u00f3 denominado ''{1}''."
             },

             { MsgKey.ER_WF_DASH_IN_COMMENT,
                 "A cadeia \"--\" n\u00e3o \u00e9 permitida dentro dos coment\u00e1rios. "
             },

             {MsgKey.ER_WF_LT_IN_ATTVAL,
                 "O valor do atributo \"{1}\" associado a um tipo de elemento \"{0}\" n\u00e3o deve conter o caractere ''<''. "
             },

             {MsgKey.ER_WF_REF_TO_UNPARSED_ENT,
                 "A refer\u00eancia de entidade n\u00e3o analisada \"&{0};\" n\u00e3o \u00e9 permitida. "
             },

             {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT,
                 "A refer\u00eancia de entidade externa \"&{0};\" n\u00e3o \u00e9 permitida em um valor de atributo. "
             },

             {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND,
                 "O prefixo \"{0}\" n\u00e3o pode ser vinculado ao espa\u00e7o de nomes \"{1}\"."
             },

             {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME,
                 "O nome local do elemento \"{0}\" \u00e9 nulo."
             },

             {MsgKey.ER_NULL_LOCAL_ATTR_NAME,
                 "O nome local do atributo \"{0}\" \u00e9 nulo."
             },

             { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF,
                 "O texto de substitui\u00e7\u00e3o do n\u00f3 de entidade \"{0}\" cont\u00e9m um n\u00f3 de elemento \"{1}\" com um prefixo n\u00e3o vinculado \"{2}\"."
             },

             { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF,
                 "O texto de substitui\u00e7\u00e3o do n\u00f3 de entidade \"{0}\" cont\u00e9m um n\u00f3 de atributo \"{1}\" com um prefixo n\u00e3o vinculado \"{2}\"."
             },

        };

        return contents;
    }
1036189
public function getText(string $id): ?string
    {
        $getText = function(string $id, string $locale) {
            if (isset($this->defaultLocales[$locale]) && $this->defaultLocales[$locale] === 0) {
                $app = App::get();
                $context = $app->contexts->get(__FILE__);
                $this->defaultLocales[$locale] = 1;
                $filename = $context->dir . '/locales/' . $locale . '.php';
                if (is_file($filename)) {
                    $data = include $filename;
                    if (is_array($data)) {
                        $this->addDictionary($locale, $data);
                    }
                }
            }
            if (isset($this->dictionaries[$locale])) {
                foreach ($this->dictionaries[$locale] as $i => $dictionary) {
                    if (is_callable($dictionary)) {
                        $dictionary = call_user_func($dictionary);
                        $this->dictionaries[$locale][$i] = $dictionary;
                    }
                    if (is_array($dictionary)) {
                        foreach ($dictionary as $_id => $text) {
                            if ($id === $_id) {
                                return (string) $text;
                            }
                        }
                    }
                }
            }
            return null;
        };
        $text = $getText($id, $this->locale);
        if ($text === null || !isset($text[0])) {
            $text = $getText($id, $this->backupLocale);
        }
        return $text;
    }
1087234
function listToText( $l ) {
		$s = '';
		$m = count( $l ) - 1;
		if ( $m == 1 ) {
			return $l[0] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $l[1];
		} else {
			for ( $i = $m; $i >= 0; $i-- ) {
				if ( $i == $m ) {
					$s = $l[$i];
				} elseif ( $i == $m - 1 ) {
					$s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
				} else {
					$s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
				}
			}
			return $s;
		}
	}
994046
protected function rawText() {
        if (is_null($this->untilTag)) {
            return $this->text();
        }
        $sequence = '</' . $this->untilTag . '>';
        $txt = $this->readUntilSequence($sequence);
        $this->events->text($txt);
        $this->setTextMode(0);
        return $this->endTag();
    }
372894
def get_text
      l = getvalue
      str = ""
      old = " "
      l.each_with_index do |line, i|
        tmp = line.gsub("\n","")
        tmp.gsub!("\r", "\n")
        if old[-1,1] !~ /\s/ and tmp[0,1] !~ /\s/
          str << " "
        end
        str << tmp
        old = tmp
      end
      str
    end
499482
function parseGettext(locale, data, options = {}) {
  const out = {
    charset: 'utf-8',
    headers: {
      'project-id-version': options.project || 'i18next-conv',
      'mime-version': '1.0',
      'content-type': 'text/plain; charset=utf-8',
      'content-transfer-encoding': '8bit',
    },
    translations: {},
  };

  const ext = plurals.getRule(locale);
  const trans = {};

  out.headers['plural-forms'] = `nplurals=${ext.nplurals}; plural=${ext.plurals}`;

  if (!options.noDate) {
    out.headers['pot-creation-date'] = new Date().toISOString();
    out.headers['po-revision-date'] = new Date().toISOString();
    if (options.potCreationDate && typeof options.potCreationDate.toISOString === 'function') out.headers['pot-creation-date'] = options.potCreationDate.toISOString();
    if (options.poRevisionDate && typeof options.poRevisionDate.toISOString === 'function') out.headers['po-revision-date'] = options.poRevisionDate.toISOString();
  }
  if (options.language) {
    out.headers.language = options.language;
  }
  const delkeys = [];

  Object.keys(data).forEach((m) => {
    const kv = data[m];

    if (kv.plurals) {
      const pArray = [];

      for (let i = 0, len = kv.plurals.length; i < len; i += 1) {
        const plural = kv.plurals[i];
        pArray.splice(getGettextPluralPosition(ext, plural.pluralNumber - 1), 0, plural.value);
      }
      pArray.splice(getGettextPluralPosition(ext, kv.pluralNumber - 1), 0, kv.value);

      if (typeof trans[kv.context] !== 'object') trans[kv.context] = {};
      if (options.keyasareference) {
        if (typeof trans[kv.context][kv.value] === 'object') {
          // same context and msgid. this could theorically be merged.
          trans[kv.context][kv.value].comments.reference.push(kv.key);
        } else {
          trans[kv.context][kv.value] = {
            msgctxt: kv.context,
            msgid: pArray[0],
            msgid_plural: pArray.slice(1, pArray.length),
            msgstr: kv.translated_value,
            comments: { reference: [kv.key] },
          };
        }
        if (kv.key !== kv.value) {
          delkeys.push([kv.context, kv.key]);
        }
      } else {
        trans[kv.context][kv.key] = {
          msgctxt: kv.context,
          msgid: kv.key,
          msgid_plural: kv.key,
          msgstr: pArray,
        };
      }
    } else {
      if (typeof trans[kv.context] !== 'object') trans[kv.context] = {};

      if (options.keyasareference) {
        if (typeof trans[kv.context][kv.value] === 'object') {
          // same context and msgid. this could theorically be merged.
          trans[kv.context][kv.value].comments.reference.push(kv.key);
        } else {
          trans[kv.context][kv.value] = {
            msgctxt: kv.context,
            msgid: kv.value,
            msgstr: kv.translated_value,
            comments: {
              reference: [kv.key],
            },
          };
        }
        if (kv.key !== kv.value) {
          delkeys.push([kv.context, kv.key]);
        }
      } else {
        trans[kv.context][kv.key] = { msgctxt: kv.context, msgid: kv.key, msgstr: kv.value };
      }
    }
  });

  delkeys.forEach((a) => {
    const c = a[0];
    const k = a[1];
    delete trans[c][k];
  });

  // re-format reference comments to be able to compile with gettext-parser...
  Object.keys(trans).forEach((ctxt) => {
    Object.keys(trans[ctxt]).forEach((id) => {
      if (trans[ctxt][id].comments && trans[ctxt][id].comments.reference) {
        trans[ctxt][id].comments.reference = trans[ctxt][id].comments.reference.join('\n');
      }
    });
  });

  out.translations = trans;
  return Promise.resolve(out);
}
1269294
public function text($newTextContent = null)
    {
        if (isset($newTextContent)) {
            $this->textContent = $this->nodeValue = $newTextContent;
        }

        return $this->textContent;
    }
947282
public static String getText(){
        Transferable contents = clipboard().getContents(null);
        try{
            if(contents!=null && contents.isDataFlavorSupported(DataFlavor.stringFlavor))
                return (String)contents.getTransferData(DataFlavor.stringFlavor);
            else
                return null;
        }catch(UnsupportedFlavorException ex){
            throw new ImpossibleException(ex);
        }catch(IOException ex){
            throw new RuntimeException(ex);
        }
    }
990743
public function getText()
    {
        $more_info = $this->print_r($this->more_info, '[', ']', '', ',', ' ');

        $text = get_class($this).': '.$this->getMessage().' ('.$more_info.')'.
            ' in '.$this->getMyFile().':'.$this->getMyLine();

        return $text;
    }
873472
public function asText(): string
    {
        if ($this->keyword === self::KEYWORD_STILLBORN) {
            // I18N: An individual’s age at an event. e.g. Died 14 Jan 1900 (stillborn)
            return I18N::translate('(stillborn)');
        }

        if ($this->keyword === self::KEYWORD_INFANT) {
            // I18N: An individual’s age at an event. e.g. Died 14 Jan 1900 (in infancy)
            return I18N::translate('(in infancy)');
        }

        if ($this->keyword === self::KEYWORD_CHILD) {
            // I18N: An individual’s age at an event. e.g. Died 14 Jan 1900 (in childhood)
            return I18N::translate('(in childhood)');
        }

        $age = [];

        // Show a zero age as "0 years", not "0 days"
        if ($this->years > 0 || $this->months === 0 && $this->weeks === 0 && $this->days === 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s year', '%s years', $this->years, I18N::number($this->years));
        }

        if ($this->months > 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s month', '%s months', $this->months, I18N::number($this->months));
        }

        if ($this->weeks > 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s week', '%s weeks', $this->weeks, I18N::number($this->weeks));
        }

        if ($this->days > 0) {
            // I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
            $age[] = I18N::plural('%s day', '%s days', $this->days, I18N::number($this->days));
        }

        // If an age is just a number of years, only show the number
        if ($this->years > 0 && $this->months === 0 && $this->weeks === 0 && $this->days === 0) {
            $age = [I18N::number($this->years)];
        }

        $age_string = implode(I18N::$list_separator, $age);

        if ($this->qualifier === self::SYMBOL_LESS_THAN) {
            // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (aged less than 21 years)
            return I18N::translate('(aged less than %s)', $age_string);
        }

        if ($this->qualifier === self::SYMBOL_MORE_THAN) {
            // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (aged more than 21 years)
            return I18N::translate('(aged more than %s)', $age_string);
        }

        // I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (aged 43 years)
        return I18N::translate('(aged %s)', $age_string);
    }
684291
public synchronized String getText() {
        if(lines.length == 0) {
            return "";
        }
        StringBuilder bob = new StringBuilder(lines[0]);
        for(int i = 1; i < lines.length; i++) {
            bob.append("\n").append(lines[i]);
        }
        return bob.toString();
    }
1250459
public function text(): string
    {
        // convert charset
        if ( ! is_null($this->encode)) {
            if ( ! is_null($this->convertedText)) {
                // we already know the converted value
                return $this->convertedText;
            }
            $text = $this->encode->convert($this->text);

            // remember the conversion
            $this->convertedText = $text;

            return $text;
        } else {
            return $this->text;
        }
    }
351214
function xgettext (input, options, cb) {
  if (typeof options === 'function') {
    cb = options;
    options = {};
  }

  options = options || {};

  if (!input) {
    throw new Error('No input specified');
  }

  if (!options.language && typeof input === 'string') {
    throw new Error('Language is required');
  }

  options['output'] = options['output'] || 'messages.po';
  options.directory = options.directory || ['.'];
  options.keyword = options.keyword || [];
  options['from-code'] = options['from-code'] || 'utf8';
  options['force-po'] = options['force-po'] || false;
  options['join-existing'] = options['join-existing'] || false;

  if (typeof options.keyword === 'string') {
    options.keyword = [options.keyword];
  }

  if (typeof options.directory === 'string') {
    options.directory = [options.directory];
  }

  const parsers = {};
  const getParser = function (name, keywordSpec) {
    name = name.trim().toLowerCase();

    if (!parsers[name]) {
      const Parser = require(`gettext-${name}`);

      if (Object.keys(keywordSpec).length > 0) {
        parsers[name] = new Parser(keywordSpec);
      } else if (Parser.keywordSpec) {
        parsers[name] = new Parser(Parser.keywordSpec);
      } else {
        parsers[name] = new Parser();
      }
    }

    return parsers[name];
  };

  const keywordSpec = createKeywordSpec(options.keyword);
  const translations = Object.create(null);

  const parseTemplate = function (parser, template, linePrefixer) {
    const strings = parser.parse(template);

    for (const key in strings) {
      if (strings.hasOwnProperty(key)) {
        const msgctxt = strings[key].msgctxt || '';
        const context = translations[msgctxt] || (translations[msgctxt] = {});
        const msgid = strings[key].msgid || key;
        context[msgid] = context[msgid] || { msgid: msgid, comments: {} };

        if (msgctxt) {
          context[msgid].msgctxt = strings[key].msgctxt;
        }

        if (strings[key].plural) {
          context[msgid].msgid_plural = context[msgid].msgid_plural || strings[key].plural;
          context[msgid].msgstr = ['', ''];
        }

        if (!options['no-location']) {
          context[msgid].comments.reference = (context[msgid].comments.reference || '')
            .split('\n')
            .concat(strings[key].line.map(linePrefixer))
            .join('\n')
            .trim('\n');
        }
      }
    }
  };

  const output = function () {
    if (cb) {
      if (Object.keys(translations).length > 0 || options['force-po']) {
        let existing = {};
        const writeToStdout = options.output === '-' || options.output === '/dev/stdout';

        if (!writeToStdout && options['join-existing']) {
          try {
            fs.accessSync(options.output, fs.F_OK);
            existing = gt.po.parse(fs.readFileSync(options.output, {
              encoding: options['from-code']
            }));
          } catch (e) {
            // ignore non-existing file
          }

          mergeDeep(translations, existing.translations);
        }

        const po = gt.po.compile({
          charset: options['from-code'],
          headers: {
            'content-type': `text/plain; charset=${options['from-code']}`
          },
          translations: translations
        });

        if (writeToStdout) {
          cb(po);
        } else {
          fs.writeFile(options.output, po, err => {
            if (err) {
              throw err;
            }

            cb(po);
          });
        }
      } else {
        cb();
      }
    }
  };

  if (typeof input === 'string') {
    parseTemplate(
      getParser(options.language, keywordSpec),
      input,
      line => `standard input:${line}`
    );

    output();
  } else {
    const addPath = path => line => `${path}:${line}`;

    if (options['files-from']) {
      input = fs.readFileSync(options['files-from'], options['from-code'])
        .split('\n')
        .filter(line => line.trim().length > 0);
    }

    const files = options.directory.reduce(
      (result, directory) => result.concat(input.map(
        file => path.join(directory, file.replace(/\\/g, path.sep))
      )),
      []
    );

    async.parallel(files.map(function (file) {
      return function (cb) {
        fs.readFile(path.resolve(file), options['from-code'], (err, res) => {
          if (err) {
            throw err;
          }

          const extension = path.extname(file);
          const language = options.language || xgettext.languages[extension];

          if (!language) {
            throw new Error(`No language specified for extension '${extension}'.`);
          }

          parseTemplate(getParser(language, keywordSpec), res, addPath(file.replace(/\\/g, '/')));

          cb();
        });
      };
    }), output);
  }
}
155320
public function getCommandsText($text_part, &$offset = 0)
    {
        $commands = $matches = array();

        while ($offset < strlen($text_part)) {
            $offset += strspn($text_part, "\x00\x09\x0a\x0c\x0d\x20", $offset);
            $char = $text_part[$offset];

            $operator = '';
            $type     = '';
            $command  = false;

            switch ($char) {
                case '/':
                    $type = $char;
                    if (preg_match(
                        '/^\/([A-Z0-9\._,\+]+\s+[0-9.\-]+)\s+([A-Z]+)\s*/si',
                        substr($text_part, $offset),
                        $matches
                    )
                    ) {
                        $operator = $matches[2];
                        $command  = $matches[1];
                        $offset += strlen($matches[0]);
                    } elseif (preg_match(
                        '/^\/([A-Z0-9\._,\+]+)\s+([A-Z]+)\s*/si',
                        substr($text_part, $offset),
                        $matches
                    )
                    ) {
                        $operator = $matches[2];
                        $command  = $matches[1];
                        $offset += strlen($matches[0]);
                    }
                    break;

                case '[':
                case ']':
                    // array object
                    $type = $char;
                    if ($char == '[') {
                        ++$offset;
                        // get elements
                        $command = $this->getCommandsText($text_part, $offset);

                        if (preg_match('/^\s*[A-Z]{1,2}\s*/si', substr($text_part, $offset), $matches)) {
                            $operator = trim($matches[0]);
                            $offset += strlen($matches[0]);
                        }
                    } else {
                        ++$offset;
                        break;
                    }
                    break;

                case '<':
                case '>':
                    // array object
                    $type = $char;
                    ++$offset;
                    if ($char == '<') {
                        $strpos  = strpos($text_part, '>', $offset);
                        $command = substr($text_part, $offset, ($strpos - $offset));
                        $offset  = $strpos + 1;
                    }

                    if (preg_match('/^\s*[A-Z]{1,2}\s*/si', substr($text_part, $offset), $matches)) {
                        $operator = trim($matches[0]);
                        $offset += strlen($matches[0]);
                    }
                    break;

                case '(':
                case ')':
                    ++$offset;
                    $type   = $char;
                    $strpos = $offset;
                    if ($char == '(') {
                        $open_bracket = 1;
                        while ($open_bracket > 0) {
                            if (!isset($text_part[$strpos])) {
                                break;
                            }
                            $ch = $text_part[$strpos];
                            switch ($ch) {
                                case '\\':
                                { // REVERSE SOLIDUS (5Ch) (Backslash)
                                    // skip next character
                                    ++$strpos;
                                    break;
                                }
                                case '(':
                                { // LEFT PARENHESIS (28h)
                                    ++$open_bracket;
                                    break;
                                }
                                case ')':
                                { // RIGHT PARENTHESIS (29h)
                                    --$open_bracket;
                                    break;
                                }
                            }
                            ++$strpos;
                        }
                        $command = substr($text_part, $offset, ($strpos - $offset - 1));
                        $offset  = $strpos;

                        if (preg_match('/^\s*([A-Z\']{1,2})\s*/si', substr($text_part, $offset), $matches)) {
                            $operator = $matches[1];
                            $offset += strlen($matches[0]);
                        }
                    }
                    break;

                default:

                    if (substr($text_part, $offset, 2) == 'ET') {
                        break;
                    } elseif (preg_match(
                        '/^\s*(?P<data>([0-9\.\-]+\s*?)+)\s+(?P<id>[A-Z]{1,3})\s*/si',
                        substr($text_part, $offset),
                        $matches
                    )
                    ) {
                        $operator = trim($matches['id']);
                        $command  = trim($matches['data']);
                        $offset += strlen($matches[0]);
                    } elseif (preg_match('/^\s*([0-9\.\-]+\s*?)+\s*/si', substr($text_part, $offset), $matches)) {
                        $type    = 'n';
                        $command = trim($matches[0]);
                        $offset += strlen($matches[0]);
                    } elseif (preg_match('/^\s*([A-Z\*]+)\s*/si', substr($text_part, $offset), $matches)) {
                        $type     = '';
                        $operator = $matches[1];
                        $command  = '';
                        $offset += strlen($matches[0]);
                    }
            }

            if ($command !== false) {
                $commands[] = array(
                    self::TYPE     => $type,
                    self::OPERATOR => $operator,
                    self::COMMAND  => $command,
                );
            } else {
                break;
            }
        }

        return $commands;
    }
789149
function getText(msg) {
    return msg.parts.filter(function (part) {
      return part.mime_type === 'text/plain';
    }).map(function (part) {
      return part.body;
    }).join('; ');
  }
729877
function text()
	{
		if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
		switch ($this->nodetype)
		{
			case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
			case HDOM_TYPE_COMMENT: return '';
			case HDOM_TYPE_UNKNOWN: return '';
		}
		if (strcasecmp($this->tag, 'script')===0) return '';
		if (strcasecmp($this->tag, 'style')===0) return '';

		$ret = '';
		// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
		// NOTE: This indicates that there is a problem where it's set to NULL without a clear happening.
		// WHY is this happening?
		if (!is_null($this->nodes))
		{
			foreach ($this->nodes as $n)
			{
				$ret .= $this->convert_text($n->text());
			}

			// If this node is a span... add a space at the end of it so multiple spans don't run into each other.  This is plaintext after all.
			if ($this->tag == "span")
			{
				$ret .= $this->dom->default_span_text;
			}


		}
		return $ret;
	}