From: Mathieu Lutfy Date: Sun, 18 Jun 2023 19:29:13 +0000 (-0400) Subject: Misc ts fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=29a3fec272cd257822f846c8f593a8512f6ba9a6;p=civicrm-core.git Misc ts fixes --- diff --git a/CRM/Admin/Form/OptionGroup.php b/CRM/Admin/Form/OptionGroup.php index fbf87dfb07..31876b7909 100644 --- a/CRM/Admin/Form/OptionGroup.php +++ b/CRM/Admin/Form/OptionGroup.php @@ -108,7 +108,7 @@ class CRM_Admin_Form_OptionGroup extends CRM_Admin_Form { $name = CRM_Utils_String::titleToVar(strtolower($fields['title'])); } if (!CRM_Core_DAO::objectExists($name, 'CRM_Core_DAO_OptionGroup', $self->_id)) { - $errors['title'] = ts('Option Group name ' . $name . ' already exists in the database. Option Group Names need to be unique'); + $errors['title'] = ts("Option Group name '%1' already exists in the database. Option Group Names must be unique.", [1 => $name]); } return empty($errors) ? TRUE : $errors; } diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index d6c875142a..6ebc10a0ea 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4261,7 +4261,7 @@ WHERE $smartGroupClause // Description if (!empty($description[2]) && trim($description[2])) { - $this->_qill[$grouping][] = ts('Relationship description - ' . $description[2]); + $this->_qill[$grouping][] = ts('Relationship description - %1', [1 => $description[2]]); $description = CRM_Core_DAO::escapeString(trim($description[2])); $where[$grouping][] = "civicrm_relationship.description LIKE '%{$description}%'"; } diff --git a/CRM/Financial/BAO/EntityFinancialAccount.php b/CRM/Financial/BAO/EntityFinancialAccount.php index 283247a516..f7ba3dd7cd 100644 --- a/CRM/Financial/BAO/EntityFinancialAccount.php +++ b/CRM/Financial/BAO/EntityFinancialAccount.php @@ -267,10 +267,7 @@ class CRM_Financial_BAO_EntityFinancialAccount extends CRM_Financial_DAO_EntityF $financialAccountType = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $financialTypeAccount->financial_account_id, 'financial_account_type_id'); if (CRM_Utils_Array::value($financialTypeAccount->account_relationship, $financialAccountLinks) != $financialAccountType) { $accountRelationships = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship'); - $params = [ - 1 => $accountRelationships[$financialTypeAccount->account_relationship], - ]; - throw new CRM_Core_Exception(ts("This financial account cannot have '%1' relationship.", $params)); + throw new CRM_Core_Exception(ts("This financial account cannot have '%1' relationship.", [1 => $accountRelationships[$financialTypeAccount->account_relationship]])); } } diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 303af17141..f5d2bf8999 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -298,7 +298,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { 'now', $excludeIsAdmin, $params['membership_type_id'] ?? NULL, $params ); if (empty($calcStatus)) { - throw new CRM_Core_Exception(ts("The membership cannot be saved because the status cannot be calculated for start_date: {$params['start_date']} end_date {$params['end_date']} join_date {$params['join_date']} as at " . CRM_Utils_Time::date('Y-m-d H:i:s'))); + throw new CRM_Core_Exception(ts("The membership cannot be saved because the status cannot be calculated for start_date: %1, end_date: %2, join_date: %3. Current time is: %4.", [1 => $params['start_date'], 2 => $params['end_date'], 3 => $params['join_date'], 4 => CRM_Utils_Time::date('Y-m-d H:i:s')])); } $params['status_id'] = $calcStatus['id']; } diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index 6019750b5e..04667ec3c4 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -935,14 +935,10 @@ WHERE civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu // ts exception to avoid having ts("%1 %2: %3") $title = '%1 contributions / soft-credits: %2'; - if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == - 'contributions_only' - ) { + if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only') { $title = '%1 contributions: %2'; } - elseif (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == - 'soft_credits_only' - ) { + elseif (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'soft_credits_only') { $title = '%1 soft-credits: %2'; } foreach ($totals as $key => $total) { diff --git a/CRM/Upgrade/Incremental/php/FiveFiftyOne.php b/CRM/Upgrade/Incremental/php/FiveFiftyOne.php index 2c4a34dd0c..0b31540361 100644 --- a/CRM/Upgrade/Incremental/php/FiveFiftyOne.php +++ b/CRM/Upgrade/Incremental/php/FiveFiftyOne.php @@ -106,9 +106,9 @@ class CRM_Upgrade_Incremental_php_FiveFiftyOne extends CRM_Upgrade_Incremental_B } $fieldMap[ts('Soft Credit')] = 'soft_credit'; $fieldMap[ts('Pledge Payment')] = 'pledge_payment'; - $fieldMap[ts(ts('Pledge ID'))] = 'pledge_id'; - $fieldMap[ts(ts('Financial Type'))] = 'financial_type_id'; - $fieldMap[ts(ts('Payment Method'))] = 'payment_instrument_id'; + $fieldMap[ts('Pledge ID')] = 'pledge_id'; + $fieldMap[ts('Financial Type')] = 'financial_type_id'; + $fieldMap[ts('Payment Method')] = 'payment_instrument_id'; $fieldMap[ts('- do not import -')] = 'do_not_import'; // Membership fields diff --git a/CRM/Utils/Check/Component/AddressParsing.php b/CRM/Utils/Check/Component/AddressParsing.php index 0d42a1771c..02d63d94d9 100644 --- a/CRM/Utils/Check/Component/AddressParsing.php +++ b/CRM/Utils/Check/Component/AddressParsing.php @@ -31,16 +31,11 @@ class CRM_Utils_Check_Component_AddressParsing extends CRM_Utils_Check_Component if ($addressOptions['street_address_parsing']) { if (!CRM_Core_BAO_Address::isSupportedParsingLocale()) { $config = CRM_Core_Config::singleton(); + $url_address = CRM_Utils_System::url('civicrm/admin/setting/preferences/address', 'reset=1'); + $url_localization = CRM_Utils_System::url('civicrm/admin/setting/localization', 'reset=1'); $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts( - 'Street address parsing is enabled but not supported by your locale (%1).', - [1 => $config->lcMessages] - ), + ts('Street address parsing is enabled but not supported by your language settings (%3).', [1 => "href='$url_address'", 2 => "href='$url_localization'", 3 => $config->lcMessages]), ts('Street address parsing'), \Psr\Log\LogLevel::WARNING, 'fa-address-card' diff --git a/CRM/Utils/Check/Component/Case.php b/CRM/Utils/Check/Component/Case.php index d6b4c11488..bd9f757c35 100644 --- a/CRM/Utils/Check/Component/Case.php +++ b/CRM/Utils/Check/Component/Case.php @@ -361,17 +361,15 @@ class CRM_Utils_Check_Component_Case extends CRM_Utils_Check_Component { } $messages[] = new CRM_Utils_Check_Message( __FUNCTION__ . "missingroles", - ts("

