Title: About using wordpress esc_html__.
Last modified: November 23, 2020

---

# About using wordpress esc_html__.

 *  [Halil Beycan](https://wordpress.org/support/users/beycandeveloper/)
 * (@beycandeveloper)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/about-using-wordpress-esc_html__/)
 * Hello, using the esc_html__ function was tiring to write text domain all the 
   time: D so I created a function as below.
 * The problem is I can get the following word but it doesn’t save to .pot file.
   If I make a direct definition of esc_html__ in the function, it works but when
   I use variables for dynamics, what is the reason?
 * // Working
    function lsph_lang(){ return esc_html__( “Hello”, ‘lsph’ ); } lsph_lang();
 * // Not working.
    function lsph_lang( $str ){ return esc_html__( $str, ‘lsph’ );}
   lsph_lang( “hello” );

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/about-using-wordpress-esc_html__/#post-13698331)
 * You have `Hello` (capitalized) in the top function and `hello` (uncapitalized)
   in the bottom function. Those are different words and require separate translation
   strings.
 *  Thread Starter [Halil Beycan](https://wordpress.org/support/users/beycandeveloper/)
 * (@beycandeveloper)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/about-using-wordpress-esc_html__/#post-13698591)
 * [@diondesigns](https://wordpress.org/support/users/diondesigns/)
 * I mean, it doesn’t work if I specify the text esc_html__ with a variable rather
   than that, it doesn’t accept the first parameter as a variable, it expects text
   between quotes.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/about-using-wordpress-esc_html__/#post-13703506)
 * You cannot have variables as strings for translation. You cannot expect translators
   to know how to translate a variable value. The one exception are sprintf() style
   placeholders. Values that replace placeholders do not get translated, you’d normally
   be using them only for numeric values.
 * You may want to review [https://developer.wordpress.org/apis/handbook/internationalization/internationalization-guidelines/](https://developer.wordpress.org/apis/handbook/internationalization/internationalization-guidelines/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘About using wordpress esc_html__.’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/about-using-wordpress-esc_html__/#post-13703506)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
