Translates a string.

@param string $msgid String to be translated

@return string translated string (or original, if not found)
482639
public function gettext($msgid)
    {
        if (array_key_exists($msgid, $this->cache_translations)) {
            return $this->cache_translations[$msgid];
        }

        return $msgid;
    }
424270
function printMsg ( msgId, data ) {
    var outputFn;

    if ( messages.hasOwnProperty( msgId) ) {
      switch ( msgId.match( /^[A-Z]+/ )[0] ) {
        case 'INFO':
          outputFn = grunt.log.writeln;
          break;

        case 'VERBOSE':
          outputFn = grunt.verbose.writeln;
          break;

        case 'DEBUG':
          outputFn = grunt.log.debug;
          break;

        default:
          outputFn = grunt.fail.warn;
      } // switch

      outputFn( grunt.template.process( messages[ msgId ], { data: data } ) );
    }
  }
1294243
public function npgettext($msgctxt, $msgid, $msgidPlural, $number)
    {
        $key = implode(chr(4), [$msgctxt, $msgid]);
        $ret = $this->ngettext($key, $msgidPlural, $number);
        if (strpos($ret, chr(4)) !== false) {
            return $msgid;
        }

        return $ret;
    }
719759
public function messageRead($msgid, $flag_read = TRUE)
  {
    $msg = $this->execute("messageget", array("msgid" => $msgid))->toList();

    if($flag_read)
    {
      $this->execute("messageget", array("msgid" => $msgid, "flag" => $flag_read));
    }

    return $msg;
  }
973926
protected function _translate($string, $context = null)
    {
        if (!(($translator = $this->_getTranslator()) instanceof StringTranslatorInterface)) {
            return $string;
        }

        return $translator->translate($string, $context);
    }
51405
protected function removeFuzzyFlagForMsgId($msgid)
    {
        if (!isset($this->entriesAsArrays[$msgid])) {
            throw new \Exception('Entry does not exist');
        }
        if ($this->entriesAsArrays[$msgid]['fuzzy']) {
            $flags = $this->entriesAsArrays[$msgid]['flags'];
            unset($flags[array_search('fuzzy', $flags, true)]);
            $this->entriesAsArrays[$msgid]['flags'] = $flags;
            $this->entriesAsArrays[$msgid]['fuzzy'] = false;
        }
    }
377762
public static function composite_guid($guids)
    {
        if (!is_array($guids) || empty($guids)) {
            return '';
        }
        if (is_string($guids[0]) && strlen($guids[0]) == 16) {
            return implode('', $guids);
        }
        $validGuids = static::unsetInvalidGUIDs($guids);
        $composited = '';
        foreach ($validGuids as $guid) {
            $composited .= static::guid_bin($guid);
        }
        return $composited;
    }
312743
public function translateChar($dec)
    {
        if (isset($this->mapping[$dec])) {
            $dec = $this->mapping[$dec];
        }

        return $dec;
    }
276557
public static function translate($string, Translation $translation = null) {
		if ($translation !== null) {
			$translation = self::get($translation->language, $translation->application_name);
		} else {
			$translation = self::get(\Application::get()->language, \Application::get()->name);
		}

		return $translation->translate_string($string);
	}
120186
function ungettext(msgid1, msgid2, n) {
        if (_i18n_locale.locale_name == 'en_DEBUG') return __debug_trans_str(msgid1);
        var id = ''+_i18n_plural(n)+'-'+msgid1;
        var entry = _i18n_catalog[id];
        return entry == undefined ? (n==1 ? msgid1 : msgid2)  : entry;
    }
465278
private function msg($msg): string
    {
        // 将数组转为字符串
        if (is_array($msg) or is_object($msg) or is_bool($msg)) {
            return json($msg);
        }

        // 返回可显示的字符串
        return (string)$msg;
    }
27002
protected function createMsgId()
    {
        $msg = hex2bin($this->messageId);
        $chars = str_split($msg);
        $chars_val = array_map('ord', $chars);
        $pos = count($chars_val) - 1;
        while (true) {
            if ($chars_val[$pos] < 255) {
                $chars_val[$pos]++;
                break;
            } else {
                $chars_val[$pos] = 0;
                $pos--;
            }
        }
        $chars = array_map('chr', $chars_val);
        $msg = bin2hex(implode($chars));
        $this->messageId = $msg;

        return $this->messageId;
    }
695129
protected function customizeTranslation()
	{
		$message 		= \Sifo\FilterPost::getInstance()->getString( 'msgid' );
		$id_message 	= null;
		if ( is_numeric( $message ) )
		{
			$id_message = $message;
		}
		$instance			= $this->getParsedParam( 'instance' );
		$translator_model 	= new I18nTranslatorModel();

		$id_message = $translator_model->getTranslation( $message, $id_message );

		$result = array( 'status' => 'KO', 'msg' => 'This Message or ID doesn\'t exist.' );
		if ( $id_message )
		{
			$result = array( 'status' => 'OK', 'msg' => 'Message successfully customized.' );
			if( !$translator_model->customizeTranslation( $id_message, $instance ) )
			{
				$result = array( 'status' => 'KO', 'msg' => 'This message is already customized in this instance.' );
			}
		}

		return $result;
	}
1054679
public function uniqueid($msgno = null)
    {
        if ($msgno !== null) {
            $result = $this->request("UIDL $msgno");

            list(, $result) = explode(' ', $result);
            return $result;
        }

        $result = $this->request('UIDL', true);

        $result = explode("\n", $result);
        $messages = array();
        foreach ($result as $line) {
            if (!$line) {
                continue;
            }
            list($no, $id) = explode(' ', trim($line), 2);
            $messages[(int)$no] = $id;
        }

        return $messages;

    }
888523
protected function _getUidByMessageId($mailbox, $msgid)
    {
        if (!$msgid) {
            return null;
        }

        $query = new Horde_Imap_Client_Search_Query();
        $query->headerText('Message-ID', $msgid);
        $res = $this->search($mailbox, $query, array(
            'results' => array(Horde_Imap_Client::SEARCH_RESULTS_MAX)
        ));

        return $res['max'];
    }
1121587
public function translate($string)
    {
        $translated = gettext($string);
        if ($translated == $string)
        {
            $this->logUntranslatedString($string);
        }
        return $translated;
    }
477699
def convert_msg(self, msg):
        
        source = msg.msgid
        if not source:
            # don't translate empty string
            return

        plural = msg.msgid_plural
        if plural:
            # translate singular and plural
            foreign_single = self.convert(source)
            foreign_plural = self.convert(plural)
            plural = {
                '0': self.final_newline(source, foreign_single),
                '1': self.final_newline(plural, foreign_plural),
            }
            msg.msgstr_plural = plural
        else:
            foreign = self.convert(source)
            msg.msgstr = self.final_newline(source, foreign)