Using WordPress plugins to automatically translate blog content
This is the easiest solution. A few WordPress plugins allows you to put some clickable flags in your sidebar, that will automatically translate your content to another language using, for example, Google Translate.
This is a great solution if you’re looking for a way to make your content available for people that doesn’t speak your language, but you guessed it, the automatic translation isn’t as good as a human translated text.

Anyways, if you’re interested in theses plugins, here’s a small list. I didn’t tried them all myself, though.

Using categories and a few hacks

If you’re a perfectionist, you probably don’t really like the automatic translations provided by Google. In my opinion, if it’s okay for a personal blog, but automatic translations should be avoided on a professional blog.

For this hack, we will use categories. Go to your dashboard and create categories/sub-categories following the example below:

    One category
    Two categories
    Une catégorie
    Deux catégories
    Eine kategorie
    Zwei kategorien

Of course this is just an example, you can add as many categories as you want. The thing to remember here is that we’re using top level categories for languages, each of them having sub-categories organized by topics.

Now, you should post at least one example post in each sub-category. Once you’re done, we can start editing our header.php template.

The idea is quite simple: First, we must display the available languages, and then, a menu with the sub-category related to the current language. We must also think about defining a default language, which will be English in this example.

1 – Creating the language menu
Insert the following code where you want the language selection menu to appear:

$lang = 1; // Sets the default language

As you can see, we just need the good old wp_list_categories() function to get our available languages.
Then, we have to keep a php variable containing the id of the top level category, in order to display the navigation menu in the selected language. We must give a default value to the $lang variable. This default value will be the category id of the language you want to set as default.

I noticed that many people should have trouble to find the ID of a particular category. If you do, you should definitely read this post.

2 – Navigation menu
Now, we got a php variable containing the id of the mother category. As the top-level categories are languages, we know which language the user is using.

We simply have to display second-level categories.


3 – Retrieving category
Here’s a sample code you can use to automatically list posts from a category. This code get the current category (in this example, the language) and then displays the related posts.

<?php foreach((get_the_category()) as $category) {
      	$thecat = $category->cat_ID . ' ';
	if (have_posts()) : while (have_posts()) : the_post();
	   //Classic WP loop

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching as a place to share hacks, tutorials, etc. Follow Kyle on Twitter @KyleEslick!

  1. Danno says:

    I’m going to give this a try. Would love some fully bi-lingual people to weigh in and give their thoughts on the accuracy of machine translated text.

  2. jbj says:

    My mother tongue is French, and to be honest, the machine translations are crap.
    I speak quite good English, so I prefer reading a good English text instead of a bad text in French.
    But in France many people don’t speak any other language than French…So the plugin can help that kind of people.

  3. Anthony says:

    There are also other good plugins to translate blogs manually such as the one I developped :

    • Shery says:

      Hi Anthony,

      I want to develop the same you have done, can you please let me know the name of the plug-in that you have used for your weblog.

      I appreciate your help,

  4. Libin Pan says:

    Thanks for the great post!

    I have another pretty handy plugin, which can translate your comments( as well as posts) into any languages based on Google Ajax Translate.

  5. Albert says:

    I’m using qtranslate in mi bilingual blog.

    It’s easy to configure and to use.

  6. jbj says:

    @All: Thanks for contributing by telling us which translation plugin you’re using!

  7. Andrew. Virginia Lawer. says:

    Awesome tutorial! I used to have automatic translations on my personal blog, but I removed it. Now I’m thinking that hiring a translator for my law firm blog could be a great idea. If only I was good enough to do it myself and actually speak another language. 🙂

  8. Kayla Tahzan says:

    Thanks! For your tutorials!

  9. Morten says:

    Does anybody know about plugin who will actually give you really multilanguage blog, where you have same contenct on different languages? would only way be to set up sub domains? like, etc

  10. someGD says:

    sorry, but any automatic translation is just waste of time

  11. nikola says:

    Didn’t tested your solution, but I like the simplicity of concept. I’m pretty new to WP and don’t know the reason why it lacks such a basic feature. I also think your solution is pretty version independent (correct me if I’m wrong). I am interested in one more functionality… If someone visiting for example English version of page is there way to put on page automatically links to translated version of same page. It is for reason that we often search for answers using English terms but when reading it is more comfortable to do it on your native language.
    Third, I know my English is not the best, but I simple know that I am far better than automatic translation. It is only some kind of help. Another + for your solution

  12. Blaine Bullman says:

    Could you automatically translate the page based on IP address? I know someone could click there flag to translate the page but im sure a lot of internet users wouldn’t even look, immediately click the back button etc.

  13. Lewis says:

    Great post!!
    Do you know how to do it in blogger instead of wordpress?? is possible??

  14. 2ni says:

    Unfortunately with this solution the default text (=template) is kept in one language. So only the content you create is multi-lingual 🙁

Tweetbacks »

  1. qczhu (qcz) says: