*/ protected function input_properties(): array { return array( 'bundle' => array( 'type' => 'string', 'description' => __( 'Bundle id, handle or slug.', 'acrossai-abilities-manager' ), ), 'domain' => array( 'type' => 'string', 'description' => __( 'Text domain. Omit for the bundle default.', 'acrossai-abilities-manager' ), ), 'locale' => array( 'type' => 'string', 'description' => __( 'Locale to delete.', 'acrossai-abilities-manager' ), ), ); } /** * @since 0.0.34 * @return array */ protected function required_input(): array { return array( 'bundle', 'locale' ); } /** * @since 0.0.34 * @return array */ protected function output_properties(): array { return array( 'deleted' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), ), 'deleted_count' => array( 'type' => 'integer' ), ); } /** * @since 0.0.34 * @return array */ protected function annotations(): array { return array( 'readonly' => false, 'destructive' => true, 'idempotent' => false ); } /** * @since 0.0.34 * @return bool */ protected function requires_confirmation(): bool { return true; } /** * @since 0.0.34 * @return string */ protected function confirmation_message(): string { return __( 'Deleting a translation cannot be undone - the translated strings are lost along with the compiled files. Pass confirm: true to proceed.', 'acrossai-abilities-manager' ); } /** * @since 0.0.34 * @param array $input Input. * @return array|WP_Error */ protected function run( array $input ) { $file = $this->resolve_file( $input ); if ( is_wp_error( $file ) ) { return $file; } $deleted = Translation_Repository::delete( $file ); if ( is_wp_error( $deleted ) ) { return $deleted; } return array( 'deleted' => $deleted, 'deleted_count' => count( $deleted ), 'message' => sprintf( /* translators: %d: number of files removed. */ _n( '%d file removed.', '%d files removed, including every compiled artefact.', count( $deleted ), 'acrossai-abilities-manager' ), count( $deleted ) ), ); } }