phpwordpressthemestheming

What does 'twentyeleven' does in the Twenty Eleven Wordpress Theme


The Twenty eleven theme has a little snippet in almost every part of it, for example the next:

 <?php

        printf( __( 'Daily Archives: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' );

    ?>

What does this part mean?

   'twentyeleven'

I understand (or think I do) all the rest, but what if i just delete that portion of code, or should I change it for something else?

What is the purpose of twentyeleven in the middle of the code?


Solution

  • Function reference: __

    Usage:

    <?php $translated_text = __( $text, $domain ); ?> 
    

    The second argument, $domain, is the domain from which to fetch the translation. So the twentyeleven theme has its own translation list for localizing strings. Ultimately it translates the string Daily Archives into whatever language is being used, getting the translation provided by the theme.

    I checked and there is a translation file in the twentyeleven theme (in the languages directory) but it doesn't actually have any translations in it so it would appear that the twentyeleven theme is English only.

    See more about Translating WordPress and POT files.