Change WP language in a PHP loop
-
Hello,
I’m a WordPress developer. Recently I developed a multilingual plugin. In some sections of my plugin I need to change WordPress language and print some text.
Let’s say these 3 languages are installed on my WordPress. I need to switch WP language in a foreach loop.
$langs = array('en_US', 'de_DE', 'es_ES'); foreach($langs as $lang) { change_wp_locale($lang); /** I need a code to do this **/ echo __('Hello', 'my-text-domain'); }
Any Idea? Your help is greatly appreciated.
Kind Regards,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Change WP language in a PHP loop’ is closed to new replies.