本文整理汇总了PHP中ngettext函数的典型用法代码示例。如果您正苦于以下问题:PHP ngettext函数的具体用法?PHP ngettext怎么用?PHP ngettext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ngettext函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getMainInfo
public function getMainInfo()
{
$user = User::getInstance(Stb::getInstance()->id);
$oss_info = $user->getInfoFromOSS();
$info = array('fname' => $user->getProfileParam('fname'), 'phone' => $user->getProfileParam('phone'), 'ls' => $user->getProfileParam('ls'), 'mac' => $user->getProfileParam('mac'));
if (is_array($oss_info)) {
$info = array_merge($info, $oss_info);
}
$info['last_change_status'] = $user->getProfileParam('last_change_status');
if (Config::getSafe('enable_internal_billing', false) && !array_key_exists('end_date', $info)) {
$expire_billing_date = $user->getProfileParam('expire_billing_date');
if (strtotime($expire_billing_date) > 0) {
$info['end_date'] = $expire_billing_date;
}
}
if (!array_key_exists('account_balance', $info) && $user->getProfileParam('account_balance') != '') {
$info['account_balance'] = $user->getProfileParam('account_balance');
}
if (array_key_exists('end_date', $info)) {
$end_time = strtotime($info['end_date']);
if ($end_time) {
$days = ceil(($end_time - time()) / (24 * 3600));
/// in format of php date() function
$info['end_date'] = date(_('end_date_format'), strtotime($info['end_date'])) . ' (' . sprintf(ngettext('%d day', '%d days', $days), $days) . ')';
}
}
if (Config::get('enable_tariff_plans')) {
$info['tariff_plan'] = $user->getTariffPlanName();
}
return $info;
}
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:31,代码来源:accountinfo.class.php
示例2: getPluralText
public static function getPluralText($singular, $plural, $number)
{
if (self::_getTextMode() == self::GETTEXT_MODE_NATIVE) {
return ngettext($singular, $plural, $number);
}
return _ngettext($singular, $plural, $number);
}
开发者ID:erichub,项目名称:Presence-V-0.1,代码行数:7,代码来源:Lang.class.php
示例3: ShowResultsEditSurvey
/**
* GForge Survey Facility
*
* Portions Copyright 1999-2001 (c) VA Linux Systems
* The rest Copyright 2002-2004 (c) GForge Team
* http://gforge.org/
*
* @version $Id$
*
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
function ShowResultsEditSurvey($result)
{
global $group_id;
$rows = db_NumRows($result);
$cols = db_NumFields($result);
echo "<h3>" . sprintf(ngettext('%1$s survey found', '%1$s surveys found', $rows), $rows) . "</h3>";
if ($rows > 0) {
echo "<table border=\"0\">\n";
/* Create the headers */
echo "<tr class=\"tableheading\">\n";
for ($i = 0; $i < $cols; $i++) {
echo "<th>" . db_fieldname($result, $i) . "</th>\n";
}
echo "</tr>";
for ($j = 0; $j < $rows; $j++) {
echo "<tr class=\".{$HTML->boxGetAltRowStyle}({$j})\">\n";
echo "<td><a href=\"edit_survey.php?group_id={$group_id}&survey_id=" . db_result($result, $j, 0) . "\">" . db_result($result, $j, 0) . "</a></td>";
for ($i = 1; $i < $cols; $i++) {
echo "<td>" . db_result($result, $j, $i) . "</td>\n";
}
echo "</tr>";
}
echo "</table>";
}
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:50,代码来源:survey_utils.php
示例4: execute
/**
* Purge completed tasks that were completed before the configured date.
*
* @return boolean Whether any messages were purged from the mailbox.
*/
public function execute()
{
global $injector, $prefs;
/* Get the current UNIX timestamp minus the number of days specified
* in 'purge_completed_keep'. If a task has a timestamp prior to
* this value, it will be deleted. */
$del_time = new Horde_Date($_SERVER['REQUEST_TIME'] - $prefs->getValue('purge_completed_keep') * 86400);
$del_time = $del_time->timestamp();
$tasklists = Nag::listTasklists(true, Horde_Perms::DELETE, false);
$tasks = Nag::listTasks(array('completed' => Nag::VIEW_COMPLETE, 'tasklists' => array_keys($tasklists)));
$factory = $GLOBALS['injector']->getInstance('Nag_Factory_Driver');
$count = 0;
$tasks->reset();
while ($task = $tasks->each()) {
if ($task->completed_date && $task->completed_date < $del_time || !$task->completed_date && $task->modified && $task->modified->timestamp() < $del_time) {
try {
$factory->create($task->tasklist)->delete($task->id);
++$count;
} catch (Nag_Exception $e) {
Horde::log($e->getMessage(), 'ERR');
}
}
}
$GLOBALS['notification']->push(sprintf(ngettext("Purging %d completed task.", "Purging %d completed tasks.", $count), $count), 'horde.message');
return true;
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:31,代码来源:PurgeCompleted.php
示例5: datas
public function datas($msgId1 = '', $msgId2 = '', $count = 0)
{
if (!is_string($msgId1) || !is_string($msgId2)) {
return Error::set(lang('Error', 'stringParameter', '1.(msgId1) & 2.(msgId2)'));
}
return ngettext($msgId1, $msgId2, $count);
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:7,代码来源:GT.php
示例6: initItem
public function initItem()
{
parent::initItem();
if (is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') {
if (WidgetHelper::hasWidget($GLOBALS['user']->id, 'News')) {
$news = StudipNews::CountUnread();
}
if (Config::get()->VOTE_ENABLE && WidgetHelper::hasWidget($GLOBALS['user']->id, 'Evaluations')) {
$threshold = Config::get()->NEW_INDICATOR_THRESHOLD ? strtotime("-{" . Config::get()->NEW_INDICATOR_THRESHOLD . "} days 0:00:00") : 0;
$statement = DBManager::get()->prepare("\n SELECT COUNT(*)\n FROM questionnaire_assignments\n INNER JOIN questionnaires ON (questionnaires.questionnaire_id = questionnaire_assignments.questionnaire_id)\n WHERE questionnaire_assignments.range_id = 'start'\n AND questionnaires.visible = 1\n AND questionnaires.startdate IS NOT NULL\n AND questionnaires.startdate > UNIX_TIMESTAMP()\n AND questionnaires.startdate > :threshold\n AND (questionnaires.stopdate IS NULL OR questionnaires.stopdate <= UNIX_TIMESTAMP())\n ");
$statement->execute(array('threshold' => $threshold));
$vote = (int) $statement->fetchColumn();
$query = "SELECT COUNT(IF(chdate > IFNULL(b.visitdate, :threshold) AND d.author_id != :user_id, a.eval_id, NULL))\n FROM eval_range a\n INNER JOIN eval d ON (a.eval_id = d.eval_id AND d.startdate < UNIX_TIMESTAMP() AND\n (d.stopdate > UNIX_TIMESTAMP() OR d.startdate + d.timespan > UNIX_TIMESTAMP() OR (d.stopdate IS NULL AND d.timespan IS NULL)))\n LEFT JOIN object_user_visits b ON (b.object_id = d.eval_id AND b.user_id = :user_id AND b.type = 'eval')\n WHERE a.range_id = 'studip'\n GROUP BY a.range_id";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':user_id', $GLOBALS['user']->id);
$statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
$statement->execute();
$vote += (int) $statement->fetchColumn();
}
}
$homeinfo = _('Zur Startseite');
if ($news) {
$homeinfo .= ' - ';
$homeinfo .= sprintf(ngettext('%u neue Ankündigung', '%u neue Ankündigungen', $news), $news);
}
if ($vote) {
$homeinfo .= ' - ';
$homeinfo .= sprintf(ngettext('%u neuer Fragebogen', '%u neue Fragebögen', $vote), $vote);
}
$this->setBadgeNumber($vote + $news);
$this->setImage(Icon::create('home', 'navigation', ["title" => $homeinfo]));
}
开发者ID:ratbird,项目名称:hope,代码行数:32,代码来源:StartNavigation.php
示例7: initItem
public function initItem()
{
global $user, $neux;
parent::initItem();
$my_messaging_settings = UserConfig::get($user->id)->MESSAGING_SETTINGS;
$lastVisitedTimestamp = isset($my_messaging_settings['last_box_visit']) ? (int) $my_messaging_settings['last_box_visit'] : 0;
$query = "SELECT SUM(mkdate > :time AND readed = 0) AS num_new,\n SUM(readed = 0) AS num_unread,\n SUM(readed = 1) AS num_read\n FROM message_user\n WHERE snd_rec = 'rec' AND user_id = :user_id AND deleted = 0";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':time', $lastVisitedTimestamp);
$statement->bindValue(':user_id', $GLOBALS['user']->id);
$statement->execute();
list($neux, $neum, $altm) = $statement->fetch(PDO::FETCH_NUM);
$this->setBadgeNumber($neum);
if ($neux > 0) {
$tip = sprintf(ngettext('Sie haben %d neue ungelesene Nachricht', 'Sie haben %d neue ungelesene Nachrichten', $neux), $neux);
} else {
if ($neum > 1) {
$tip = sprintf(ngettext('Sie haben %d ungelesene Nachricht', 'Sie haben %d ungelesene Nachrichten', $neum), $neum);
} else {
if ($altm > 1) {
$tip = sprintf(ngettext('Sie haben %d alte empfangene Nachricht', 'Sie haben %d alte empfangene Nachrichten', $altm), $altm);
} else {
$tip = _('Sie haben keine alten empfangenen Nachrichten');
}
}
}
$this->setImage(Icon::create('mail', 'navigation', ["title" => $tip]));
}
开发者ID:ratbird,项目名称:hope,代码行数:28,代码来源:MessagingNavigation.php
示例8: humanReadable
/**
* Convert a time in seconds to human readable string
*
* @param int $diff The time in seconds
* @param int $precisionType The precision type for the string
* @param int $precision The precision
* The number of element if type is by format
* The number of character if type is by characters
* @return string
*/
public static function humanReadable($diff, $precisionType = 1, $precision = 1)
{
/* List of format in Date interval */
$listFormat = array('y' => array('year', 'years'), 'm' => array('month', 'months'), 'd' => array('day', 'days'), 'h' => array('hour', 'hours'), 'i' => array('min', 'min'), 's' => array('sec', 'sec'));
$dateInterval = new DateInterval($diff);
$formatedStr = '';
$newFormatedStr = '';
$count = 0;
/* Prepare string */
foreach ($listFormat as $format => $words) {
if ($dateInterval->{$format} > 0) {
if (strlen($newFormatedStr) > 0) {
$newFormatedStr .= ' ';
}
$newFormatedStr .= $dateInterval->{$format} . ' ' . ngettext($words[0], $words[1], $dateInterval->{$format});
$count++;
}
/* Test for precision type format */
if ($precisionType == self::PRECISION_FORMAT && $count >= $precision) {
return $newFormatedStr;
}
/* Test for precision type character */
if ($precisionType == self::PRECISION_CHAR && strlen($newFormatedStr) >= $precision) {
if ($formatedStr === '') {
return $newFormatedStr;
}
return $formatedStr;
}
$formatedStr = $newFormatedStr;
}
return $formatedStr;
}
开发者ID:NicolasLarrouy,项目名称:centreon,代码行数:42,代码来源:Datetime.php
示例9: isValid
/**
*/
public function isValid(&$var, &$vars, $value, &$message)
{
$value = trim($value);
if (empty($value)) {
if ($var->isRequired()) {
$message = _("This field is required.");
return false;
}
return true;
}
$invalid = array();
$rfc822 = $GLOBALS['injector']->getInstance('Horde_Mail_Rfc822');
foreach (explode("\n", $value) as $address) {
try {
$rfc822->parseAddressList($address, array('validate' => true));
} catch (Horde_Mail_Exception $e) {
$invalid[] = $address;
}
}
if (count($invalid)) {
$message = sprintf(ngettext(_("\"%s\" is not a valid email address."), _("\"%s\" are not valid email addresses."), count($invalid)), implode(', ', $invalid));
return false;
}
return true;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:27,代码来源:Longemail.php
示例10: _renderInfo
/**
* Return the rendered information about the Horde_Mime_Part object.
*
* @return array See parent::render().
*/
protected function _renderInfo()
{
global $registry;
if ($registry->getView() == $registry::VIEW_MINIMAL) {
return array();
}
$status = array();
$mime_id = $this->_mimepart->getMimeId();
$headers = Horde_Mime_Headers::parseHeaders($this->getConfigParam('imp_contents')->getBodyPart($mime_id, array('length' => 0, 'mimeheaders' => true, 'stream' => true))->data);
if (($duration = $headers->getValue('content-duration')) !== null) {
$text = array();
if ($minutes = floor($duration / 60)) {
$text[] = sprintf(ngettext(_("%d minute"), _("%d minutes"), $minutes), $minutes);
}
if ($seconds = $duration % 60) {
$text[] = sprintf(ngettext(_("%d second"), _("%d seconds"), $seconds), $seconds);
}
$status[] = sprintf(_("This video file is reported to be %s in length."), implode(' ', $text));
}
if ($this->_thumbnailBinary()) {
$status[] = _("This is a thumbnail of a video attachment.");
$status[] = $this->getConfigParam('imp_contents')->linkViewJS($this->_mimepart, 'view_attach', '<img src="' . $this->getConfigParam('imp_contents')->urlView($this->_mimepart, 'view_attach', array('params' => array('imp_video_view' => 'view_thumbnail'))) . '" />', null, null, null);
}
if (empty($status)) {
return array();
}
$s = new IMP_Mime_Status($status);
$s->icon('mime/video.png');
return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $s, 'type' => 'text/html; charset=UTF-8'));
}
开发者ID:jubinpatel,项目名称:horde,代码行数:35,代码来源:Video.php
示例11: GetPath
function GetPath($path)
{
$fullPath = system\Helper::arcGetPath(true) . "assets/" . $path . "/";
$webPath = system\Helper::arcGetPath() . "assets" . $path;
$files = scandir($fullPath);
$html = "";
foreach ($files as $file) {
if ($file != "." && $file != "..") {
$html .= "<tr>" . "<td style=\"width: 10px;\"><input type=\"checkbox\" id=\"{$file}\" onchange=\"mark('{$path}/{$file}')\"><label for=\"{$file}\"></label></td>";
if (is_dir($fullPath . $file)) {
// folder
$fi = new FilesystemIterator($fullPath . $file, FilesystemIterator::SKIP_DOTS);
$html .= "<td><i class=\"fa fa-folder-o\"></i> <a class=\"clickable\" onclick=\"getFolderPath('{$path}/{$file}')\">{$file}</a></td>" . "<td style=\"width: 10px;\">folder</td>" . "<td style=\"width: 10px;\">-</td>" . "<td style=\"width: 100px;\">" . iterator_count($fi) . ngettext(" item", " items", iterator_count($fi)) . "</td>" . "<td style=\"width: 100px;\">" . date("d M Y", filectime($fullPath . $file)) . "</td>";
} else {
// get file type
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$filetype = finfo_file($finfo, $fullPath . $file);
finfo_close($finfo);
// file
$html .= "<td><i class=\"" . GetFileTypeIcon($filetype) . "\"></i> <a class=\"clickable\" onclick=\"viewFile('{$webPath}/{$file}', '{$filetype}', '" . FileSizeConvert(filesize($fullPath . $file)) . "', '" . date("d M Y", filectime($fullPath . $file)) . "')\">{$file}<a/></td>" . "<td style=\"width: 10px;\">{$filetype}</td>" . "<td style=\"width: 10px;\"><a alt=\"Copy link to clipboard\" class=\"clickable\" onclick=\"copyToClipboard('{$webPath}/{$file}')\"><i class=\"fa fa-link\"></i></a></td>" . "<td style=\"width: 100px;\">" . FileSizeConvert(filesize($fullPath . $file)) . "</td>" . "<td style=\"width: 100px;\">" . date("d M Y", filectime($fullPath . $file)) . "</td>";
}
$html .= "</tr>";
}
}
// no files
if (count($files) == 2) {
$html .= "<tr><td colspan=\"4\" class=\"text-center\">Folder is empty.</td></tr>";
}
return $html;
}
开发者ID:DeltaWolf7,项目名称:Arc,代码行数:30,代码来源:mediamanagerget.php
示例12: printMarksCount
function printMarksCount($num)
{
if ($num > 0) {
return sprintf(ngettext('%s mark', '%s marks', $num), $num);
} else {
return _('No marks');
}
}
开发者ID:iweave,项目名称:unmark,代码行数:8,代码来源:view_helper.php
示例13: describe
/**
* Return information for the login task.
*
* @return string Description of what the operation is going to do during
* this login.
*/
public function describe()
{
$mbox_list = array();
foreach ($this->_getMboxes() as $val) {
$mbox_list[] = $val->display_html;
}
return sprintf(ngettext("All messages in the mailbox \"%s\" older than %s days will be permanently deleted.", "All messages in the mailboxes \"%s\" older than %s days will be permanently deleted.", count($mbox_list)), implode(', ', $mbox_list), $GLOBALS['prefs']->getValue('purge_sentmail_keep'));
}
开发者ID:horde,项目名称:horde,代码行数:14,代码来源:PurgeSentmail.php
示例14: blacklistMessage
/**
* Adds the From address from the message(s) to the blacklist and deletes
* the message(s).
*
* @param IMP_Indices $indices An indices object.
* @param boolean $show_link Show link to the blacklist management in
* the notification message?
*
* @return boolean True if the messages(s) were deleted.
* @throws Horde_Exception
*/
public function blacklistMessage($indices, $show_link = true)
{
if (!$this->_processBWlist($indices, _("your blacklist"), 'blacklistFrom', 'showBlacklist', $show_link) || !($msg_count = $GLOBALS['injector']->getInstance('IMP_Message')->delete($indices))) {
return false;
}
$GLOBALS['notification']->push(ngettext("The message has been deleted.", "The messages have been deleted.", $msg_count), 'horde.message');
return true;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:19,代码来源:Filter.php
示例15: nt
/**
* Plural version of t()
*
* @param string $string1
* @param string $string2
* @param int $n
* @param string $textDomain Textdomain to use
* @return string
*/
public function nt($string1, $string2, $n, $textDomain = null)
{
if (empty($textDomain)) {
return ngettext($string1, $string2, $n);
} else {
return dngettext($textDomain, $string1, $string2, $n);
}
}
开发者ID:jinshana,项目名称:tangocms,代码行数:17,代码来源:Native.php
示例16: make_feed_browser
function make_feed_browser($search, $limit, $mode = 1)
{
$owner_uid = $_SESSION["uid"];
$rv = '';
if ($search) {
$search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%{$search}%') OR\n\t\t\t\t\t\tUPPER(title) LIKE UPPER('%{$search}%'))";
} else {
$search_qpart = "";
}
if ($mode == 1) {
/* $result = db_query("SELECT feed_url, subscribers FROM
ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
AND owner_uid = '$owner_uid') $search_qpart
ORDER BY subscribers DESC LIMIT $limit"); */
$result = db_query("SELECT feed_url, site_url, title, SUM(subscribers) AS subscribers FROM\n\t\t\t\t\t\t(SELECT feed_url, site_url, title, subscribers FROM ttrss_feedbrowser_cache UNION ALL\n\t\t\t\t\t\t\tSELECT feed_url, site_url, title, subscribers FROM ttrss_linked_feeds) AS qqq\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t(SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf\n\t\t\t\t\t\t\t\tWHERE tf.feed_url = qqq.feed_url\n\t\t\t\t\t\t\t\t\tAND owner_uid = '{$owner_uid}') {$search_qpart}\n\t\t\t\t\t\tGROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT {$limit}");
} else {
if ($mode == 2) {
$result = db_query("SELECT *,\n\t\t\t\t\t\t(SELECT COUNT(*) FROM ttrss_user_entries WHERE\n\t\t\t\t\t \t\torig_feed_id = ttrss_archived_feeds.id) AS articles_archived\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tttrss_archived_feeds\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t(SELECT COUNT(*) FROM ttrss_feeds\n\t\t\t\t\t\t\tWHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND\n\t\t\t\t\t\t\t\towner_uid = '{$owner_uid}') = 0\tAND\n\t\t\t\t\t\towner_uid = '{$owner_uid}' {$search_qpart}\n\t\t\t\t\t\tORDER BY id DESC LIMIT {$limit}");
}
}
$feedctr = 0;
while ($line = db_fetch_assoc($result)) {
if ($mode == 1) {
$feed_url = htmlspecialchars($line["feed_url"]);
$site_url = htmlspecialchars($line["site_url"]);
$subscribers = $line["subscribers"];
$check_box = "<input onclick='toggleSelectListRow2(this)'\n\t\t\t\t\t\t\tdojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\" \">";
$class = $feedctr % 2 ? "even" : "odd";
$site_url = "<a target=\"_blank\"\n\t\t\t\t\t\t\thref=\"{$site_url}\">\n\t\t\t\t\t\t\t<span class=\"fb_feedTitle\">" . htmlspecialchars($line["title"]) . "</span></a>";
$feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"\n\t\t\t\t\t\t\thref=\"{$feed_url}\"><img src='images/pub_set.svg'\n\t\t\t\t\t\t\tstyle='vertical-align : middle'></a>";
$rv .= "<li>{$check_box} {$feed_url} {$site_url}" . " <span class='subscribers'>({$subscribers})</span></li>";
} else {
if ($mode == 2) {
$feed_url = htmlspecialchars($line["feed_url"]);
$site_url = htmlspecialchars($line["site_url"]);
$title = htmlspecialchars($line["title"]);
$check_box = "<input onclick='toggleSelectListRow2(this)' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\">";
$class = $feedctr % 2 ? "even" : "odd";
if ($line['articles_archived'] > 0) {
$archived = sprintf(ngettext("%d archived article", "%d archived articles", $line['articles_archived']), $line['articles_archived']);
$archived = " <span class='subscribers'>({$archived})</span>";
} else {
$archived = '';
}
$site_url = "<a target=\"_blank\"\n\t\t\t\t\t\t\thref=\"{$site_url}\">\n\t\t\t\t\t\t\t<span class=\"fb_feedTitle\">" . htmlspecialchars($line["title"]) . "</span></a>";
$feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"\n\t\t\t\t\t\t\thref=\"{$feed_url}\"><img src='images/pub_set.svg'\n\t\t\t\t\t\t\tstyle='vertical-align : middle'></a>";
$rv .= "<li id=\"FBROW-" . $line["id"] . "\">" . "{$check_box} {$feed_url} {$site_url} {$archived}</li>";
}
}
++$feedctr;
}
if ($feedctr == 0) {
$rv .= "<li style=\"text-align : center\"><p>" . __('No feeds found.') . "</p></li>";
}
return $rv;
}
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:57,代码来源:feedbrowser.php
示例17: seconds_to_string
function seconds_to_string($secs, $short_tags = true)
{
$units = array("weeks" => 7 * 24 * 3600, "days" => 24 * 3600, "hours" => 3600, "minutes" => 60, "seconds" => 1);
foreach ($units as &$unit) {
$quot = intval($secs / $unit);
$secs -= $quot * $unit;
$unit = $quot;
}
$string = '';
//$filled_units=array();
foreach ($units as $key => $value) {
if ($value) {
//$filled_units[$key]=$value;
switch ($key) {
case 'weeks':
if ($short_tags) {
$string .= sprintf("%dw", $value);
} else {
$string .= sprintf(ngettext("%d week", "%d weeks", $value), $value);
}
break 2;
case 'days':
if ($short_tags) {
$string .= sprintf("%dd", $value);
} else {
$string .= ' ' . sprintf(ngettext("%d day", "%d days", $value), $value);
}
break 2;
case 'hours':
if ($short_tags) {
$string .= sprintf("%hw", $value);
} else {
$string .= ' ' . sprintf(ngettext("%d hour", "%d hours", $value), $value);
}
break 2;
case 'minutes':
if ($short_tags) {
$string .= sprintf("%dm", $value);
} else {
$string .= ' ' . sprintf(ngettext("%d minute", "%d minutes", $value), $value);
}
break 2;
case 'seconds':
if ($short_tags) {
$string .= sprintf("%ds", $value);
} else {
$string .= ' ' . sprintf(ngettext("%d second", "%d seconds", $value), $value);
}
break;
}
}
}
$string = trim($string);
return $string;
}
开发者ID:inikoo,项目名称:fact,代码行数:55,代码来源:common_natural_language.php
示例18: import
/**
* Import a MBOX file into a mailbox.
*
* @param string $mbox The mailbox name to import into (UTF-8).
* @param string $form_name The form field name that contains the MBOX
* data.
*
* @return string Notification message.
* @throws Horde_Exception
*/
public function import($mbox, $form_name)
{
$GLOBALS['browser']->wasFileUploaded($form_name, _("mailbox file"));
$this->_mbox = $mbox;
$res = $this->_import($_FILES[$form_name]['tmp_name'], $_FILES[$form_name]['type']);
$mbox_name = basename(Horde_Util::dispelMagicQuotes($_FILES[$form_name]['name']));
if ($res === false) {
throw new IMP_Exception(sprintf(_("There was an error importing %s."), $mbox_name));
}
return sprintf(ngettext('Imported %d message from %s.', 'Imported %d messages from %s', $res), $res, $mbox_name);
}
开发者ID:jubinpatel,项目名称:horde,代码行数:21,代码来源:Import.php
示例19: nget
/**
* Obtiene una traduccion al plural, cuando se pasan argumentos adicionales se remplaza con sprintf
*
* @param string $sentence1 mensaje en singular
* @param string $sentence2 mensaje en plural
* @param int $n conteo
* @return string
* */
public static function nget($sentence1, $sentence2, $n)
{
/**
* Obtengo la traduccion
* */
$sentence = ngettext($sentence1, $sentence2, $n);
/**
* Si se pasan multiples parametros
* */
if (func_num_args() > 3) {
$sentence = $sentence = self::sprintf($sentence, func_get_args(), 3);
}
return $sentence;
}
开发者ID:Jamp,项目名称:sgas,代码行数:22,代码来源:i18n.php
示例20: trans
/**
* Get the translation for a given key.
*
* @param string | array $key
* @return string
*/
public function trans($key, $number = null)
{
$this->locale();
if ($number !== null) {
if (!is_array($key)) {
$key = array($key, $key);
}
return sprintf(ngettext($key[0], $key[1], $number), $number);
}
if (is_array($key)) {
return gettext(reset($key));
}
return gettext($key);
}
开发者ID:ideil,项目名称:gettext-laravel-translation,代码行数:20,代码来源:Translator.php
注:本文中的ngettext函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论