Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 6 down vote accepted

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

Examples

  • 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
1  
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
add comment

Your Answer

 
discard

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.