Statistics: Posted by jevans161 — December 30th, 2011, 10:35 pm
<?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;
}
?>
Statistics: Posted by Jason Caldwell — December 30th, 2011, 10:22 pm
Statistics: Posted by Jason Caldwell — December 30th, 2011, 9:30 pm
Statistics: Posted by jevans161 — December 30th, 2011, 9:06 pm
<?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;
}
?>
Statistics: Posted by Jason Caldwell — December 30th, 2011, 8:35 pm
Statistics: Posted by Cristián Lávaque — December 27th, 2011, 5:21 am