当前位置: 首页>>代码示例>>PHP>>正文


PHP I18N::translateContext方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\I18N::translateContext方法的典型用法代码示例。如果您正苦于以下问题:PHP I18N::translateContext方法的具体用法?PHP I18N::translateContext怎么用?PHP I18N::translateContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\I18N的用法示例。


在下文中一共展示了I18N::translateContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSortName

 /**
  * The sortname is used in the pdf index
  *
  * @param type $person
  * @return type
  */
 private function getSortName($person)
 {
     $sortname = $person->getSortName();
     $text1 = I18N::translateContext('Unknown given name', '…');
     $text2 = I18N::translateContext('Unknown surname', '…');
     $search = array(',', '@P.N.', '@N.N.');
     $replace = array(', ', $text1, $text2);
     return str_replace($search, $replace, $sortname);
 }
开发者ID:JustCarmen,项目名称:fancy_treeview_pdf,代码行数:15,代码来源:FancyTreeviewPdfClass.php

示例2: getValue

 /**
  * Translate a code, for an optional record
  *
  * @param string            $type
  * @param GedcomRecord|null $record
  *
  * @return string
  */
 public static function getValue($type, GedcomRecord $record = null)
 {
     if ($record instanceof Individual) {
         $sex = $record->getSex();
     } else {
         $sex = 'U';
     }
     switch ($type) {
         case 'birth':
             switch ($sex) {
                 case 'M':
                     return I18N::translateContext('Male pedigree', 'Birth');
                 case 'F':
                     return I18N::translateContext('Female pedigree', 'Birth');
                 default:
                     return I18N::translateContext('Pedigree', 'Birth');
             }
         case 'adopted':
             switch ($sex) {
                 case 'M':
                     return I18N::translateContext('Male pedigree', 'Adopted');
                 case 'F':
                     return I18N::translateContext('Female pedigree', 'Adopted');
                 default:
                     return I18N::translateContext('Pedigree', 'Adopted');
             }
         case 'foster':
             switch ($sex) {
                 case 'M':
                     return I18N::translateContext('Male pedigree', 'Foster');
                 case 'F':
                     return I18N::translateContext('Female pedigree', 'Foster');
                 default:
                     return I18N::translateContext('Pedigree', 'Foster');
             }
         case 'sealing':
             switch ($sex) {
                 case 'M':
                     return I18N::translateContext('Male pedigree', 'Sealing');
                 case 'F':
                     return I18N::translateContext('Female pedigree', 'Sealing');
                 default:
                     return I18N::translateContext('Pedigree', 'Sealing');
             }
         case 'rada':
             // Not standard GEDCOM - a webtrees extension
             // This is an arabic word which does not exist in other languages.
             // So, it will not have any inflected forms.
             return I18N::translate('Rada');
         default:
             return $type;
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:61,代码来源:GedcomCodePedi.php

示例3: varStartHandler

 /**
  * Process <var var="">
  *
  * @param string[] $attrs
  */
 protected function varStartHandler($attrs)
 {
     if (preg_match('/^I18N::number\\((.+)\\)$/', $attrs['var'], $match)) {
         $this->text .= I18N::number($match[1]);
     } elseif (preg_match('/^I18N::translate\\(\'(.+)\'\\)$/', $attrs['var'], $match)) {
         $this->text .= I18N::translate($match[1]);
     } elseif (preg_match('/^I18N::translateContext\\(\'(.+)\', *\'(.+)\'\\)$/', $attrs['var'], $match)) {
         $this->text .= I18N::translateContext($match[1], $match[2]);
     } else {
         $this->text .= $attrs['var'];
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:17,代码来源:ReportParserSetup.php

示例4: getValue

 /**
  * Translate a code, for an (optional) record
  *
  * @param string               $type
  * @param GedcomRecord|null $record
  *
  * @return string
  */
 public static function getValue($type, GedcomRecord $record = null)
 {
     if ($record instanceof Individual) {
         $sex = $record->getSex();
     } else {
         $sex = 'U';
     }
     switch ($type) {
         case 'BOTH':
             switch ($sex) {
                 case 'M':
                     return I18N::translateContext('MALE', 'Adopted by both parents');
                 case 'F':
                     return I18N::translateContext('FEMALE', 'Adopted by both parents');
                 default:
                     return I18N::translate('Adopted by both parents');
             }
         case 'HUSB':
             switch ($sex) {
                 case 'M':
                     return I18N::translateContext('MALE', 'Adopted by father');
                 case 'F':
                     return I18N::translateContext('FEMALE', 'Adopted by father');
                 default:
                     return I18N::translate('Adopted by father');
             }
         case 'WIFE':
             switch ($sex) {
                 case 'M':
                     return I18N::translateContext('MALE', 'Adopted by mother');
                 case 'F':
                     return I18N::translateContext('FEMALE', 'Adopted by mother');
                 default:
                     return I18N::translate('Adopted by mother');
             }
         default:
             return $type;
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:47,代码来源:GedcomCodeAdop.php

示例5: calendar_list_text

/**
 * Format a list of facts for display
 *
 * @param Fact[] $list
 * @param string $tag1
 * @param string $tag2
 * @param bool   $show_sex_symbols
 *
 * @return string
 */
function calendar_list_text($list, $tag1, $tag2, $show_sex_symbols)
{
    global $males, $females, $WT_TREE;
    $html = '';
    foreach ($list as $id => $facts) {
        $tmp = GedcomRecord::getInstance($id, $WT_TREE);
        $html .= $tag1 . '<a href="' . $tmp->getHtmlUrl() . '">' . $tmp->getFullName() . '</a> ';
        if ($show_sex_symbols && $tmp instanceof Individual) {
            switch ($tmp->getSex()) {
                case 'M':
                    $html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>';
                    ++$males;
                    break;
                case 'F':
                    $html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>';
                    ++$females;
                    break;
                default:
                    $html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>';
                    break;
            }
        }
        $html .= '<div class="indent">' . $facts . '</div>' . $tag2;
    }
    return $html;
}
开发者ID:josefpavlik,项目名称:webtrees,代码行数:36,代码来源:calendar.php

示例6: allDescriptions

 /**
  * A list of known surname traditions, with their descriptions
  *
  * @return string[]
  */
 public static function allDescriptions()
 {
     return array('paternal' => I18N::translateContext('Surname tradition', 'paternal') . ' — ' . I18N::translate('Children take their father’s surname.') . ' ' . I18N::translate('Wives take their husband’s surname.'), 'patrilineal' => I18N::translate('patrilineal') . ' — ' . I18N::translate('Children take their father’s surname.'), 'matrilineal' => I18N::translate('matrilineal') . ' — ' . I18N::translate('Children take their mother’s surname.'), 'spanish' => I18N::translateContext('Surname tradition', 'Spanish') . ' — ' . I18N::translate('Children take one surname from the father and one surname from the mother.'), 'portuguese' => I18N::translateContext('Surname tradition', 'Portuguese') . ' — ' . I18N::translate('Children take one surname from the mother and one surname from the father.'), 'icelandic' => I18N::translateContext('Surname tradition', 'Icelandic') . ' — ' . I18N::translate('Children take a patronym instead of a surname.'), 'polish' => I18N::translateContext('Surname tradition', 'Polish') . ' — ' . I18N::translate('Children take their father’s surname.') . ' ' . I18N::translate('Wives take their husband’s surname.') . ' ' . I18N::translate('Surnames are inflected to indicate an individual’s gender.'), 'lithuanian' => I18N::translateContext('Surname tradition', 'Lithuanian') . ' — ' . I18N::translate('Children take their father’s surname.') . ' ' . I18N::translate('Wives take their husband’s surname.') . ' ' . I18N::translate('Surnames are inflected to indicate an individual’s gender and marital status.'), 'none' => I18N::translateContext('Surname tradition', 'none'));
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:9,代码来源:SurnameTradition.php

示例7: getSidebarContent

    /**
     * Load this sidebar synchronously.
     *
     * @return string
     */
    public function getSidebarContent()
    {
        global $controller, $WT_TREE;
        // Fetch a list of the initial letters of all surnames in the database
        $initials = QueryName::surnameAlpha($WT_TREE, true, false, false);
        $controller->addInlineJavascript('
			var loadedNames = new Array();

			function isearchQ() {
				var query = jQuery("#sb_indi_name").val();
				if (query.length>1) {
					jQuery("#sb_indi_content").load("module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=individuals&search="+query);
				}
			}

			var timerid = null;
			jQuery("#sb_indi_name").keyup(function(e) {
				if (timerid) window.clearTimeout(timerid);
				timerid = window.setTimeout("isearchQ()", 500);
			});
			jQuery("#sb_content_individuals").on("click", ".sb_indi_letter", function() {
				jQuery("#sb_indi_content").load(this.href);
				return false;
			});
			jQuery("#sb_content_individuals").on("click", ".sb_indi_surname", function() {
				var element = jQuery(this);
				var surname = element.data("surname");
				var alpha   = element.data("alpha");

				if (!loadedNames[surname]) {
					jQuery.ajax({
					  url: "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=individuals&alpha=" + encodeURIComponent(alpha) + "&surname=" + encodeURIComponent(surname),
					  cache: false,
					  success: function(html) {
					    jQuery("div.name_tree_div", element.closest("li"))
					    .html(html)
					    .show("fast")
					    .css("list-style-image", "url(' . Theme::theme()->parameter('image-minus') . ')");
					    loadedNames[surname]=2;
					  }
					});
				} else if (loadedNames[surname]==1) {
					loadedNames[surname]=2;
					jQuery("div.name_tree_div", jQuery(this).closest("li"))
					.show()
					.css("list-style-image", "url(' . Theme::theme()->parameter('image-minus') . ')");
				} else {
					loadedNames[surname]=1;
					jQuery("div.name_tree_div", jQuery(this).closest("li"))
					.hide("fast")
					.css("list-style-image", "url(' . Theme::theme()->parameter('image-plus') . ')");
				}
				return false;
			});
		');
        $out = '<form method="post" action="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax" onsubmit="return false;"><input type="search" name="sb_indi_name" id="sb_indi_name" placeholder="' . I18N::translate('Search') . '"><p>';
        foreach ($initials as $letter => $count) {
            switch ($letter) {
                case '@':
                    $html = I18N::translateContext('Unknown surname', '…');
                    break;
                case ',':
                    $html = I18N::translate('None');
                    break;
                case ' ':
                    $html = '&nbsp;';
                    break;
                default:
                    $html = $letter;
                    break;
            }
            $html = '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=individuals&amp;alpha=' . urlencode($letter) . '" class="sb_indi_letter">' . $html . '</a>';
            $out .= $html . " ";
        }
        $out .= '</p>';
        $out .= '<div id="sb_indi_content">';
        $out .= '</div></form>';
        return $out;
    }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:84,代码来源:IndividualSidebarModule.php

示例8: centuryName

 /**
  * Century name, English => 21st, Polish => XXI, etc.
  *
  * @param int $century
  *
  * @return string
  */
 private function centuryName($century)
 {
     if ($century < 0) {
         return str_replace(-$century, self::centuryName(-$century), I18N::translate('%s BCE', I18N::number(-$century)));
     }
     // The current chart engine (Google charts) can't handle <sup></sup> markup
     switch ($century) {
         case 21:
             return strip_tags(I18N::translateContext('CENTURY', '21st'));
         case 20:
             return strip_tags(I18N::translateContext('CENTURY', '20th'));
         case 19:
             return strip_tags(I18N::translateContext('CENTURY', '19th'));
         case 18:
             return strip_tags(I18N::translateContext('CENTURY', '18th'));
         case 17:
             return strip_tags(I18N::translateContext('CENTURY', '17th'));
         case 16:
             return strip_tags(I18N::translateContext('CENTURY', '16th'));
         case 15:
             return strip_tags(I18N::translateContext('CENTURY', '15th'));
         case 14:
             return strip_tags(I18N::translateContext('CENTURY', '14th'));
         case 13:
             return strip_tags(I18N::translateContext('CENTURY', '13th'));
         case 12:
             return strip_tags(I18N::translateContext('CENTURY', '12th'));
         case 11:
             return strip_tags(I18N::translateContext('CENTURY', '11th'));
         case 10:
             return strip_tags(I18N::translateContext('CENTURY', '10th'));
         case 9:
             return strip_tags(I18N::translateContext('CENTURY', '9th'));
         case 8:
             return strip_tags(I18N::translateContext('CENTURY', '8th'));
         case 7:
             return strip_tags(I18N::translateContext('CENTURY', '7th'));
         case 6:
             return strip_tags(I18N::translateContext('CENTURY', '6th'));
         case 5:
             return strip_tags(I18N::translateContext('CENTURY', '5th'));
         case 4:
             return strip_tags(I18N::translateContext('CENTURY', '4th'));
         case 3:
             return strip_tags(I18N::translateContext('CENTURY', '3rd'));
         case 2:
             return strip_tags(I18N::translateContext('CENTURY', '2nd'));
         case 1:
             return strip_tags(I18N::translateContext('CENTURY', '1st'));
         default:
             return $century - 1 . '01-' . $century . '00';
     }
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:60,代码来源:Stats.php

示例9: monthNameInstrumentalCase

 /**
  * Full month name in instrumental case.
  *
  * @param int  $month_number
  * @param bool $leap_year    Some calendars use leap months
  *
  * @return string
  */
 protected function monthNameInstrumentalCase($month_number, $leap_year)
 {
     static $translated_month_names;
     if ($translated_month_names === null) {
         $translated_month_names = array(0 => '', 1 => I18N::translateContext('INSTRUMENTAL', 'Muharram'), 2 => I18N::translateContext('INSTRUMENTAL', 'Safar'), 3 => I18N::translateContext('INSTRUMENTAL', 'Rabi’ al-awwal'), 4 => I18N::translateContext('INSTRUMENTAL', 'Rabi’ al-thani'), 5 => I18N::translateContext('INSTRUMENTAL', 'Jumada al-awwal'), 6 => I18N::translateContext('INSTRUMENTAL', 'Jumada al-thani'), 7 => I18N::translateContext('INSTRUMENTAL', 'Rajab'), 8 => I18N::translateContext('INSTRUMENTAL', 'Sha’aban'), 9 => I18N::translateContext('INSTRUMENTAL', 'Ramadan'), 10 => I18N::translateContext('INSTRUMENTAL', 'Shawwal'), 11 => I18N::translateContext('INSTRUMENTAL', 'Dhu al-Qi’dah'), 12 => I18N::translateContext('INSTRUMENTAL', 'Dhu al-Hijjah'));
     }
     return $translated_month_names[$month_number];
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:16,代码来源:HijriDate.php

示例10: foreach

     echo '<input type="checkbox" name="vars[', Filter::escapeHtml($input['name']), ']" id="', Filter::escapeHtml($input['name']), '" value="1" ';
     echo $input['default'] == '1' ? 'checked' : '';
     echo '>';
 }
 if ($input['type'] == 'select') {
     echo '<select name="vars[', Filter::escapeHtml($input['name']), ']" id="', Filter::escapeHtml($input['name']), '_var">';
     $options = preg_split('/[|]+/', $input['options']);
     foreach ($options as $option) {
         $opt = explode('=>', $option);
         list($value, $display) = $opt;
         if (preg_match('/^I18N::number\\((.+)\\)$/', $display, $match)) {
             $display = I18N::number($match[1]);
         } elseif (preg_match('/^I18N::translate\\(\'(.+)\'\\)$/', $display, $match)) {
             $display = I18N::translate($match[1]);
         } elseif (preg_match('/^I18N::translateContext\\(\'(.+)\', *\'(.+)\'\\)$/', $display, $match)) {
             $display = I18N::translateContext($match[1], $match[2]);
         }
         echo '<option value="', Filter::escapeHtml($value), '" ';
         if ($opt[0] == $input['default']) {
             echo 'selected';
         }
         echo '>', Filter::escapeHtml($display), '</option>';
     }
     echo '</select>';
 }
 if (isset($input['lookup'])) {
     echo '<input type="hidden" name="type[', Filter::escapeHtml($input['name']), ']" value="', Filter::escapeHtml($input['lookup']), '">';
     if ($input['lookup'] == 'INDI') {
         echo FunctionsPrint::printFindIndividualLink('pid');
     } elseif ($input['lookup'] == 'PLAC') {
         echo FunctionsPrint::printFindPlaceLink($input['name']);
开发者ID:jflash,项目名称:webtrees,代码行数:31,代码来源:reportengine.php

示例11: monthNameAbbreviated

 /**
  * Abbreviated month name
  *
  * @param int  $month_number
  * @param bool $leap_year    Some calendars use leap months
  *
  * @return string
  */
 protected function monthNameAbbreviated($month_number, $leap_year)
 {
     static $translated_month_names;
     if ($translated_month_names === null) {
         $translated_month_names = array(0 => '', 1 => I18N::translateContext('Abbreviation for January', 'Jan'), 2 => I18N::translateContext('Abbreviation for February', 'Feb'), 3 => I18N::translateContext('Abbreviation for March', 'Mar'), 4 => I18N::translateContext('Abbreviation for April', 'Apr'), 5 => I18N::translateContext('Abbreviation for May', 'May'), 6 => I18N::translateContext('Abbreviation for June', 'Jun'), 7 => I18N::translateContext('Abbreviation for July', 'Jul'), 8 => I18N::translateContext('Abbreviation for August', 'Aug'), 9 => I18N::translateContext('Abbreviation for September', 'Sep'), 10 => I18N::translateContext('Abbreviation for October', 'Oct'), 11 => I18N::translateContext('Abbreviation for November', 'Nov'), 12 => I18N::translateContext('Abbreviation for December', 'Dec'));
     }
     return $translated_month_names[$month_number];
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:16,代码来源:CalendarDate.php

示例12: FamilyController

use Fisharebest\Webtrees\Functions\FunctionsCharts;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
define('WT_SCRIPT_NAME', 'family.php');
require './includes/session.php';
$record = Family::getInstance(Filter::get('famid', WT_REGEX_XREF), $WT_TREE);
$controller = new FamilyController($record);
if ($controller->record && $controller->record->canShow()) {
    if ($controller->record->isPendingDeletion()) {
        if (Auth::isModerator($controller->record->getTree())) {
            FlashMessages::addMessage(I18N::translate('This family has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 'warning');
        } elseif (Auth::isEditor($controller->record->getTree())) {
            FlashMessages::addMessage(I18N::translate('This family has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes'), 'warning');
        }
    } elseif ($controller->record->isPendingAddtion()) {
        if (Auth::isModerator($controller->record->getTree())) {
            FlashMessages::addMessage(I18N::translate('This family has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 'warning');
        } elseif (Auth::isEditor($controller->record->getTree())) {
            FlashMessages::addMessage(I18N::translate('This family has been edited. The changes need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes'), 'warning');
        }
    }
    $controller->pageHeader();
} elseif ($controller->record && $controller->record->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) {
    $controller->pageHeader();
    // Continue - to display the children/parents/grandparents.
    // We'll check for showing the details again later
} else {
    FlashMessages::addMessage(I18N::translate('This family does not exist or you do not have permission to view it.'), 'danger');
    http_response_code(404);
    $controller->pageHeader();
    return;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:family.php

示例13: __construct

 /**
  * {@inheritDoc}
  * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
  */
 public function __construct(AbstractModule $module)
 {
     global $WT_TREE;
     parent::__construct($module);
     $this->surname = Filter::get('surname');
     $this->alpha = Filter::get('alpha');
     // All surnames beginning with this letter where "@"=unknown and ","=none
     $this->show_all = Filter::get('show_all', 'no|yes', 'no');
     // All indis
     // Make sure selections are consistent.
     // i.e. can’t specify show_all and surname at the same time.
     if ($this->show_all === 'yes') {
         $this->alpha = '';
         $this->surname = '';
         $this->legend = I18N::translate('All');
         $this->show = Filter::get('show', 'surn|lineage', 'surn');
     } elseif ($this->surname) {
         $this->alpha = QueryName::initialLetter($this->surname);
         // so we can highlight the initial letter
         $this->show_all = 'no';
         if ($this->surname === '@N.N.') {
             $this->legend = I18N::translateContext('Unknown surname', '…');
         } else {
             $this->legend = Filter::escapeHtml($this->surname);
             // The surname parameter is a root/canonical form.
             // Display it as the actual surname
             foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) {
                 $this->legend = implode('/', array_keys($details));
             }
         }
         $this->show = 'lineage';
         // SURN list makes no sense here
     } elseif ($this->alpha === '@') {
         $this->show_all = 'no';
         $this->legend = I18N::translateContext('Unknown surname', '…');
         $this->show = 'lineage';
         // SURN list makes no sense here
     } elseif ($this->alpha === ',') {
         $this->show_all = 'no';
         $this->legend = I18N::translate('None');
         $this->show = 'lineage';
         // SURN list makes no sense here
     } elseif ($this->alpha) {
         $this->show_all = 'no';
         $this->legend = Filter::escapeHtml($this->alpha) . '…';
         $this->show = Filter::get('show', 'surn|lineage', 'surn');
     } else {
         $this->show_all = 'no';
         $this->legend = '…';
         $this->show = 'none';
         // Don't show lists until something is chosen
     }
     $this->legend = '<span dir="auto">' . $this->legend . '</span>';
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:58,代码来源:LineageController.php

示例14: getParents

 /**
  * Forat the parents of an individual.
  *
  * @param Individual $person
  *
  * @return string
  */
 private function getParents(Individual $person)
 {
     $father = null;
     $mother = null;
     $html = sprintf(self::TTL, I18N::translate('Parents'));
     $family = $person->getPrimaryChildFamily();
     if ($person->canShowName() && $family !== null) {
         $father = $family->getHusband();
         $mother = $family->getWife();
         $html .= $this->getHTML($father) . $this->getHTML($mother);
         // Can only have a step parent if one & only one parent found at this point
         if ($father instanceof Individual xor $mother instanceof Individual) {
             $stepParents = '';
             foreach ($person->getChildStepFamilies() as $family) {
                 if (!$father instanceof Individual) {
                     $stepParents .= $this->getHTML($family->getHusband());
                 } else {
                     $stepParents .= $this->getHTML($family->getWife());
                 }
             }
             if ($stepParents) {
                 $relationship = $father instanceof Individual ? I18N::translateContext("father’s wife", "step-mother") : I18N::translateContext("mother’s husband", "step-father");
                 $html .= sprintf(self::TTL, $relationship) . $stepParents;
             }
         }
     }
     if (!($father instanceof Individual || $mother instanceof Individual)) {
         $html .= sprintf(self::MSG, I18N::translateContext('unknown family', 'unknown'));
     }
     return $html;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:38,代码来源:FamilyNavigatorModule.php

示例15: setVarStartHandler

 /**
  * Setting upp or changing variables in the XML
  * The XML variable name and value is stored in $this->vars
  *
  * @param array $attrs an array of key value pairs for the attributes
  */
 private function setVarStartHandler($attrs)
 {
     if (empty($attrs['name'])) {
         throw new \DomainException('REPORT ERROR var: The attribute "name" is missing or not set in the XML file');
     }
     $name = $attrs['name'];
     $value = $attrs['value'];
     $match = array();
     // Current GEDCOM record strings
     if ($value == "@ID") {
         if (preg_match("/0 @(.+)@/", $this->gedrec, $match)) {
             $value = $match[1];
         }
     } elseif ($value == "@fact") {
         $value = $this->fact;
     } elseif ($value == "@desc") {
         $value = $this->desc;
     } elseif ($value == "@generation") {
         $value = $this->generation;
     } elseif (preg_match("/@(\\w+)/", $value, $match)) {
         $gmatch = array();
         if (preg_match("/\\d {$match['1']} (.+)/", $this->gedrec, $gmatch)) {
             $value = str_replace("@", "", trim($gmatch[1]));
         }
     }
     if (preg_match("/\\\$(\\w+)/", $name, $match)) {
         $name = $this->vars["'" . $match[1] . "'"]['id'];
     }
     $count = preg_match_all("/\\\$(\\w+)/", $value, $match, PREG_SET_ORDER);
     $i = 0;
     while ($i < $count) {
         $t = $this->vars[$match[$i][1]]['id'];
         $value = preg_replace("/\\\$" . $match[$i][1] . "/", $t, $value, 1);
         $i++;
     }
     if (preg_match('/^I18N::number\\((.+)\\)$/', $value, $match)) {
         $value = I18N::number($match[1]);
     } elseif (preg_match('/^I18N::translate\\(\'(.+)\'\\)$/', $value, $match)) {
         $value = I18N::translate($match[1]);
     } elseif (preg_match('/^I18N::translateContext\\(\'(.+)\', *\'(.+)\'\\)$/', $value, $match)) {
         $value = I18N::translateContext($match[1], $match[2]);
     }
     // Arithmetic functions
     if (preg_match("/(\\d+)\\s*([\\-\\+\\*\\/])\\s*(\\d+)/", $value, $match)) {
         switch ($match[2]) {
             case "+":
                 $t = $match[1] + $match[3];
                 $value = preg_replace("/" . $match[1] . "\\s*([\\-\\+\\*\\/])\\s*" . $match[3] . "/", $t, $value);
                 break;
             case "-":
                 $t = $match[1] - $match[3];
                 $value = preg_replace("/" . $match[1] . "\\s*([\\-\\+\\*\\/])\\s*" . $match[3] . "/", $t, $value);
                 break;
             case "*":
                 $t = $match[1] * $match[3];
                 $value = preg_replace("/" . $match[1] . "\\s*([\\-\\+\\*\\/])\\s*" . $match[3] . "/", $t, $value);
                 break;
             case "/":
                 $t = $match[1] / $match[3];
                 $value = preg_replace("/" . $match[1] . "\\s*([\\-\\+\\*\\/])\\s*" . $match[3] . "/", $t, $value);
                 break;
         }
     }
     if (strpos($value, "@") !== false) {
         $value = "";
     }
     $this->vars[$name]['id'] = $value;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:74,代码来源:ReportParserGenerate.php


注:本文中的Fisharebest\Webtrees\I18N::translateContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。