1

I am using esc_html_e() function as shown below to translate a string.

<h1><?php esc_html_e('Question', 'abcd'); ?> &nbsp;</h1>

On english page, it displays the right word Question but on taking the page to french it still shows the same word Question.

I am wondering what can be the reason behind this. I believe esc_html_e() function translates a string when different language page is requested.

3
  • When you say you're taking the page to french, how are you doing that? Are you doing it via a plugin such as WPML or Polylang? Or did you change the locale of the entire site? WP has no concept of different language pages
    – Tom J Nowell
    Mar 25, 2020 at 15:48
  • its via plugin WPML. I have a plugin WPML installed on my wordpress site. Mar 25, 2020 at 15:49
  • 3rd party plugins are offtopic on this stack. You will need to consult WPML docs and support, WordPress doesn't have a language switcher, and the default string translation APIs only work with the locale of the site as a whole. WPML and other translation plugins change this behaviour though.
    – Tom J Nowell
    Mar 25, 2020 at 15:54

0

Browse other questions tagged or ask your own question.