From bc3364a970df20c136443da12e099520e7c3018a Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Sat, 25 Apr 2015 18:30:14 -0400 Subject: [PATCH] CRM-16359: Report templates title/description translation. --- CRM/Core/OptionGroup.php | 11 ++++++++++- CRM/Report/Page/Report.php | 4 ++-- CRM/Report/Page/TemplateList.php | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php index 06464c999c..7770090bd2 100644 --- a/CRM/Core/OptionGroup.php +++ b/CRM/Core/OptionGroup.php @@ -591,12 +591,14 @@ SELECT v.label * @param string $field * @param string $fieldType * @param bool $active + * @param bool $localize + * if true, localize the results before returning. * * @return array */ public static function getRowValues( $groupName, $fieldValue, $field = 'name', - $fieldType = 'String', $active = TRUE + $fieldType = 'String', $active = TRUE, $localize = FALSE ) { $query = " SELECT v.id, v.label, v.value, v.name, v.weight, v.description @@ -631,6 +633,13 @@ WHERE v.option_group_id = g.id $row[$fld] = $dao->$fld; } } + + if ($localize) { + foreach (array('label', 'description') as $f) { + $row[$f] = ts($row[$f]); + } + } + return $row; } diff --git a/CRM/Report/Page/Report.php b/CRM/Report/Page/Report.php index 8b4fa7e605..4c44953a4d 100644 --- a/CRM/Report/Page/Report.php +++ b/CRM/Report/Page/Report.php @@ -51,7 +51,7 @@ class CRM_Report_Page_Report extends CRM_Core_Page { $optionVal = CRM_Report_Utils_Report::getValueFromUrl(); $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value', - 'String', FALSE + 'String', FALSE, TRUE ); $extKey = strpos(CRM_Utils_Array::value('name', $templateInfo), '.'); @@ -65,7 +65,7 @@ class CRM_Report_Page_Report extends CRM_Core_Page { } if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form') || !is_null($reportClass)) { - CRM_Utils_System::setTitle($templateInfo['label'] . ' - Template'); + CRM_Utils_System::setTitle(ts('%1 - Template', array(1 => $templateInfo['label']))); $this->assign('reportTitle', $templateInfo['label']); $session = CRM_Core_Session::singleton(); diff --git a/CRM/Report/Page/TemplateList.php b/CRM/Report/Page/TemplateList.php index 60622cfd7f..94331c8667 100644 --- a/CRM/Report/Page/TemplateList.php +++ b/CRM/Report/Page/TemplateList.php @@ -93,8 +93,8 @@ LEFT JOIN civicrm_component comp ) { continue; } - $rows[$dao->component_name][$dao->value]['title'] = $dao->label; - $rows[$dao->component_name][$dao->value]['description'] = $dao->description; + $rows[$dao->component_name][$dao->value]['title'] = ts($dao->label); + $rows[$dao->component_name][$dao->value]['description'] = ts($dao->description); $rows[$dao->component_name][$dao->value]['url'] = CRM_Utils_System::url('civicrm/report/' . trim($dao->value, '/'), 'reset=1'); if ($dao->instance_id) { $rows[$dao->component_name][$dao->value]['instanceUrl'] = CRM_Utils_System::url('civicrm/report/list', -- 2.25.1