Dukeo » WordPress » Translation-Ready Theme: How To Prepare Your WordPress Blog

Translation-Ready Theme: How To Prepare Your WordPress Blog

Steven 15 responses WordPress
1

If you are working on developing themes for WordPress (which is actually a pretty good way to get free backlinks to your own personal blog), you should consider making your WordPress translation-ready. It will take you less than 1 minute and will certainly increase your theme reach because not everyone speaks and blogs in English.

The very first step is to create a folder called languages in your theme folder.

In a second time, edit the functions.php file of your WordPress theme and paste the following code in it:

// Make theme available for translation
// Translations can be filed in the /languages/ directory
load_theme_textdomain( 'your-theme', TEMPLATEPATH . '/languages' );

$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable($locale_file) )
  require_once($locale_file);

Your theme is now ready to be translated!

If you enjoyed this article,
Get email updates

Join for Free »

15 Comments

  1. John

    I don’t know if this is something I should do, as I’m not completely sure how many people would actually need my blog to be in another language. How do you know if this would be right for your blog?

    1. Anon

      Let’s put it this way: Do you have a reason not to do it? Always better to be safe than sorry.

    2. John

      You have a point there. :)

  2. Gorman

    What languages does this include?

    1. Anon

      It doesn’t “include” languages, it just lets anyone who comes to your page be able to translate it into their native language.

  3. Michelle

    I think this is a great idea. There are so many great writers and great blogs around the world, why would you want to be limited? There are examples of bloggers out there that have become renown, like Mashable, which is an internet news blog started by Scot Peter Cashmore in 2005, and is now one of the top websites in the world. It’s called the World Wide Web for a reason, people!

    1. Sarah

      I love Mashable!

    2. Gorman

      It’s things like this that make technology beautiful. Transcending borders, oceans, languages, it’s the ultimate connection. No boundaries.

  4. Samie

    Wow, I had never even considered doing this, that’s great!

  5. First Website

    Did you know that most of the time people will take your blog more seriously if it’s on your own website, rather than WordPress or any of those blog-ready sites? If you have a blog that’s http://www.thisismyblog.com for example, that is seen a much more credible. Fun fact!

    1. First Website

      Oh wow, that actually created a link to a real person’s blog, my bad. I meant it as an example blog title, but you get the idea. Personalized blog pages are more credible than ready-made.

    2. Liz

      Oops! :)

  6. Dana

    Wow, I always thought that sites like WordPress would just have translation capabilities built in!

    1. Affmaster

      You would think. But no, a lot of times you have to do things by hand on these sites.

  7. Cristina Areias

    Boa noite from Brazil!

    Please, I need to ask – which I think – can be a very dummy question; then, since now: sorry about that! :) I’m in the very start of WP studies, so…

    XHTML + CSS sites may use just a link (to Google translator, for instance, regardless quality issues) and anyone who comes to this page will be able to translate it into their native language.
    So, what is this about, here, with WP? I mean: why does WP need these codes?
    Will these special lines translate something that usual translators would not be able to? What, exactly?

    Thanks for your attention and sorry about my english mistakes!