0
<p><?php echo get_theme_mod('simplisto_p'); ?></p>

something is saved in the database through a theme customizer and then pulled through get_theme_mod.

My Question →

How to localize this? _e something of this sort to be used. I can use this on normal strings but confused how to do this here.

4
  • If it's a text field, why would you? The user can put in whatever they want in their own language. If it's some sort of select then you just localize the options. Sep 29 '17 at 1:40
  • Actually, you are right to an extent, but we live in an era of a multilingual website. Suppose the primary website is in English, but the webmaster wants all pages/posts to be in Spanish also than localization plays a role. Various plugins such as wpml also require localized coding so that they can instantanize the cloning of pages but in different language. Sep 29 '17 at 1:56
  • 1
    You're not supposed to put variables or code inside __() functions because that's not how translations work. WPML has its own way of translating theme options that doesn't involve __() functions for this reason. Sep 29 '17 at 2:11
  • what should I do close the question? or you will write an answer? Sep 29 '17 at 2:40
2

If it's a text field, why would you? The user can put in whatever they want in their own language. If it's some sort of select then you just localize the options.

Regardless, you're not supposed to put variables or code inside __() functions because that's not how translations work. WPML has its own way of translating theme options that doesn't involve __() functions for this reason.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.