本文整理汇总了PHP中Fisharebest\Webtrees\I18N::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP I18N::translate方法的具体用法?PHP I18N::translate怎么用?PHP I18N::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\I18N
的用法示例。
在下文中一共展示了I18N::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour');
if (Auth::isEditor($this->record->getTree())) {
$fact = $this->record->getFirstFact('TITL');
if ($fact) {
// Edit existing name
$menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
} else {
// Add new name
$menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
}
// delete
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-sour-del', array('onclick' => "return delete_record('" . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');")));
}
// edit raw
if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
$menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-sour-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
}
return $menu;
}
示例2: htmlAnalysisData
/**
* {@inheritDoc}
* @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisTabGeneralView::htmlAnalysisData()
*/
protected function htmlAnalysisData()
{
$results = $this->data->get('results');
$analysis_level = $this->data->get('analysis_level');
$nb_found = $this->data->get('stats_gen_nb_found');
$nb_other = $this->data->get('stats_gen_nb_other');
$i = 1;
$previous_nb = 0;
$html = '<div class="maj-table center">';
foreach ($results as $place => $nb) {
$perc = Functions::safeDivision($nb, $nb_found - $nb_other);
if ($nb != $previous_nb) {
$j = I18N::number($i);
} else {
$j = ' ';
}
$levels = array_map('trim', explode(',', $place));
$placename = $levels[$analysis_level - 1];
if ($placename == '' && $analysis_level > 1) {
$placename = I18N::translate('Unknown (%s)', $levels[$analysis_level - 2]);
}
$html .= '<div class="maj-row">
<div class="label"><strong>' . $j . '</strong></div>
<div class="label">' . $placename . '</div>
<div class="value">' . I18N::translate('%d', $nb) . '</div>
<div class="value">' . I18N::percentage($perc, 1) . '</div>
</div>';
$i++;
$previous_nb = $nb;
}
$html .= '</div>';
return $html;
}
示例3: renderContent
/**
* {@inhericDoc}
* @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
*/
protected function renderContent()
{
if ($this->data->get('is_success', false)) {
?>
<i class="icon-maj-success" title="<?php
echo I18N::translate('Success');
?>
"></i>
<?php
echo I18N::translate('Success');
?>
<?php
} else {
?>
<i class="icon-maj-error" title="<?php
echo I18N::translate('Error');
?>
"></i>
<?php
echo I18N::translate('Error');
?>
<?php
if ($error = $this->data->get('error')) {
echo ' - ' . $error;
}
}
}
示例4: update
/**
* Manage updates sent from the AdminConfig@index form.
*/
protected function update()
{
if (Auth::isAdmin()) {
$this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT'));
$this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK'));
if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) {
$this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT);
}
if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) {
$this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE);
}
// Only accept valid color for MAJ_WM_FONT_COLOR
$MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}');
if ($MAJ_WM_FONT_COLOR) {
$this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR);
}
// Only accept valid folders for MAJ_CERT_ROOTDIR
$MAJ_CERT_ROOTDIR = preg_replace('/[\\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/');
if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') {
$MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1);
}
if ($MAJ_CERT_ROOTDIR) {
if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
$this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
} elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
$this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info');
} else {
FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger');
}
}
FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
return;
}
}
示例5: upgrade
/** {@inheritDoc} */
public function upgrade()
{
// add key 'LINK' to FTV_SETTINGS
// change options to multidimensional array with array key = tree id.
$module_settings = 'FTV_SETTINGS';
$ftv_settings = Database::prepare("SELECT setting_value FROM `##module_setting` WHERE setting_name=?")->execute(array($module_settings))->fetchOne();
$settings = unserialize($ftv_settings);
if (!empty($settings)) {
foreach ($settings as $setting) {
if (!array_key_exists('LINK', $setting)) {
$setting['LINK'] = I18N::translate('Descendants of the %s family', $setting['SURNAME']);
$new_settings[] = $setting;
}
}
if (isset($new_settings)) {
Database::prepare("UPDATE `##module_setting` SET setting_value=? WHERE setting_name=?")->execute(array(serialize($new_settings), $module_settings));
}
unset($new_settings);
}
$module_options = 'FTV_OPTIONS';
$ftv_options = Database::prepare("SELECT setting_value FROM `##module_setting` WHERE setting_name=?")->execute(array($module_options))->fetchOne();
$options = unserialize($ftv_options);
if (!empty($options)) {
$show_places = array_key_exists('SHOW_PLACES', $options) ? $options['SHOW_PLACES'] : '1';
$country = array_key_exists('COUNTRY', $options) ? $options['COUNTRY'] : '';
$show_occu = array_key_exists('SHOW_OCCU', $options) ? $options['SHOW_OCCU'] : '1';
foreach (Tree::getAll() as $tree) {
$new_options[$tree->getTreeId()] = array('SHOW_PLACES' => $show_places, 'COUNTRY' => $country, 'SHOW_OCCU' => $show_occu);
}
if (isset($new_options)) {
Database::prepare("UPDATE `##module_setting` SET setting_value=? WHERE setting_name=?")->execute(array(serialize($new_options), $module_options));
}
unset($new_options);
}
}
示例6: __construct
/**
* Create the chart controller
*
* @param int $show_full needed for use by charts module
*/
public function __construct($show_full = 1)
{
global $WT_TREE;
parent::__construct();
$rootid = Filter::get('rootid', WT_REGEX_XREF);
$this->root = Individual::getInstance($rootid, $WT_TREE);
if (!$this->root) {
// Missing root individual? Show the chart for someone.
$this->root = $this->getSignificantIndividual();
}
if (!$this->root || !$this->root->canShowName()) {
http_response_code(404);
$this->error_message = I18N::translate('This individual does not exist or you do not have permission to view it.');
}
// Extract parameter from form
if ($show_full) {
$this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS'));
} else {
$this->show_full = 0;
}
$this->box = new \stdClass();
if ($this->showFull()) {
$this->box->width = Theme::theme()->parameter('chart-box-x');
$this->box->height = Theme::theme()->parameter('chart-box-y');
} else {
$this->box->width = Theme::theme()->parameter('compact-chart-box-x');
$this->box->height = Theme::theme()->parameter('compact-chart-box-y');
}
}
示例7: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Edit note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
}
// delete
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_note("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
}
// add to favorites
if (Module::getModuleByName('user_favorites')) {
$menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-note-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
}
// Get the link for the first submenu and set it as the link for the main menu
if ($menu->getSubmenus()) {
$submenus = $menu->getSubmenus();
$menu->setLink($submenus[0]->getLink());
$menu->setAttrs($submenus[0]->getAttrs());
}
return $menu;
}
示例8: pageBody
public function pageBody()
{
$tmp_dir = WT_DATA_DIR . 'ftv_pdf_tmp/';
define('_JPGRAPH_PATH', $tmp_dir);
define('_MPDF_TEMP_PATH', $tmp_dir);
define('_MPDF_TTFONTDATAPATH', $tmp_dir);
require_once WT_MODULES_DIR . $this->getName() . '/mpdf/mpdf.php';
$stylesheet = file_get_contents($this->directory . '/css/style.css');
$stylesheet_rtl = file_get_contents($this->directory . '/css/style-rtl.css');
$html = Filter::post('pdfContent');
$header = '<header>=== ' . $this->tree()->getTitleHtml() . ' ===</header>';
$footer = '<footer>' . '<table><tr>' . '<td class="left">' . WT_BASE_URL . '</td>' . '<td class="center">{DATE d-m-Y}</td>' . '<td class="right">{PAGENO}</td>' . '</tr></table>' . '</footer>';
$mpdf = new mPDF();
$mpdf->simpleTables = true;
$mpdf->shrink_tables_to_fit = 1;
$mpdf->autoScriptToLang = true;
$mpdf->baseScript = 1;
$mpdf->autoVietnamese = true;
$mpdf->autoArabic = true;
$mpdf->autoLangToFont = true;
if (I18N::direction() === 'rtl') {
$mpdf->SetDirectionality('rtl');
$mpdf->WriteHTML($stylesheet_rtl, 1);
} else {
$mpdf->WriteHTML($stylesheet, 1);
}
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->autoMarginPadding = 5;
$admin = User::find($this->tree()->getPreference('WEBMASTER_USER_ID'))->getRealName();
$mpdf->setCreator($this->getTitle() . ' - a webtrees module by justcarmen.nl');
$mpdf->SetTitle(Filter::get('title'));
$mpdf->setAuthor($admin);
$mpdf->SetHTMLHeader($header);
$mpdf->setHTMLFooter($footer);
$html_chunks = explode("\n", $html);
$chunks = count($html_chunks);
$i = 1;
foreach ($html_chunks as $html_chunk) {
// write html body parts only (option 2);
if ($i === 1) {
// first chunk (initialize all buffers - init=true)
$mpdf->WriteHTML($html_chunk, 2, true, false);
} elseif ($i === $chunks) {
// last chunck (close all buffers - close=true)
$mpdf->WriteHTML($html_chunk, 2, false, true);
} else {
// all other parts (keep the buffer open)
$mpdf->WriteHTML($html_chunk, 2, false, false);
}
$i++;
}
$index = '
<pagebreak type="next-odd" />
<h2>' . I18N::translate('Index') . '</h2>
<columns column-count="2" column-gap="5" />
<indexinsert usedivletters="on" links="on" collation="' . WT_LOCALE . '.utf8" collationgroup="' . I18N::collation() . '" />';
$mpdf->writeHTML($index);
$mpdf->Output($tmp_dir . Filter::get('title') . '.pdf', 'F');
}
示例9: renderContent
/**
* {@inhericDoc}
* @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
*/
protected function renderContent()
{
$nb_found = $this->data->get('stats_gen_nb_found');
$nb_other = $this->data->get('stats_gen_nb_other');
$nb_unknown = $this->data->get('stats_gen_nb_unknown');
$perc_known = Functions::safeDivision($nb_found - $nb_other, $nb_found + $nb_unknown);
$html = '<div id="geodispersion_summary">
<div class="maj-table center">
<div class="maj-row">
<div class="label">' . I18N::translate('Places found') . '</div>
<div class="value">' . I18N::translate('%1$d (%2$s)', $nb_found - $nb_other, I18N::percentage($perc_known)) . '</div>
</div>';
if ($nb_other > 0) {
$perc_other = Functions::safeDivision($nb_other, $nb_found + $nb_unknown);
$html .= '<div class="maj-row">
<div class="label">' . I18N::translate('Other places') . '</div>
<div class="value">' . I18N::translate('%1$d (%2$s)', $nb_other, I18N::percentage($perc_other)) . '</div>
</div>';
}
$html .= '<div class="maj-row">
<div class="label">' . I18N::translate('Places not found') . '</div>
<div class="value">' . I18N::translate('%1$d (%2$s)', $nb_unknown, I18N::percentage(1 - $perc_known)) . '</div>
</div>
</div>
</div>
<br/>
<div id="geodispersion_data">
' . $this->htmlAnalysisData() . '
</div>';
return $html;
}
示例10: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-repo');
if (Auth::isEditor($this->record->getTree())) {
$fact = $this->record->getFirstFact('NAME');
if ($fact) {
// Edit existing name
$menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
} else {
// Add new name
$menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "NAME");')));
}
}
// delete
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-repo-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
}
// edit raw
if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
$menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-repo-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
}
// add to favorites
if (Module::getModuleByName('user_favorites')) {
$menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-repo-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite" ,{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
}
return $menu;
}
示例11: pageBody
public function pageBody()
{
$cache_dir = WT_DATA_DIR . 'ftv_cache/';
define("_JPGRAPH_PATH", $cache_dir);
define("_MPDF_TEMP_PATH", $cache_dir);
define('_MPDF_TTFONTDATAPATH', $cache_dir);
require_once WT_MODULES_DIR . $this->getName() . '/packages/mpdf60/mpdf.php';
$tmpfile = $cache_dir . 'fancy-treeview-tmp.txt';
if (file_exists($cache_dir) && is_readable($tmpfile)) {
$stylesheet = file_get_contents($this->directory . '/css/pdf/style.css');
$stylesheet_rtl = file_get_contents($this->directory . '/css/pdf/style-rtl.css');
$html = file_get_contents($tmpfile);
$header = '<header>=== ' . $this->tree->getTitleHtml() . ' ===</header>';
$footer = '<footer>' . '<table><tr>' . '<td class="left">' . WT_BASE_URL . '</td>' . '<td class="center">{DATE d-m-Y}</td>' . '<td class="right">{PAGENO}</td>' . '</tr></table>' . '</footer>';
$mpdf = new mPDF();
$mpdf->simpleTables = true;
$mpdf->shrink_tables_to_fit = 1;
$mpdf->autoScriptToLang = true;
if (I18N::direction() === 'rtl') {
$mpdf->SetDirectionality('rtl');
}
if (I18N::direction() === 'rtl') {
$mpdf->WriteHTML($stylesheet_rtl, 1);
} else {
$mpdf->WriteHTML($stylesheet, 1);
}
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->autoMarginPadding = 5;
$admin = User::find($this->tree->getPreference('WEBMASTER_USER_ID'))->getRealName();
$mpdf->setCreator($this->getTitle() . ' - a webtrees module by justcarmen.nl');
$mpdf->SetTitle(Filter::get('title'));
$mpdf->setAuthor($admin);
$mpdf->SetHTMLHeader($header);
$mpdf->setHTMLFooter($footer);
$html_chunks = explode("\n", $html);
$chunks = count($html_chunks);
$i = 1;
foreach ($html_chunks as $html_chunk) {
if ($i === 1) {
$mpdf->WriteHTML($html_chunk, 2, true, false);
} elseif ($i === $chunks) {
$mpdf->WriteHTML($html_chunk, 2, false, false);
} else {
$mpdf->WriteHTML($html_chunk, 2, false, true);
}
$i++;
}
$index = '
<pagebreak type="next-odd" />
<h2>' . I18N::translate('Index') . '</h2>
<columns column-count="2" column-gap="5" />
<indexinsert usedivletters="on" links="on" collation="' . WT_LOCALE . '.utf8" collationgroup="' . I18N::collation() . '" />';
$mpdf->writeHTML($index);
$mpdf->Output(Filter::get('title') . '.pdf', 'D');
} else {
echo $this->addMessage('alert', 'danger', false, I18N::translate('Error: the pdf file could not be generated.'));
}
}
示例12: getActionButtons
/**
* Default buttons are update and update_all
*
* @param string $xref
*
* @return string[]
*/
public function getActionButtons($xref)
{
if (Auth::user()->getPreference('auto_accept')) {
return array(BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'), BatchUpdateModule::createSubmitButton(I18N::translate('Update all'), $xref, 'update_all'));
} else {
return array(BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'));
}
}
示例13: renderContent
/**
* {@inhericDoc}
* @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
*/
protected function renderContent()
{
if ($this->data->get('has_stats', false)) {
$html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)', '<span class="odometer">' . I18N::number($this->data->get('visits_year')) . '</span>', date('Y'), '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>');
} else {
$html = I18N::translate('No statistics could be retrieved from Piwik.');
}
return $html;
}
示例14: getSearchAreaName
/**
* Get the translatable country name for the search area.
*
* @global type $WT_TREE
* @param type $area
* @return string
*/
static function getSearchAreaName($area)
{
global $WT_TREE;
$stats = new Stats($WT_TREE);
$countries = $stats->getAllCountries();
if (array_key_exists($area, $countries)) {
$area = $countries[$area];
} else {
$area = I18N::translate("International");
}
return $area;
}
示例15: 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'];
}
}