本文整理汇总了PHP中WT_I18N::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP WT_I18N::translate方法的具体用法?PHP WT_I18N::translate怎么用?PHP WT_I18N::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT_I18N
的用法示例。
在下文中一共展示了WT_I18N::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: statusName
public static function statusName($status_code)
{
switch ($status_code) {
case 'BIC':
return WT_I18N::translate('Born in the covenant');
case 'CANCELED':
return WT_I18N::translate('Sealing cancelled (divorce)');
case 'CHILD':
return WT_I18N::translate('Died as a child: exempt');
case 'CLEARED':
// This status appears in PGV, but not in the GEDCOM 5.5.1 specification.
return WT_I18N::translate('Cleared but not yet completed');
case 'COMPLETED':
return WT_I18N::translate('Completed; date unknown');
case 'DNS':
return WT_I18N::translate('Do not seal: unauthorized');
case 'DNS/CAN':
return WT_I18N::translate('Do not seal, previous sealing cancelled');
case 'EXCLUDED':
return WT_I18N::translate('Excluded from this submission');
case 'INFANT':
return WT_I18N::translate('Died as an infant: exempt');
case 'PRE-1970':
return WT_I18N::translate('Completed before 1970; date not available');
case 'STILLBORN':
return WT_I18N::translate('Stillborn: exempt');
case 'SUBMITTED':
return WT_I18N::translate('Submitted but not yet cleared');
case 'UNCLEARED':
return WT_I18N::translate('Uncleared: insufficient data');
default:
return $status_code;
}
}
示例2: getSidebarContent
public function getSidebarContent()
{
global $SHOW_COUNTER, $controller;
$indifacts = array();
// The individual’s own facts
foreach ($controller->record->getFacts() as $fact) {
if (self::showFact($fact)) {
$indifacts[] = $fact;
}
}
ob_start();
if (!$indifacts) {
echo WT_I18N::translate('There are no facts for this individual.');
} else {
foreach ($indifacts as $fact) {
print_fact($fact, $controller->record);
}
}
echo '<div id="hitcounter">';
if ($SHOW_COUNTER && empty($SEARCH_SPIDER)) {
//print indi counter only if displaying a non-private person
require WT_ROOT . 'includes/hitcount.php';
echo WT_I18N::translate('Hit count:') . ' ' . $hitCount;
}
echo '</div>';
// close #hitcounter
return strip_tags(ob_get_clean(), '<a><div><span>');
}
示例3: getEditMenu
/**
* get edit menu
*/
function getEditMenu()
{
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-note');
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit');
$submenu->addOnclick('return edit_note(\'' . $this->record->getXref() . '\');');
$menu->addSubmenu($submenu);
}
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-note-del');
$submenu->addOnclick("return delete_note('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-note-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
示例4: formatLongYear
protected function formatLongYear()
{
if ($this->y < 0) {
return WT_I18N::translate('%s BCE', WT_I18N::digits(-$this->y));
} else {
if ($this->new_old_style) {
return WT_I18N::translate('%s CE', WT_I18N::digits(sprintf('%d/%02d', $this->y - 1, $this->y % 100)));
} else {
return WT_I18N::translate('%s CE', WT_I18N::digits($this->y));
}
}
}
示例5: extractNames
/**
* Create a name for this note - apply (and remove) markup, then take
* a maximum of 100 characters from the first line.
*/
public function extractNames()
{
global $WT_TREE;
$text = $this->getNote();
switch ($WT_TREE->preference('FORMAT_TEXT')) {
case 'markdown':
$text = WT_Filter::markdown($text);
$text = strip_tags($text);
break;
}
list($text) = explode("\n", $text);
$this->_addName('NOTE', strlen($text) > 100 ? mb_substr($text, 0, 100) . WT_I18N::translate('…') : $text, $this->getGedcom());
}
示例6: modAction
public function modAction($modAction)
{
global $controller;
switch ($modAction) {
case 'menu-add-favorite':
// Process the "add to user favorites" menu item on indi/fam/etc. pages
$record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF));
if (WT_USER_ID && $record->canShowName()) {
self::addFavorite(array('user_id' => WT_USER_ID, 'gedcom_id' => $record->getGedcomId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
WT_FlashMessages::addMessage(WT_I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
}
break;
}
}
示例7: getValue
public static function getValue($type)
{
switch ($type) {
case '3':
return WT_I18N::translate('primary evidence');
case '2':
return WT_I18N::translate('secondary evidence');
case '1':
return WT_I18N::translate('questionable evidence');
case '0':
return WT_I18N::translate('unreliable evidence');
default:
return $type;
}
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->rootid = WT_Filter::get('rootid', WT_REGEX_XREF);
if ($this->rootid) {
$this->root = WT_Individual::getInstance($this->rootid);
} else {
// Missing rootid parameter? Do something.
$this->root = $this->getSignificantIndividual();
$this->rootid = $this->root->getXref();
}
if (!$this->root || !$this->root->canShowName()) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
$this->error_message = WT_I18N::translate('This individual does not exist or you do not have permission to view it.');
$this->rootid = null;
}
}
示例9: getEditMenu
/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-repo');
if (WT_USER_CAN_EDIT) {
$fact = $this->record->getFirstFact('NAME');
$submenu = new WT_Menu(WT_I18N::translate('Edit repository'), '#', 'menu-repo-edit');
if ($fact) {
// Edit existing name
$submenu->addOnclick('return edit_record(\'' . $this->record->getXref() . '\', \'' . $fact->getFactId() . '\');');
} else {
// Add new name
$submenu->addOnclick('return add_fact(\'' . $this->record->getXref() . '\', \'NAME\');');
}
$menu->addSubmenu($submenu);
}
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-repo-del');
$submenu->addOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// edit raw
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-repo-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-repo-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
示例10: __construct
public function __construct()
{
// Automatically fix broken links
if ($this->record && $this->record->canEdit()) {
$broken_links = 0;
foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) {
if (!$fact->isOld() && $fact->getTarget() === null) {
$this->record->deleteFact($fact->getFactId(), false);
WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
$broken_links = true;
}
}
foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
// These can be links or inline. Only delete links.
if (!$fact->isOld() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
$this->record->deleteFact($fact->getFactId(), false);
WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
$broken_links = true;
}
}
if ($broken_links) {
// Reload the updated family
$this->record = WT_GedcomRecord::getInstance($this->record->getXref());
}
}
parent::__construct();
// We want robots to index this page
$this->setMetaRobots('index,follow');
// Set a page title
if ($this->record) {
$this->setCanonicalUrl($this->record->getHtmlUrl());
if ($this->record->canShowName()) {
// e.g. "John Doe" or "1881 Census of Wales"
$this->setPageTitle($this->record->getFullName());
} else {
// e.g. "Individual" or "Source"
$record = $this->record;
$this->setPageTitle(WT_Gedcom_Tag::getLabel($record::RECORD_TYPE));
}
} else {
// No such record
$this->setPageTitle(WT_I18N::translate('Private'));
}
}
示例11: send404AndExit
function send404AndExit()
{
$error = WT_I18N::translate('The media file was not found in this family tree');
$width = mb_strlen($error) * 6.5 + 50;
$height = 60;
$im = imagecreatetruecolor($width, $height);
/* Create a black image */
$bgc = imagecolorallocate($im, 255, 255, 255);
/* set background color */
imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc);
/* create a rectangle, leaving 2 px border */
embedText($im, $error, 100, "255, 0, 0", "", "top", "left");
header('HTTP/1.0 404 Not Found');
header('Status: 404 Not Found');
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
exit;
}
示例12: getBlock
public function getBlock($block_id, $template = true, $cfg = null)
{
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = '<span dir="auto">' . WT_I18N::translate('Welcome %s', Auth::user()->getRealName()) . '</span>';
$content = '<table><tr>';
if (Auth::user()->getSetting('editaccount')) {
$content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . WT_I18N::translate('My account') . '</a></td>';
}
if (WT_USER_GEDCOM_ID) {
$content .= '<td><a href="pedigree.php?rootid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL . '"><i class="icon-pedigree"></i><br>' . WT_I18N::translate('My pedigree') . '</a></td>';
$content .= '<td><a href="individual.php?pid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL . '"><i class="icon-indis"></i><br>' . WT_I18N::translate('My individual record') . '</a></td>';
}
$content .= '</tr></table>';
if ($template) {
require WT_THEME_DIR . 'templates/block_main_temp.php';
} else {
return $content;
}
}
示例13: getEditMenu
/**
* get edit menu
*/
function getEditMenu()
{
$SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
if (!$this->record || $this->record->isOld()) {
return null;
}
// edit menu
$menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-note');
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit');
$submenu->addOnclick('return edit_note(\'' . $this->record->getXref() . '\');');
$menu->addSubmenu($submenu);
}
// edit raw
/* Does not currently work - NOTE records do not contain nice level 1 facts
if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
$submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-note-editraw');
$submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
*/
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-note-del');
$submenu->addOnclick("return delete_note('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
// add to favorites
if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-note-addfav');
$submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
//-- get the link for the first submenu and set it as the link for the main menu
if (isset($menu->submenus[0])) {
$link = $menu->submenus[0]->onclick;
$menu->addOnclick($link);
}
return $menu;
}
示例14: getValue
public static function getValue($type, $record = null)
{
if ($record instanceof WT_Individual) {
$sex = $record->getSex();
} else {
$sex = 'U';
}
switch ($type) {
case 'BOTH':
switch ($sex) {
case 'M':
return WT_I18N::translate_c('MALE', 'Adopted by both parents');
case 'F':
return WT_I18N::translate_c('FEMALE', 'Adopted by both parents');
default:
return WT_I18N::translate('Adopted by both parents');
}
case 'HUSB':
switch ($sex) {
case 'M':
return WT_I18N::translate_c('MALE', 'Adopted by father');
case 'F':
return WT_I18N::translate_c('FEMALE', 'Adopted by father');
default:
return WT_I18N::translate('Adopted by father');
}
case 'WIFE':
switch ($sex) {
case 'M':
return WT_I18N::translate_c('MALE', 'Adopted by mother');
case 'F':
return WT_I18N::translate_c('FEMALE', 'Adopted by mother');
default:
return WT_I18N::translate('Adopted by mother');
}
default:
return $type;
}
}
示例15: color_theme_dropdown
function color_theme_dropdown()
{
global $COLOR_THEME_LIST, $WT_SESSION, $subColor;
$menu = new WT_Menu(WT_I18N::translate('Palette'), '#', 'menu-color');
uasort($COLOR_THEME_LIST, array('WT_I18N', 'strcasecmp'));
foreach ($COLOR_THEME_LIST as $colorChoice => $colorName) {
$submenu = new WT_Menu($colorName, get_query_url(array('themecolor' => $colorChoice), '&'), 'menu-color-' . $colorChoice);
if (isset($WT_SESSION->subColor)) {
if ($WT_SESSION->subColor == $colorChoice) {
$submenu->addClass('', '', 'theme-active');
}
} elseif (WT_Site::preference('DEFAULT_COLOR_PALETTE') == $colorChoice) {
/* here when visitor changes palette from default */
$submenu->addClass('', '', 'theme-active');
} elseif ($subColor == 'ash') {
/* here when site has different theme as default and user switches to colors */
if ($subColor == $colorChoice) {
$submenu->addClass('', '', 'theme-active');
}
}
$menu->addSubMenu($submenu);
}
return $menu->getMenuAsList();
}