The following roles listed in your case type definitions do not match any relationship type defined in the system: %1.

" - . "

This might be because of a mismatch if you are using external xml files to manage case types. If using xml files, then use either the name_a_b or name_b_a value from the following table. (Out of the box you would use name_b_a, which lists them on the case from the client perspective.) If you are not using xml files, you can edit your case types at Administer - CiviCase - Case Types.

" - . " - " + '

' . ts("The following roles listed in your case type definitions do not match any relationship type defined in the system: %1.", [1 => htmlspecialchars(implode(', ', $missing))]) . '

' + . "

" . ts("This might be because of a mismatch if you are using external xml files to manage case types. If using xml files, then use either the name_a_b or name_b_a value from the following table. (Out of the box you would use name_b_a, which lists them on the case from the client perspective.) If you are not using xml files, you can edit your case types at Administer - CiviCase - Case Types.") . '

' + . '
IDname_a_bname_b_alabel_a_blabel_b_a
' + . '' . implode("\n", $tableRows) - . "
IDname_a_bname_b_alabel_a_blabel_b_a
", [ - 1 => htmlspecialchars(implode(', ', $missing)), - ]) . - '
' . - ts('Read more about this warning') . - '', + . '' + . '
' + . ts('Read more about this warning') + . '', ts('Missing Roles'), \Psr\Log\LogLevel::ERROR, 'fa-exclamation' diff --git a/CRM/Utils/Check/Component/PriceFields.php b/CRM/Utils/Check/Component/PriceFields.php index 03816c98fe..b73cc48393 100644 --- a/CRM/Utils/Check/Component/PriceFields.php +++ b/CRM/Utils/Check/Component/PriceFields.php @@ -39,17 +39,17 @@ class CRM_Utils_Check_Component_PriceFields extends CRM_Utils_Check_Component { 'action' => 'browse', 'sid' => $dao->ps_id, ]); - $html .= "$dao->ps_title$dao->psf_labelView Price Set Fields"; + $html .= "$dao->ps_title$dao->psf_label" . ts('View Price Set Fields') . ''; } if ($count > 0) { - $msg = "

