Coupon responses
Posted: December 26th, 2011, 12:24 pm
I would like to change the message that appears when someone apply a coupon to an s2member checkout page, how do I do that?
— WordPress® ( Users Helping Users ) —
http://www.primothemes.com/forums/
http://www.primothemes.com/forums/viewtopic.php?f=36&t=16557
<?php
add_filter("gettext_with_context", "s2_contextual_translation", 10, 3);
function s2_contextual_translation($translation = NULL, $original = NULL, $context = NULL)
{
if($context === "s2member-front" && $original === "COUPON %s off. ( Now: %s )")
/* Here you provide the translation.
You can take the `%s` Replacement Codes out if needed. */
$translation = "You received %s off. ( You now pay: %s )";
/**/
else if($context === "s2member-front" && $original === '<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s</strong> )</div>')
$translation = '<div>You received: <strong>%s off</strong>. ( You now pay: <strong>%s</strong> )</div>';
/**/
else if($context === "s2member-front" && $original === "COUPON %s off. ( Now: %s, then %s )")
$translation = "You received %s off. ( Now pay: %s, then %s )";
/**/
else if($context === "s2member-front" && $original === '<div>Coupon: <strong>%s off</strong>. ( Now: <strong>%s, then %s</strong> )</div>')
$translation = '<div>You received: <strong>%s off</strong>. ( Now pay: <strong>%s, then %s</strong> )</div>';
/**/
return $translation;
}
?>
<?php
add_filter('ngettext_with_context', 's2_n_contextual_translation', 10, 5);
function s2_n_contextual_translation($translated = NULL, $original_single = NULL, $original_plural = NULL, $number = NULL, $context = NULL)
{
if($context === 's2member-front' && $original_single === 'for %1$s %2$s')
/* Ex: `good for 1 month`. Using `%1$s` and `%2$s`. */
$translated = 'good for %1$s %2$s';
/**/
else if($context === 's2member-front' && $original_plural === 'for %1$s %3$s')
/* Ex: `good for 2 months`. Using `%1$s` and `%3$s`. */
$translated = 'good for %1$s %3$s';
/**/
return $translated;
}
?>