I have a text field in the backend. The text value inside it will be different depends on the products I choose. So, it's a kind of dynamic field.
How can I target that field to make it translatable? so each time I create an offer WPML can detect the string?
if ( $total_to_add - $total_added > 0 ) {
if ( ! in_array( $rule['key'], $special_offers, true ) ) {
$rule_text = isset( $rule['text_in_modal_special_offer'] ) ? $rule['text_in_modal_special_offer'] : __( 'Get a special discount if you add {{total_to_add}} product(s) to your order.', 'discountText' );
$special_offer = array(
'text' => $rule_text,
'items_in_cart' => $total_added,
'discount' => array(
'type' => $discount['discount_amount']['type'],
'amount' => $discount['discount_amount']['amount'],
),
);
$special_offers[ $rule['key'] ] = $special_offer;
}
}