Title: Translate inside php code
Last modified: August 30, 2016

---

# Translate inside php code

 *  [Kettercat](https://wordpress.org/support/users/kettercat/)
 * (@kettercat)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/translate-inside-php-code/)
 * Hey guys,
 * I’m trying to translate a template file from the WP Listings plugin. I need to
   translate the labels inside the PHP code but when I try to use the shortcode 
   it shows up as simple text of both languages.
 * For example, I need this code:
 *     ```
       if ( '' != get_post_meta( $post->ID, '_listing_bedrooms', true ) ) {
       			$listing_meta .= sprintf( '<li class="listing-bedrooms"><span class="label">Beds: </span>%s', get_post_meta( $post->ID, '_listing_bedrooms', true ) );
       		}
       ```
   
 * To show “Beds: ” in English and show another text in Hebrew, for example (HE).
 * What do I do?
 * Thanks!
 * [https://wordpress.org/plugins/qtranslate-x/](https://wordpress.org/plugins/qtranslate-x/)

The topic ‘Translate inside php code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/qtranslate-x_f9f9f9.svg)
 * [qTranslate X](https://wordpress.org/plugins/qtranslate-x/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/qtranslate-x/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/qtranslate-x/)
 * [Active Topics](https://wordpress.org/support/plugin/qtranslate-x/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/qtranslate-x/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/qtranslate-x/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Kettercat](https://wordpress.org/support/users/kettercat/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/translate-inside-php-code/)
 * Status: not a support question