Coupon Code Applied Translation
-
Hey Guys,
I’ve been using the translation advice here
This is great when wanting to translate single words or phrases, but when it’s using dynamic values I’m a bit lost.
For example when a coupon code is entered the normal behaviour is to output:
<div>Coupon: %s off. (Now: %s, then %s)</div>The values in %s are the discount amount, the monetary amount and the period of time. ie £12.50 for 35 days then £18.99 a month recurring.
Is there any way I can just have the monetary values and strip out the period of time? Currently I’m just using ‘Coupon X off’ but I’d like it to show the prices, just not the period of time. I use a couple of different values of coupon so I can’t just hardcode it in unfortunately.
<?php add_filter('gettext_with_context', 's2_translator', 10, 4); function s2_translator($translated, $original, $context, $text_domain) { if($context === 's2member-front' && $text_domain=== 's2member') { if($original === '<div>Coupon: <strong>%s off</strong>. (Now: <strong>%s, then %s</strong>)</div>') $translated = '<div>Coupon: %s off</div>'; else if($original === 'Additional Info') $translated = 'Delivery Address'; } return $translated; // Return final translation. } ?>
The topic ‘Coupon Code Applied Translation’ is closed to new replies.