Skip to content

Commit

Permalink
Merge pull request #27776 from eileenmcnaughton/fix_localize
Browse files Browse the repository at this point in the history
Update smarty localize for Smarty3
  • Loading branch information
seamuslee001 authored Oct 11, 2023
2 parents 98be66a + db55cdd commit 746db66
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CRM/Core/Smarty/plugins/block.localize.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@
* @return string
* multilingualized query
*/
function smarty_block_localize($params, $text, &$smarty, &$repeat) {
function smarty_block_localize($params, $text, $smarty, &$repeat) {
if ($repeat) {
// For opening tag text is always null
return '';
}

if (!array_key_exists('multilingual', $smarty->_tpl_vars) || !$smarty->_tpl_vars['multilingual']) {
$multiLingual = method_exists($smarty, 'get_template_vars') ? $smarty->get_template_vars('multilingual') : $smarty->getTemplateVars('multilingual');
if (!$multiLingual) {
return $text;
}

$lines = [];
foreach ($smarty->_tpl_vars['locales'] as $locale) {
$locales = (array) (method_exists($smarty, 'get_template_vars') ? $smarty->get_template_vars('locales') : $smarty->getTemplateVars('locales'));
foreach ($locales as $locale) {
$line = $text;
if (isset($params['field'])) {
$fields = explode(',', $params['field']);
Expand Down

0 comments on commit 746db66

Please sign in to comment.