Title: Coupon Code Applied Translation
Last modified: August 22, 2016

---

# Coupon Code Applied Translation

 *  [ryantcarter](https://wordpress.org/support/users/ryantcarter/)
 * (@ryantcarter)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/coupon-code-applied-translation/)
 * Hey Guys,
 * I’ve been using the translation advice [here](http://www.s2member.com/kb/changing-words-phrase/)
 * 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.
       	}
       ?>
       ```
   
 * [https://wordpress.org/plugins/s2member/](https://wordpress.org/plugins/s2member/)

Viewing 1 replies (of 1 total)

 *  [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/coupon-code-applied-translation/#post-5647863)
 * Have you tried using the Real-time Find and Replace plugin?
 * I find it quite difficult to predict the circumstances in which it works, but
   I have a few places where it seems to be the only thing that does (not just for
   s2Member but more generally too).

Viewing 1 replies (of 1 total)

The topic ‘Coupon Code Applied Translation’ is closed to new replies.

 * ![](https://ps.w.org/s2member/assets/icon-256x256.png?rev=980067)
 * [s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions](https://wordpress.org/plugins/s2member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/s2member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/s2member/)
 * [Active Topics](https://wordpress.org/support/plugin/s2member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/s2member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/s2member/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [KTS915](https://wordpress.org/support/users/kts915/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/coupon-code-applied-translation/#post-5647863)
 * Status: not resolved