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?

1 Answer 1


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).

  • 1
    I'll have to make a compilation of all your language related Answers :) & +1+ for the lovely display of atheism..!
    – brasofilo
    Commented Jul 14, 2012 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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