Update translation template and fix incorrect use of ts()
This commit is contained in:
parent
2834f8028d
commit
fa301676e3
5 changed files with 862 additions and 274 deletions
|
@ -458,7 +458,7 @@ class CRM_Twingle_BAO_TwingleProduct extends CRM_Twingle_DAO_TwingleProduct {
|
||||||
}
|
}
|
||||||
catch (\Civi\Core\Exception\DBQueryException $e) {
|
catch (\Civi\Core\Exception\DBQueryException $e) {
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('Could not find TwingleProduct in database: ' . $e->getMessage()),
|
E::ts('Could not find TwingleProduct in database: %1', [1 => $e->getMessage()]),
|
||||||
ShopException::ERROR_CODE_COULD_NOT_FIND_SHOP_IN_DB);
|
ShopException::ERROR_CODE_COULD_NOT_FIND_SHOP_IN_DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,8 @@ class CRM_Twingle_BAO_TwingleProduct extends CRM_Twingle_DAO_TwingleProduct {
|
||||||
$twingle_product_values = $this->getAttributes();
|
$twingle_product_values = $this->getAttributes();
|
||||||
try {
|
try {
|
||||||
\CRM_Utils_Hook::pre($mode, 'TwingleProduct', $this->id, $twingle_product_values);
|
\CRM_Utils_Hook::pre($mode, 'TwingleProduct', $this->id, $twingle_product_values);
|
||||||
} catch (\Exception $e) {
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
$tx->rollback();
|
$tx->rollback();
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
@ -481,14 +482,15 @@ class CRM_Twingle_BAO_TwingleProduct extends CRM_Twingle_DAO_TwingleProduct {
|
||||||
// Save object to database
|
// Save object to database
|
||||||
try {
|
try {
|
||||||
$this->save();
|
$this->save();
|
||||||
} catch (\Exception $e) {
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
$tx->rollback();
|
$tx->rollback();
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('Could not save TwingleProduct to database: ' . $e->getMessage()),
|
E::ts('Could not save TwingleProduct to database: %1', [1 => $e->getMessage()]),
|
||||||
ProductException::ERROR_CODE_COULD_NOT_CREATE_PRODUCT);
|
ProductException::ERROR_CODE_COULD_NOT_CREATE_PRODUCT);
|
||||||
}
|
}
|
||||||
$result = self::findById($this->id);
|
$result = self::findById($this->id);
|
||||||
/* @var self $result */
|
/** @var self $result */
|
||||||
$this->load($result->getAttributes());
|
$this->load($result->getAttributes());
|
||||||
|
|
||||||
// Register post-hook
|
// Register post-hook
|
||||||
|
@ -629,7 +631,7 @@ class CRM_Twingle_BAO_TwingleProduct extends CRM_Twingle_DAO_TwingleProduct {
|
||||||
}
|
}
|
||||||
catch (CRM_Core_Exception $e) {
|
catch (CRM_Core_Exception $e) {
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('An Error occurred while searching for the associated PriceFieldValue: ' . $e->getMessage()),
|
E::ts('An Error occurred while searching for the associated PriceFieldValue: %1', [1 => $e->getMessage()]),
|
||||||
ProductException::ERROR_CODE_PRICE_FIELD_VALUE_NOT_FOUND);
|
ProductException::ERROR_CODE_PRICE_FIELD_VALUE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -637,7 +639,7 @@ class CRM_Twingle_BAO_TwingleProduct extends CRM_Twingle_DAO_TwingleProduct {
|
||||||
}
|
}
|
||||||
catch (CRM_Core_Exception $e) {
|
catch (CRM_Core_Exception $e) {
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('Could not delete associated PriceFieldValue: ' . $e->getMessage()),
|
E::ts('Could not delete associated PriceFieldValue: %1', [1 => $e->getMessage()]),
|
||||||
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_FIELD_VALUE);
|
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_FIELD_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,13 +663,14 @@ class CRM_Twingle_BAO_TwingleProduct extends CRM_Twingle_DAO_TwingleProduct {
|
||||||
}
|
}
|
||||||
catch (CRM_Core_Exception $e) {
|
catch (CRM_Core_Exception $e) {
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('An Error occurred while searching for the associated PriceField: ' . $e->getMessage()),
|
E::ts('An Error occurred while searching for the associated PriceField: %1', [1 => $e->getMessage()]),
|
||||||
ProductException::ERROR_CODE_PRICE_FIELD_NOT_FOUND);
|
ProductException::ERROR_CODE_PRICE_FIELD_NOT_FOUND);
|
||||||
}
|
}
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('Could not delete associated PriceField: ' . $e->getMessage()),
|
E::ts('Could not delete associated PriceField: %1', [1 => $e->getMessage()]),
|
||||||
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_FIELD);
|
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_FIELD);
|
||||||
}
|
}
|
||||||
$this->price_field_id = NULL;
|
$this->price_field_id = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,9 +147,10 @@ class CRM_Twingle_BAO_TwingleShop extends CRM_Twingle_DAO_TwingleShop {
|
||||||
if ($dao->fetch()) {
|
if ($dao->fetch()) {
|
||||||
$this->load($dao->toArray());
|
$this->load($dao->toArray());
|
||||||
}
|
}
|
||||||
} catch (\Civi\Core\Exception\DBQueryException $e) {
|
}
|
||||||
|
catch (\Civi\Core\Exception\DBQueryException $e) {
|
||||||
throw new ShopException(
|
throw new ShopException(
|
||||||
E::ts('Could not find TwingleShop in database: ' . $e->getMessage()),
|
E::ts('Could not find TwingleShop in database: %1', [1 => $e->getMessage()]),
|
||||||
ShopException::ERROR_CODE_COULD_NOT_FIND_SHOP_IN_DB);
|
ShopException::ERROR_CODE_COULD_NOT_FIND_SHOP_IN_DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ class CRM_Twingle_BAO_TwingleShop extends CRM_Twingle_DAO_TwingleShop {
|
||||||
catch (\CRM_Core_Exception $e) {
|
catch (\CRM_Core_Exception $e) {
|
||||||
if ($e->getMessage() != 'Expected one PriceSet but found 0') {
|
if ($e->getMessage() != 'Expected one PriceSet but found 0') {
|
||||||
throw new ShopException(
|
throw new ShopException(
|
||||||
E::ts('Could not find associated PriceSet: ' . $e->getMessage()),
|
E::ts('Could not find associated PriceSet: %1', [1 => $e->getMessage()]),
|
||||||
ShopException::ERROR_CODE_PRICE_SET_NOT_FOUND);
|
ShopException::ERROR_CODE_PRICE_SET_NOT_FOUND);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -207,7 +208,7 @@ class CRM_Twingle_BAO_TwingleShop extends CRM_Twingle_DAO_TwingleShop {
|
||||||
['id' => $this->price_set_id]);
|
['id' => $this->price_set_id]);
|
||||||
} catch (\CRM_Core_Exception $e) {
|
} catch (\CRM_Core_Exception $e) {
|
||||||
throw new ShopException(
|
throw new ShopException(
|
||||||
E::ts('Could not delete associated PriceSet: ' . $e->getMessage()),
|
E::ts('Could not delete associated PriceSet: %1', [1 => $e->getMessage()]),
|
||||||
ShopException::ERROR_CODE_COULD_NOT_DELETE_PRICE_SET);
|
ShopException::ERROR_CODE_COULD_NOT_DELETE_PRICE_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,9 +452,10 @@ class CRM_Twingle_BAO_TwingleShop extends CRM_Twingle_DAO_TwingleShop {
|
||||||
public function deleteProducts() {
|
public function deleteProducts() {
|
||||||
try {
|
try {
|
||||||
$products = $this->getProducts();
|
$products = $this->getProducts();
|
||||||
} catch (\Civi\Core\Exception\DBQueryException $e) {
|
}
|
||||||
|
catch (\Civi\Core\Exception\DBQueryException $e) {
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('Could not retrieve associated products: ' . $e->getMessage()),
|
E::ts('Could not retrieve associated products: %1', [1 => $e->getMessage()]),
|
||||||
ProductException::ERROR_CODE_COULD_NOT_GET_PRODUCTS
|
ProductException::ERROR_CODE_COULD_NOT_GET_PRODUCTS
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -464,8 +466,8 @@ class CRM_Twingle_BAO_TwingleShop extends CRM_Twingle_DAO_TwingleShop {
|
||||||
}
|
}
|
||||||
catch (ProductException $e) {
|
catch (ProductException $e) {
|
||||||
throw new ProductException(
|
throw new ProductException(
|
||||||
E::ts('Could not delete associated products: ' . $e->getMessage()),
|
E::ts('Could not delete associated products: %1', [1 => $e->getMessage()]),
|
||||||
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_SET
|
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_SET,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -648,8 +648,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
if (!isset($profile_data[$key]) && $required) {
|
if (!isset($profile_data[$key]) && $required) {
|
||||||
CRM_Core_Session::setStatus(
|
CRM_Core_Session::setStatus(
|
||||||
E::ts(
|
E::ts(
|
||||||
'The required configuration option "%1" has no value.'
|
'The required configuration option "%1" has no value. Saving the profile might set this option to a possibly unwanted default value.',
|
||||||
. ' Saving the profile might set this option to a possibly unwanted default value.',
|
|
||||||
[1 => $metadata['label'] ?? $key]
|
[1 => $metadata['label'] ?? $key]
|
||||||
),
|
),
|
||||||
E::ts('Error'),
|
E::ts('Error'),
|
||||||
|
|
|
@ -546,7 +546,7 @@ class CRM_Twingle_Submission {
|
||||||
if (!empty($line_item['is_error'])) {
|
if (!empty($line_item['is_error'])) {
|
||||||
$line_item_name = $line_item_data['name'];
|
$line_item_name = $line_item_data['name'];
|
||||||
throw new CiviCRM_API3_Exception(
|
throw new CiviCRM_API3_Exception(
|
||||||
E::ts("Could not create line item for product '$line_item_name'"),
|
E::ts("Could not create line item for product '%1'", [1 => $line_item_name]),
|
||||||
'api_error'
|
'api_error'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue