本文整理汇总了PHP中Aimeos\MW\View\Iface::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP Iface::translate方法的具体用法?PHP Iface::translate怎么用?PHP Iface::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aimeos\MW\View\Iface
的用法示例。
在下文中一共展示了Iface::translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$salutations = array(\Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR, \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS, \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS);
try {
$salutation = '';
$addr = $view->extAddressItem;
if (in_array($addr->getSalutation(), $salutations)) {
$salutation = $view->translate('client/code', $addr->getSalutation());
}
/// E-mail intro with salutation (%1$s), first name (%2$s) and last name (%3$s)
$view->emailIntro = sprintf($view->translate('client', 'Dear %1$s %2$s %3$s'), $salutation, $addr->getFirstName(), $addr->getLastName());
} catch (\Exception $e) {
$view->emailIntro = $view->translate('client/html/email', 'Dear Sir or Madam');
}
$this->cache = $view;
}
return $this->cache;
}
示例2: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
if (($orderId = $view->param('his_id', null)) !== null) {
$context = $this->getContext();
$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
$search = $manager->createSearch(true);
$expr = array($search->getConditions(), $search->compare('==', 'order.id', $orderId), $search->compare('==', 'order.base.customerid', $context->getUserId()));
$search->setConditions($search->combine('&&', $expr));
$orderItems = $manager->searchItems($search);
if (($orderItem = reset($orderItems)) === false) {
$msg = $view->translate('client', 'Order with ID "%1$s" not found');
throw new \Aimeos\Client\Html\Exception(sprintf($msg, $orderId));
}
if ($orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus()) {
$view->summaryShowDownloadAttributes = true;
}
$view->summaryBasket = $baseManager->load($orderItem->getBaseId());
$view->summaryTaxRates = $this->getTaxRates($view->summaryBasket);
$view->orderItem = $orderItem;
}
$this->cache = $view;
}
return $this->cache;
}