WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What code is required to put in functions.php in order to make the theme translation ready?

The TwentyEleven theme has only following line:

load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );

But in many tutorials they have mentioned to add following:

load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
$locale = get_locale();
    $locale_file = TEMPLATEPATH . "/languages/$locale.php";
    if ( is_readable( $locale_file ) )
        require_once( $locale_file );

Is the second part required to add in the functions.php file to make it translation ready? If it is, why the TwentyEleven theme does not have it?

share|improve this question
up vote 6 down vote accepted

The second part is not required, it just loads a PHP file with language specific functions.


  • In some countries/regions/religions it is not allowed to use capital letters in a word for anything else than the name of some god. In these cases you probably want to remove the Wordpress to WordPress filter.

  • Some languages (Chinese) do not use spaces (in a predictable manner). If you use a function to set the excerpt length by words you will probably fail. In a language specific file you can disable that excerpt filter.

  • Different languages need different amounts of space, vertically and horizontally. See the very helpful article Text size in translation.
    The English word views is three times as long in Italian: visualizzazioni. That’s one of the reasons to test your layout not just in an extremely compact language like English. Thai for example takes more vertical space – you may have to adjust a grid layout with some extra rules (think <input size> and CSS of course).

share|improve this answer
I'll have to make a compilation of all your language related Answers :) & +1+ for the lovely display of atheism..! – brasofilo Jul 14 '12 at 11:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.