pll_e best practices – documentation
What is the best practice for using pll_e and pll__ ?
My goal is that I would like to have many strings inside of my theme be translatable through the admin page. For example “Enter your search term.”.
Ideally I would register all
__('my-theme', 'some-string')calls in my theme to the admin interface. The wordpress-seo plugin registers its strings somehow automatically. How does it do that?
If I simply place
pll_e('my-theme', 'Enter your search term.');in the theme templates, then I create a dependency of the theme on the polylang plugin. This could be bad if I need to disable polylang at any time – which will occur.
I thought I could wrap all pll_e calls in a theme specific function called
mytheme_e_($string)which is defined in function.php and will automatically add the context (e.g. ‘my-theme’) and check “if polylang is installed, then
e_(...). This method does create a lot of overhead but would allow me to remain flexible.
It would be very helpful to add this documentation in the polylang readme or the polylang documentation pages. Thank you in advance!
- The topic ‘pll_e best practices – documentation’ is closed to new replies.