From 83adaedfb9b754d9915622b85f5f01cdf5f127e7 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 21 Jun 2023 16:55:26 -0700 Subject: [PATCH] (REF) Convert various `ts()` to `_ts()` --- CRM/Admin/Page/AJAX.php | 2 +- CRM/Core/BAO/Navigation.php | 2 +- CRM/Core/BAO/RecurringEntity.php | 2 +- CRM/Core/Form.php | 4 ++-- CRM/Core/Form/RecurringEntity.php | 2 +- CRM/Core/I18n.php | 4 ++-- CRM/Core/OptionGroup.php | 2 +- CRM/Core/Payment.php | 2 +- CRM/Core/Resources/CollectionAdderTrait.php | 2 +- CRM/Core/Smarty/plugins/block.ts.php | 2 +- CRM/Mailing/Event/BAO/MailingEventSubscribe.php | 2 +- CRM/Report/Form.php | 2 +- CRM/Report/Form/Contact/Relationship.php | 4 ++-- CRM/Report/Form/Contribute/Detail.php | 2 +- CRM/Report/Page/TemplateList.php | 4 ++-- CRM/Utils/Token.php | 2 +- Civi/Angular/Manager.php | 2 +- 17 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index e300e60add..1493c156c2 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -68,7 +68,7 @@ class CRM_Admin_Page_AJAX { $item['url'] = CRM_Utils_System::evalUrl(CRM_Core_BAO_Navigation::makeFullyFormedUrl($props['url'])); } if (!empty($props['label'])) { - $item['label'] = ts($props['label'], ['context' => 'menu']); + $item['label'] = _ts($props['label'], ['context' => 'menu']); } $item['name'] = !empty($props['name']) ? $props['name'] : CRM_Utils_String::munge(CRM_Utils_Array::value('label', $props)); if (!empty($item['child'])) { diff --git a/CRM/Core/BAO/Navigation.php b/CRM/Core/BAO/Navigation.php index 104c473175..6957381a8a 100644 --- a/CRM/Core/BAO/Navigation.php +++ b/CRM/Core/BAO/Navigation.php @@ -831,7 +831,7 @@ ORDER BY weight"; } $params = [ 'name' => $name, - 'label' => ts($name), + 'label' => _ts($name), 'url' => $url, 'parent_id' => $parent_id, 'is_active' => TRUE, diff --git a/CRM/Core/BAO/RecurringEntity.php b/CRM/Core/BAO/RecurringEntity.php index c34c25bdaf..10ff3b0ff6 100644 --- a/CRM/Core/BAO/RecurringEntity.php +++ b/CRM/Core/BAO/RecurringEntity.php @@ -1224,7 +1224,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity implemen return $this->recursion->getNextOccurrence($occurDate, $strictly_after); } catch (Exception $exception) { - CRM_Core_Session::setStatus(ts($exception->getMessage())); + CRM_Core_Session::setStatus(_ts($exception->getMessage())); } return FALSE; } diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index ad88b3b020..5909671c78 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1580,8 +1580,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { ); $attributes = ['formatType' => 'searchDate']; $extra = ['time' => $isDateTime]; - $this->add('datepicker', $fieldName . $from, ts($fromLabel), $attributes, $required, $extra); - $this->add('datepicker', $fieldName . $to, ts($toLabel), $attributes, $required, $extra); + $this->add('datepicker', $fieldName . $from, _ts($fromLabel), $attributes, $required, $extra); + $this->add('datepicker', $fieldName . $to, _ts($toLabel), $attributes, $required, $extra); } /** diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 52ba505fdc..62268018d0 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -96,7 +96,7 @@ class CRM_Core_Form_RecurringEntity { // Assign variables $entityType = CRM_Core_DAO_AllCoreTables::getEntityNameForTable($entityTable); $tpl = CRM_Core_Smarty::singleton(); - $tpl->assign('recurringEntityType', ts($entityType)); + $tpl->assign('recurringEntityType', _ts($entityType)); $tpl->assign('currentEntityId', self::$_entityId); $tpl->assign('entityTable', self::$_entityTable); $tpl->assign('scheduleReminderId', self::$_scheduleReminderID); diff --git a/CRM/Core/I18n.php b/CRM/Core/I18n.php index 2d6bd6f27a..6e307334ca 100644 --- a/CRM/Core/I18n.php +++ b/CRM/Core/I18n.php @@ -524,7 +524,7 @@ class CRM_Core_I18n { foreach ($array as & $value) { if ($value) { - $value = ts($value, $params); + $value = _ts($value, $params); } } } @@ -544,7 +544,7 @@ class CRM_Core_I18n { else { $key = (string) $key; if ($key == 'title' || $key == 'desc') { - $array[$key] = ts($value, ['context' => 'menu']); + $array[$key] = _ts($value, ['context' => 'menu']); } } } diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php index f3256090e7..cc06777ee1 100644 --- a/CRM/Core/OptionGroup.php +++ b/CRM/Core/OptionGroup.php @@ -543,7 +543,7 @@ WHERE v.option_group_id = g.id ] as $fld) { $row[$fld] = $dao->$fld; if ($localize && in_array($fld, ['label', 'description'])) { - $row[$fld] = ts($row[$fld]); + $row[$fld] = _ts($row[$fld]); } } } diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 2eeed7b063..8fe91d5c24 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -1670,7 +1670,7 @@ abstract class CRM_Core_Payment { if (!$extension_instance_found) { $message = "No extension instances of the '%1' payment processor were found.
" . "%2 method is unsupported in legacy payment processors."; - throw new CRM_Core_Exception(ts($message, [ + throw new CRM_Core_Exception(_ts($message, [ 1 => $params['processor_name'], 2 => $method, ])); diff --git a/CRM/Core/Resources/CollectionAdderTrait.php b/CRM/Core/Resources/CollectionAdderTrait.php index 71b394a427..5b563dc0b3 100644 --- a/CRM/Core/Resources/CollectionAdderTrait.php +++ b/CRM/Core/Resources/CollectionAdderTrait.php @@ -260,7 +260,7 @@ trait CRM_Core_Resources_CollectionAdderTrait { // TODO: Maybe this should be its own resource type to allow smarter management? foreach ((array) $text as $str) { - $translated = ts($str, [ + $translated = _ts($str, [ 'domain' => ($domain == 'civicrm') ? NULL : [$domain, NULL], 'raw' => TRUE, ]); diff --git a/CRM/Core/Smarty/plugins/block.ts.php b/CRM/Core/Smarty/plugins/block.ts.php index 6c1faeffd0..785122d36e 100644 --- a/CRM/Core/Smarty/plugins/block.ts.php +++ b/CRM/Core/Smarty/plugins/block.ts.php @@ -37,5 +37,5 @@ function smarty_block_ts($params, $text, &$smarty) { if (!isset($params['domain']) && $extensionKey = $smarty->get_template_vars('extensionKey')) { $params['domain'] = is_array($extensionKey) ? $extensionKey : [$extensionKey, NULL]; } - return ts($text, $params); + return _ts($text, $params); } diff --git a/CRM/Mailing/Event/BAO/MailingEventSubscribe.php b/CRM/Mailing/Event/BAO/MailingEventSubscribe.php index ecda0c8cce..30af618b88 100644 --- a/CRM/Mailing/Event/BAO/MailingEventSubscribe.php +++ b/CRM/Mailing/Event/BAO/MailingEventSubscribe.php @@ -347,7 +347,7 @@ SELECT civicrm_email.id as email_id $group[$groupID]['status'] = $contactGroups[$groupID]['status']; $status = ts('You are already subscribed in %1, your subscription is %2.', [ 1 => $group[$groupID]['title'], - 2 => ts($group[$groupID]['status']), + 2 => _ts($group[$groupID]['status']), ]); CRM_Utils_System::setUFMessage($status); continue; diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 5fad82f1bc..5fd255df0e 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -5577,7 +5577,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a 'addressee_display' => 'Addressee', ] as $field => $title) { $spec[$options['prefix'] . $field] = [ - 'title' => $options['prefix_label'] . ts($title), + 'title' => $options['prefix_label'] . _ts($title), 'name' => $field, 'is_fields' => TRUE, 'is_filters' => FALSE, diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index 6db13e2822..2cf7cbfa8b 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -752,13 +752,13 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { // Handle permissioned relationships if (array_key_exists('civicrm_relationship_is_permission_a_b', $row)) { $rows[$rowNum]['civicrm_relationship_is_permission_a_b'] - = ts(self::permissionedRelationship($row['civicrm_relationship_is_permission_a_b'])); + = _ts(self::permissionedRelationship($row['civicrm_relationship_is_permission_a_b'])); $entryFound = TRUE; } if (array_key_exists('civicrm_relationship_is_permission_b_a', $row)) { $rows[$rowNum]['civicrm_relationship_is_permission_b_a'] - = ts(self::permissionedRelationship($row['civicrm_relationship_is_permission_b_a'])); + = _ts(self::permissionedRelationship($row['civicrm_relationship_is_permission_b_a'])); $entryFound = TRUE; } diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index 04667ec3c4..e67fea4208 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -942,7 +942,7 @@ WHERE civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu $title = '%1 soft-credits: %2'; } foreach ($totals as $key => $total) { - $totalandsum[$key] = ts($title, [ + $totalandsum[$key] = _ts($title, [ 1 => $total, 2 => CRM_Utils_Money::format($sumcontribs[$key]), ]); diff --git a/CRM/Report/Page/TemplateList.php b/CRM/Report/Page/TemplateList.php index 2b69ada6f5..124adad7bf 100644 --- a/CRM/Report/Page/TemplateList.php +++ b/CRM/Report/Page/TemplateList.php @@ -74,8 +74,8 @@ LEFT JOIN civicrm_component comp ) { continue; } - $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]['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'); $rows[$dao->component_name][$dao->value]['instanceUrl'] = $dao->instance_id ? CRM_Utils_System::url( 'civicrm/report/list', diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 4101d9be3c..bc4bfd9838 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -1711,7 +1711,7 @@ class CRM_Utils_Token { else { $entity = 'Contact'; } - $sorted[ts($entity)][] = ['id' => $k, 'text' => $v]; + $sorted[_ts($entity)][] = ['id' => $k, 'text' => $v]; } } diff --git a/Civi/Angular/Manager.php b/Civi/Angular/Manager.php index 5be75c18aa..3fb77b0f5d 100644 --- a/Civi/Angular/Manager.php +++ b/Civi/Angular/Manager.php @@ -313,7 +313,7 @@ class Manager { foreach ($strings as $string) { // TODO: should we pass translation domain based on $module[ext] or $module[tsDomain]? // It doesn't look like client side really supports the domain right now... - $translated = ts($string, [ + $translated = _ts($string, [ 'domain' => [$module['ext'], NULL], ]); if ($translated != $string) { -- 2.25.1