Multiple blogs and multiple languages with WP Hive
I have three sites on one WordPress installation thanks to great plugin called WP Hive. I’m not going to write about installation and configuration of this plugin because everything can be found on plugin page. I’ll just say that it’s very easy to setup and to use. However there can be one problem with WP Hive: it does not allow to have multiple blogs with different languages. But I found a simple solution for this and that’s why I’m writing this post 
Here is what I want to have on one WordPress installation: one portfolio page in two (or more) languages, one personal blog in Polish and one technological blog in English.
For portfolio page I’ve installed qTranslate plugin and from now on that page can be in any language I want.
My WordPress wp-config.php file has line define ('WPLANG', 'pl_PL'); so WordPress is in Polish and it’s OK for my personal blog. But what about my technological blog which should be in English? It doesn’t make sense to install qTranslate or any other similar plugin because those plugins modify post contents by adding some specific markups to identify languages. If I change language in wp-config.php to English my personal blog interface will be in English also. So what should I do? Just write simple if statement in wp-config.php:
if ($_SERVER['SERVER_NAME'] == 'tech.barszcz.info')
define ('WPLANG', 'en_US');
else
define ('WPLANG', 'pl_PL');instead of default single line:
define ('WPLANG', 'pl_PL');This way I can define different language for any blog I have on this WordPress installation. Of course above code should be modified if you have multiple blogs on subdirectories and not on subdomains like I have.
This entry was posted on 23 July 2010 at 00:16 in category WordPress.
3 Comments
Thanks for this post…but…how can do if you have subcategories? Thank you!
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');
}
I did not test that code but you can try it.
It works! Thanks a lot!