3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
21 * Smarty block function for multilingualizing upgrade SQL queries.
22 * The string passed in $text is repeated locale-number times, with the
23 * param field (if provided) appended with a different locale every time.
25 * @param array $params
26 * Template call's parameters.
28 * {ts} block contents from the template.
29 * @param CRM_Core_Smarty $smarty
33 * multilingualized query
35 function smarty_block_localize($params, $text, &$smarty) {
36 if (!$smarty->_tpl_vars
['multilingual']) {
41 foreach ($smarty->_tpl_vars
['locales'] as $locale) {
43 if ($params['field']) {
44 $fields = explode(',', $params['field']);
45 foreach ($fields as $field) {
46 $field = trim($field);
47 $line = preg_replace('/\b' . preg_quote($field) . '\b/', "{$field}_{$locale}", $line);
53 return implode(', ', $lines);