the following Price Set Fields use disabled or invalid financial types and need to be fixed if they are to still be used.

-

- - $html -
Price SetPrice Set FieldAction Link

"; + $msg = '

' . ts('The following Price Set Fields use disabled or invalid financial types and need to be fixed if they are to still be used.') . '

' + . '

' + . '' + . $html + . '
' . ts('Price Set') . '' . ts('Price Set Field') . '' . ts('Action') . '

'; $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts($msg), + $msg, ts('Invalid Price Fields'), \Psr\Log\LogLevel::WARNING, 'fa-lock' diff --git a/CRM/Utils/Check/Component/Schema.php b/CRM/Utils/Check/Component/Schema.php index da26ccc5e2..ac67ebb449 100644 --- a/CRM/Utils/Check/Component/Schema.php +++ b/CRM/Utils/Check/Component/Schema.php @@ -38,14 +38,14 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component { $html .= "{$tableName}{$index['name']}$fields"; } } - $message = "

The following tables have missing indices. Click 'Update Indices' button to create them.

-

- - $html -
Table NameKey NameExpected Indices

"; + $message = '

' . ts("The following tables have missing indices. Click 'Update Indices' button to create them.") . '

' + . '

' + . '' + . $html + . '
' . ts('Table Name') . '' . ts('Key Name') . '' . ts('Expected Indices') . '

'; $msg = new CRM_Utils_Check_Message( __FUNCTION__, - ts($message), + $message, ts('Performance warning: Missing indices'), \Psr\Log\LogLevel::WARNING, 'fa-server' diff --git a/CRM/Utils/Check/Component/Security.php b/CRM/Utils/Check/Component/Security.php index f4852db380..90510c8e62 100644 --- a/CRM/Utils/Check/Component/Security.php +++ b/CRM/Utils/Check/Component/Security.php @@ -75,12 +75,12 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component { $log_url = implode($filePathMarker, $url); if ($this->fileExists($log_url)) { $docs_url = $this->createDocUrl('the-log-file-should-not-be-accessible'); - $msg = 'The CiviCRM debug log should not be downloadable.' - . '
' . - 'Read more about this warning'; + $msg = ts('The CiviCRM debug log should not be downloadable.', [1 => "href='$log_url'"]) + . '
' + . '' . ts('Read more about this warning') . ''; $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts($msg, [1 => $log_url, 2 => $docs_url]), + $msg, ts('Security Warning'), \Psr\Log\LogLevel::WARNING, 'fa-lock' diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index 87087711d0..510718060b 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -391,7 +391,7 @@ class CRM_Utils_Type { 'Color', ]; if (!in_array($type, $possibleTypes)) { - throw new CRM_Core_Exception(ts('Invalid type, must be one of : ' . implode($possibleTypes))); + throw new CRM_Core_Exception('Invalid type, must be one of : ' . implode($possibleTypes)); } switch ($type) { case 'Integer':