Commit 3e0c966c503 for woocommerce

commit 3e0c966c503cf0f4ddc945bfff19ba443a47c14f
Author: Vasily Belolapotkov <vasily.belolapotkov@automattic.com>
Date:   Wed Oct 21 15:12:28 2026 +0200

    Use the woocommerce text domain in the subscriptions engine (#70067)

    Use the woocommerce text domain in the subscriptions engine

    - Switch the engine's 61 translation calls from the woocommerce-subscriptions-engine domain to woocommerce, as other bundled packages do
    - Keep the woocommerce-subscriptions-engine logger sources unchanged

diff --git a/packages/php/woocommerce-subscriptions-engine/changelog/update-subscriptions-engine-text-domain b/packages/php/woocommerce-subscriptions-engine/changelog/update-subscriptions-engine-text-domain
new file mode 100644
index 00000000000..872feb1a697
--- /dev/null
+++ b/packages/php/woocommerce-subscriptions-engine/changelog/update-subscriptions-engine-text-domain
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Use the woocommerce text domain for the subscriptions engine strings, as the engine ships inside WooCommerce.
diff --git a/packages/php/woocommerce-subscriptions-engine/src/Api/ContractLock.php b/packages/php/woocommerce-subscriptions-engine/src/Api/ContractLock.php
index 6103a1f1eba..2bb6b2b10ce 100644
--- a/packages/php/woocommerce-subscriptions-engine/src/Api/ContractLock.php
+++ b/packages/php/woocommerce-subscriptions-engine/src/Api/ContractLock.php
@@ -62,7 +62,7 @@ final class ContractLock implements Serializable {
 	 */
 	public function __construct( int $contract_id, string $operation, string $token ) {
 		if ( ! self::is_called_by_repository() ) {
-			_doing_it_wrong( __METHOD__, esc_html__( 'Take a contract lock with Contracts::lock() or Contracts::create(); a lock built from a stored token bypasses the lock lifetime.', 'woocommerce-subscriptions-engine' ), '0.0.1' );
+			_doing_it_wrong( __METHOD__, esc_html__( 'Take a contract lock with Contracts::lock() or Contracts::create(); a lock built from a stored token bypasses the lock lifetime.', 'woocommerce' ), '0.0.1' );
 		}

 		$this->contract_id = $contract_id;
@@ -90,7 +90,7 @@ final class ContractLock implements Serializable {
 	 */
 	public function get_state(): ContractLockState {
 		if ( ! self::is_called_by_repository() ) {
-			_doing_it_wrong( __METHOD__, esc_html__( 'The lock state is engine-only; pass the lock to Contracts write methods instead.', 'woocommerce-subscriptions-engine' ), '0.0.1' );
+			_doing_it_wrong( __METHOD__, esc_html__( 'The lock state is engine-only; pass the lock to Contracts write methods instead.', 'woocommerce' ), '0.0.1' );
 		}

 		return $this->state;
diff --git a/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/ContractsController.php b/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/ContractsController.php
index 684df422e8c..e1b20417c08 100644
--- a/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/ContractsController.php
+++ b/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/ContractsController.php
@@ -95,7 +95,7 @@ final class ContractsController extends WP_REST_Controller {
 			array(
 				'args'   => array(
 					'id' => array(
-						'description' => __( 'Unique identifier for the contract.', 'woocommerce-subscriptions-engine' ),
+						'description' => __( 'Unique identifier for the contract.', 'woocommerce' ),
 						'type'        => 'integer',
 					),
 				),
@@ -117,7 +117,7 @@ final class ContractsController extends WP_REST_Controller {
 			array(
 				'args' => array(
 					'id' => array(
-						'description' => __( 'Unique identifier for the contract.', 'woocommerce-subscriptions-engine' ),
+						'description' => __( 'Unique identifier for the contract.', 'woocommerce' ),
 						'type'        => 'integer',
 					),
 				),
@@ -132,17 +132,17 @@ final class ContractsController extends WP_REST_Controller {
 					'permission_callback' => array( $this, 'run_action_permissions_check' ),
 					'args'                => array(
 						'action'         => array(
-							'description' => __( 'Action to run.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Action to run.', 'woocommerce' ),
 							'type'        => 'string',
 							'required'    => true,
 						),
 						'extension_slug' => array(
-							'description' => __( 'Slug of the extension that owns the contract and registered the action.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Slug of the extension that owns the contract and registered the action.', 'woocommerce' ),
 							'type'        => 'string',
 							'required'    => true,
 						),
 						'action_args'    => array(
-							'description' => __( 'Arguments for the action, as its schema describes them.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Arguments for the action, as its schema describes them.', 'woocommerce' ),
 							'type'        => 'object',
 							'default'     => array(),
 						),
@@ -241,7 +241,7 @@ final class ContractsController extends WP_REST_Controller {
 			if ( ! ContractActionRegistry::is_available( $definition, $contract ) ) {
 				return new WP_Error(
 					'woocommerce_subscriptions_engine_action_not_available',
-					__( 'This action is not available for the contract.', 'woocommerce-subscriptions-engine' ),
+					__( 'This action is not available for the contract.', 'woocommerce' ),
 					array( 'status' => 409 )
 				);
 			}
@@ -346,29 +346,29 @@ final class ContractsController extends WP_REST_Controller {
 		}

 		$properties = array(
-			'id'                   => array( 'integer', __( 'Unique identifier for the contract.', 'woocommerce-subscriptions-engine' ) ),
-			'extension_slug'       => array( array( 'string', 'null' ), __( 'Slug of the extension that owns the contract.', 'woocommerce-subscriptions-engine' ) ),
-			'status'               => array( 'string', __( 'Contract status slug.', 'woocommerce-subscriptions-engine' ) ),
-			'customer_id'          => array( array( 'integer', 'null' ), __( 'Customer user ID.', 'woocommerce-subscriptions-engine' ) ),
-			'currency'             => array( array( 'string', 'null' ), __( 'Currency code.', 'woocommerce-subscriptions-engine' ) ),
-			'selling_plan_id'      => array( array( 'integer', 'null' ), __( 'Plan ID.', 'woocommerce-subscriptions-engine' ) ),
-			'origin_order_id'      => array( array( 'integer', 'null' ), __( 'ID of the order the contract started from.', 'woocommerce-subscriptions-engine' ) ),
-			'payment_method'       => array( array( 'string', 'null' ), __( 'Payment gateway ID.', 'woocommerce-subscriptions-engine' ) ),
-			'payment_method_title' => array( array( 'string', 'null' ), __( 'Payment method title.', 'woocommerce-subscriptions-engine' ) ),
-			'payment_token_id'     => array( array( 'integer', 'null' ), __( 'Payment token ID.', 'woocommerce-subscriptions-engine' ) ),
-			'start_gmt'            => array( array( 'string', 'null' ), __( 'Start date, as GMT.', 'woocommerce-subscriptions-engine' ) ),
-			'next_payment_gmt'     => array( array( 'string', 'null' ), __( 'Next-due moment, as GMT.', 'woocommerce-subscriptions-engine' ) ),
-			'last_payment_gmt'     => array( array( 'string', 'null' ), __( 'Last payment date, as GMT.', 'woocommerce-subscriptions-engine' ) ),
-			'last_attempt_gmt'     => array( array( 'string', 'null' ), __( 'Last payment attempt date, as GMT.', 'woocommerce-subscriptions-engine' ) ),
-			'trial_end_gmt'        => array( array( 'string', 'null' ), __( 'Trial end date, as GMT.', 'woocommerce-subscriptions-engine' ) ),
-			'end_gmt'              => array( array( 'string', 'null' ), __( 'End date, as GMT.', 'woocommerce-subscriptions-engine' ) ),
-			'schedule_source'      => array( 'string', __( 'Who keeps the payment schedule.', 'woocommerce-subscriptions-engine' ) ),
-			'billing_total'        => array( 'string', __( 'Recurring total.', 'woocommerce-subscriptions-engine' ) ),
-			'discount_total'       => array( 'string', __( 'Recurring discount total.', 'woocommerce-subscriptions-engine' ) ),
-			'shipping_total'       => array( 'string', __( 'Recurring shipping total.', 'woocommerce-subscriptions-engine' ) ),
-			'tax_total'            => array( 'string', __( 'Recurring tax total.', 'woocommerce-subscriptions-engine' ) ),
-			'items'                => array( 'array', __( 'Line items.', 'woocommerce-subscriptions-engine' ) ),
-			'addresses'            => array( 'object', __( 'Billing and shipping addresses.', 'woocommerce-subscriptions-engine' ) ),
+			'id'                   => array( 'integer', __( 'Unique identifier for the contract.', 'woocommerce' ) ),
+			'extension_slug'       => array( array( 'string', 'null' ), __( 'Slug of the extension that owns the contract.', 'woocommerce' ) ),
+			'status'               => array( 'string', __( 'Contract status slug.', 'woocommerce' ) ),
+			'customer_id'          => array( array( 'integer', 'null' ), __( 'Customer user ID.', 'woocommerce' ) ),
+			'currency'             => array( array( 'string', 'null' ), __( 'Currency code.', 'woocommerce' ) ),
+			'selling_plan_id'      => array( array( 'integer', 'null' ), __( 'Plan ID.', 'woocommerce' ) ),
+			'origin_order_id'      => array( array( 'integer', 'null' ), __( 'ID of the order the contract started from.', 'woocommerce' ) ),
+			'payment_method'       => array( array( 'string', 'null' ), __( 'Payment gateway ID.', 'woocommerce' ) ),
+			'payment_method_title' => array( array( 'string', 'null' ), __( 'Payment method title.', 'woocommerce' ) ),
+			'payment_token_id'     => array( array( 'integer', 'null' ), __( 'Payment token ID.', 'woocommerce' ) ),
+			'start_gmt'            => array( array( 'string', 'null' ), __( 'Start date, as GMT.', 'woocommerce' ) ),
+			'next_payment_gmt'     => array( array( 'string', 'null' ), __( 'Next-due moment, as GMT.', 'woocommerce' ) ),
+			'last_payment_gmt'     => array( array( 'string', 'null' ), __( 'Last payment date, as GMT.', 'woocommerce' ) ),
+			'last_attempt_gmt'     => array( array( 'string', 'null' ), __( 'Last payment attempt date, as GMT.', 'woocommerce' ) ),
+			'trial_end_gmt'        => array( array( 'string', 'null' ), __( 'Trial end date, as GMT.', 'woocommerce' ) ),
+			'end_gmt'              => array( array( 'string', 'null' ), __( 'End date, as GMT.', 'woocommerce' ) ),
+			'schedule_source'      => array( 'string', __( 'Who keeps the payment schedule.', 'woocommerce' ) ),
+			'billing_total'        => array( 'string', __( 'Recurring total.', 'woocommerce' ) ),
+			'discount_total'       => array( 'string', __( 'Recurring discount total.', 'woocommerce' ) ),
+			'shipping_total'       => array( 'string', __( 'Recurring shipping total.', 'woocommerce' ) ),
+			'tax_total'            => array( 'string', __( 'Recurring tax total.', 'woocommerce' ) ),
+			'items'                => array( 'array', __( 'Line items.', 'woocommerce' ) ),
+			'addresses'            => array( 'object', __( 'Billing and shipping addresses.', 'woocommerce' ) ),
 		);

 		$schema_properties = array();
@@ -461,7 +461,7 @@ final class ContractsController extends WP_REST_Controller {
 	private function get_not_found_error(): WP_Error {
 		return new WP_Error(
 			'woocommerce_subscriptions_engine_contract_not_found',
-			__( 'Contract not found.', 'woocommerce-subscriptions-engine' ),
+			__( 'Contract not found.', 'woocommerce' ),
 			array( 'status' => 404 )
 		);
 	}
@@ -553,7 +553,7 @@ final class ContractsController extends WP_REST_Controller {

 		return new WP_Error(
 			'woocommerce_subscriptions_engine_action_failed',
-			__( 'The action could not be completed.', 'woocommerce-subscriptions-engine' ),
+			__( 'The action could not be completed.', 'woocommerce' ),
 			array( 'status' => 500 )
 		);
 	}
diff --git a/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/PlansController.php b/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/PlansController.php
index f7e819c11bc..f3454b8693b 100644
--- a/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/PlansController.php
+++ b/packages/php/woocommerce-subscriptions-engine/src/Api/Rest/PlansController.php
@@ -126,42 +126,42 @@ final class PlansController extends WP_REST_Controller {
 					'permission_callback' => array( $this, 'permissions_check' ),
 					'args'                => array(
 						'extension_slug' => array(
-							'description' => __( 'Extension slug or comma-separated list of slugs for the plan query. Use "any" to query all slugs.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Extension slug or comma-separated list of slugs for the plan query. Use "any" to query all slugs.', 'woocommerce' ),
 							'type'        => 'string',
 							'required'    => true,
 						),
 						'page'           => array(
-							'description' => __( 'Page number for the plan query.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Page number for the plan query.', 'woocommerce' ),
 							'type'        => 'integer',
 							'required'    => false,
 						),
 						'per_page'       => array(
-							'description' => __( 'Number of plans per page for the plan query.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Number of plans per page for the plan query.', 'woocommerce' ),
 							'type'        => 'integer',
 							'required'    => false,
 							'default'     => self::DEFAULT_PER_PAGE,
 						),
 						'search'         => array(
-							'description' => __( 'Search term for the plan query.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Search term for the plan query.', 'woocommerce' ),
 							'type'        => 'string',
 							'required'    => false,
 						),
 						'status'         => array(
-							'description'       => __( 'Status of the plans to query (any registered plan status).', 'woocommerce-subscriptions-engine' ),
+							'description'       => __( 'Status of the plans to query (any registered plan status).', 'woocommerce' ),
 							'type'              => 'string',
 							'required'          => false,
 							// get_items() checks it, so its refusal carries the `errors` map.
 							'sanitize_callback' => null,
 						),
 						'orderby'        => array(
-							'description' => __( 'Order by field for the plan query.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Order by field for the plan query.', 'woocommerce' ),
 							'type'        => 'string',
 							'required'    => false,
 							'enum'        => self::ORDERBY,
 							'default'     => 'id',
 						),
 						'order'          => array(
-							'description' => __( 'Order direction for the plan query.', 'woocommerce-subscriptions-engine' ),
+							'description' => __( 'Order direction for the plan query.', 'woocommerce' ),
 							'type'        => 'string',
 							'required'    => false,
 							'enum'        => array( 'asc', 'desc' ),
@@ -185,7 +185,7 @@ final class PlansController extends WP_REST_Controller {
 			array(
 				'args'   => array(
 					'id' => array(
-						'description' => __( 'Unique identifier for the plan.', 'woocommerce-subscriptions-engine' ),
+						'description' => __( 'Unique identifier for the plan.', 'woocommerce' ),
 						'type'        => 'integer',
 					),
 				),
@@ -384,7 +384,7 @@ final class PlansController extends WP_REST_Controller {
 	public function get_collection_params(): array {
 		return array(
 			'page'     => array(
-				'description'       => __( 'Current page of the collection.', 'woocommerce-subscriptions-engine' ),
+				'description'       => __( 'Current page of the collection.', 'woocommerce' ),
 				'type'              => 'integer',
 				'default'           => 1,
 				'minimum'           => 1,
@@ -392,7 +392,7 @@ final class PlansController extends WP_REST_Controller {
 				'validate_callback' => 'rest_validate_request_arg',
 			),
 			'per_page' => array(
-				'description'       => __( 'Maximum number of items to be returned in result set.', 'woocommerce-subscriptions-engine' ),
+				'description'       => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
 				'type'              => 'integer',
 				'default'           => self::DEFAULT_PER_PAGE,
 				'minimum'           => 1,
@@ -401,24 +401,24 @@ final class PlansController extends WP_REST_Controller {
 				'validate_callback' => 'rest_validate_request_arg',
 			),
 			'search'   => array(
-				'description'       => __( 'Search term.', 'woocommerce-subscriptions-engine' ),
+				'description'       => __( 'Search term.', 'woocommerce' ),
 				'type'              => 'string',
 				'sanitize_callback' => 'sanitize_text_field',
 			),
 			'status'   => array(
-				'description'       => __( 'Limit result set to plans with a registered plan status.', 'woocommerce-subscriptions-engine' ),
+				'description'       => __( 'Limit result set to plans with a registered plan status.', 'woocommerce' ),
 				'type'              => 'string',
 				'sanitize_callback' => null,
 			),
 			'orderby'  => array(
-				'description'       => __( 'Sort collection by object attribute.', 'woocommerce-subscriptions-engine' ),
+				'description'       => __( 'Sort collection by object attribute.', 'woocommerce' ),
 				'type'              => 'string',
 				'default'           => 'id',
 				'enum'              => self::ORDERBY,
 				'sanitize_callback' => 'sanitize_key',
 			),
 			'order'    => array(
-				'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce-subscriptions-engine' ),
+				'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
 				'type'              => 'string',
 				'default'           => 'asc',
 				'enum'              => array( 'asc', 'desc' ),
@@ -444,55 +444,55 @@ final class PlansController extends WP_REST_Controller {
 			'type'       => 'object',
 			'properties' => array(
 				'id'               => array(
-					'description' => __( 'Unique identifier for the plan.', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Unique identifier for the plan.', 'woocommerce' ),
 					'type'        => 'integer',
 					'context'     => array( 'view' ),
 					'readonly'    => true,
 				),
 				'extension_slug'   => array(
-					'description' => __( 'Owning extension slug.', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Owning extension slug.', 'woocommerce' ),
 					'type'        => array( 'string', 'null' ),
 					'context'     => array( 'view', 'edit' ),
 					'arg_options' => self::UNCHECKED_ARG_OPTIONS,
 				),
 				'status'           => array(
-					'description' => __( 'Plan status (any registered plan status).', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Plan status (any registered plan status).', 'woocommerce' ),
 					'type'        => 'string',
 					'context'     => array( 'view', 'edit' ),
 					'arg_options' => self::UNCHECKED_ARG_OPTIONS,
 				),
 				'name'             => array(
-					'description' => __( 'Display name.', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Display name.', 'woocommerce' ),
 					'type'        => 'string',
 					'context'     => array( 'view', 'edit' ),
 					'arg_options' => self::UNCHECKED_ARG_OPTIONS,
 				),
 				'billing_policy'   => array(
-					'description' => __( 'Billing payload of the owning extension.', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Billing payload of the owning extension.', 'woocommerce' ),
 					'type'        => array( 'object', 'null' ),
 					'context'     => array( 'view', 'edit' ),
 					'arg_options' => self::UNCHECKED_ARG_OPTIONS,
 				),
 				'pricing_policy'   => array(
-					'description' => __( 'Pricing payload of the owning extension.', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Pricing payload of the owning extension.', 'woocommerce' ),
 					'type'        => array( 'object', 'null' ),
 					'context'     => array( 'view', 'edit' ),
 					'arg_options' => self::UNCHECKED_ARG_OPTIONS,
 				),
 				'delivery_policy'  => array(
-					'description' => __( 'Delivery payload of the owning extension.', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Delivery payload of the owning extension.', 'woocommerce' ),
 					'type'        => array( 'object', 'null' ),
 					'context'     => array( 'view', 'edit' ),
 					'arg_options' => self::UNCHECKED_ARG_OPTIONS,
 				),
 				'date_created_gmt' => array(
-					'description' => __( 'Creation time (GMT).', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Creation time (GMT).', 'woocommerce' ),
 					'type'        => array( 'string', 'null' ),
 					'context'     => array( 'view' ),
 					'readonly'    => true,
 				),
 				'date_updated_gmt' => array(
-					'description' => __( 'Last update time (GMT).', 'woocommerce-subscriptions-engine' ),
+					'description' => __( 'Last update time (GMT).', 'woocommerce' ),
 					'type'        => array( 'string', 'null' ),
 					'context'     => array( 'view' ),
 					'readonly'    => true,
@@ -563,7 +563,7 @@ final class PlansController extends WP_REST_Controller {
 		if ( $e->getPrevious() instanceof \Throwable ) {
 			return new WP_Error(
 				'woocommerce_subscriptions_engine_plan_validation_failed',
-				__( 'The plan could not be validated.', 'woocommerce-subscriptions-engine' ),
+				__( 'The plan could not be validated.', 'woocommerce' ),
 				array( 'status' => 500 )
 			);
 		}
@@ -575,7 +575,7 @@ final class PlansController extends WP_REST_Controller {

 		return new WP_Error(
 			$code,
-			__( 'The plan could not be saved.', 'woocommerce-subscriptions-engine' ),
+			__( 'The plan could not be saved.', 'woocommerce' ),
 			array( 'status' => 500 )
 		);
 	}
@@ -876,7 +876,7 @@ final class PlansController extends WP_REST_Controller {
 	private function not_found_error(): WP_Error {
 		return new WP_Error(
 			'woocommerce_subscriptions_engine_plan_not_found',
-			__( 'Plan not found.', 'woocommerce-subscriptions-engine' ),
+			__( 'Plan not found.', 'woocommerce' ),
 			array( 'status' => 404 )
 		);
 	}
diff --git a/packages/php/woocommerce-subscriptions-engine/src/Integration/Support/RESTPermissions.php b/packages/php/woocommerce-subscriptions-engine/src/Integration/Support/RESTPermissions.php
index 0c1b189e8c2..9cceb39c761 100644
--- a/packages/php/woocommerce-subscriptions-engine/src/Integration/Support/RESTPermissions.php
+++ b/packages/php/woocommerce-subscriptions-engine/src/Integration/Support/RESTPermissions.php
@@ -29,7 +29,7 @@ class RESTPermissions {
 		if ( ! is_user_logged_in() ) {
 			return new \WP_Error(
 				'woocommerce_subscriptions_engine_not_authenticated',
-				__( 'You must be logged in to access this resource.', 'woocommerce-subscriptions-engine' ),
+				__( 'You must be logged in to access this resource.', 'woocommerce' ),
 				array( 'status' => 401 )
 			);
 		}
@@ -52,7 +52,7 @@ class RESTPermissions {
 		if ( ! current_user_can( 'manage_woocommerce' ) ) {
 			return new \WP_Error(
 				'woocommerce_subscriptions_engine_insufficient_permissions',
-				__( 'Sorry, you are not allowed to access this resource.', 'woocommerce-subscriptions-engine' ),
+				__( 'Sorry, you are not allowed to access this resource.', 'woocommerce' ),
 				array( 'status' => 403 )
 			);
 		}