Merge pull request #15649 from JMAConsulting/core-1346
[civicrm-core.git] / CRM / Core / Smarty / plugins / block.ts.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * CiviCRM's Smarty gettext plugin
14 *
15 * @package CRM
16 * @author Piotr Szotkowski <shot@caltha.pl>
17 * @author Michal Mach <mover@artnet.org>
18 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * $Id$
20 */
21
22 /**
23 * Smarty block function providing gettext support
24 *
25 * See CRM_Core_I18n class documentation for details.
26 *
27 * @param array $params
28 * Template call's parameters.
29 * @param string $text
30 * {ts} block contents from the template.
31 * @param CRM_Core_Smarty $smarty
32 * The Smarty object.
33 *
34 * @return string
35 * the string, translated by gettext
36 */
37 function smarty_block_ts($params, $text, &$smarty) {
38 if (!isset($params['domain'])) {
39 $params['domain'] = $smarty->get_template_vars('extensionKey');
40 }
41 return ts($text, $params);
42 }