Good day! I don't know much code so I've been researching on how to modify my wp-config.php file so that the content and widgets of my site will show in the four languages (aside from English) I have on there. I don't care about translating the WP interface, just the content. The WP .mo files in the languages in question are already in the wp-content/languages folder. How would I define 4 languages in wp-config.php? Like this?

define ('WPLANG', 'es_ES'); ('WPLANG', 'de_DE'); ('WPLANG', 'fr_FR'); ('WPLANG', 'ca_CA')

I've been trying things out (only way for me to learn) but ended up destroying the file and having to restore it. Besides, like I said, no reliable info on the net. Cheers :)

  • That won't work, there's no functionality in WordPress that allows you to edit a post in more than one language anyway. To do this find a multilingual plugin to install, like this one Jun 23 '11 at 2:09
  • as @One-Trick-Pony says, defining it like you want in the wp-config.php is impossible. I would like to suggest another multilingual plugin though: WPML (wpml.org)
    – user2015
    Jun 23 '11 at 2:42
  • perhaps this may be of use for anybody doesn't want plugins: premium.wpmudev.org/blog/multilingual-wordpress-site-multisite Mar 2 '18 at 0:49

I just found this which I applied and works perfectly:

If you have your blogs installed in subdirectories you could use this solution:

if (strpos($_SERVER['REQUEST_URI'], '/enblog') === 0) {
    define ('WPLANG', 'en_US');
} else {
    define ('WPLANG', 'pl_PL');

... and so on. Good luck!

  • This is an old question/answer but wouldn't this cause the language to change for everyone browsing the website when multiple people are present at the same time?
    – RST
    Jun 20 '15 at 9:31

if you are somehow using .mo files to translate the content strings (and your theme is calling the necessary __() or _e() functions) then you could possibly get away with a much simpler option than wpml.

You could use the simple but effective plugin http://www.viper007bond.com/wordpress-plugins/other-plugins/in-their-language/

it detects language of browser if possible and then sets the wp locale accordingly.

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.