[wp-polyglots] searching a tutorial on translating a WP theme

Stefano steagl at people.it
Thu Sep 21 08:47:24 GMT 2006


On Thu, 21 Sep 2006 10:29:09 +0200, "Lukáš Kucharczyk"
<kucharczyk.lukas at gmail.com> wrote:

>Hello!
>
>I'd like to try using the poEdit to create the pot files from a theme
>file, but strings in theme files aren't enclosed in __() or _e(). So I
>attempted to do it myself, resulting in being stuck with these kind of
>strings:
>
><h2 class="title">Archive for <?php the_time('F jS, Y'); ?></h2>
>
>I know it should be something like this:
>
><?php echo sprintf(__('Comments in moderation (%s)'),
>number_format($numcomments) ); ?>

The __() is used to translate a text and give it back to a PHP
function withour echoing it, the _e() echoes the translated text
directly.

The in the case of:

<h2 class="title">Archive for <?php the_time('F jS, Y'); ?></h2>

You should use the __() function cause the format strings should be
passed back to the_time function, then it will became:

<h2 class="title">Archive for <?php the_time(__('F jS,
Y','textdomain_if_apply')); ?></h2>

-- 

Stefano Aglietti - StallonIt on IRCnet - ICQ#: 2078431
Email: steve at 40annibuttati.it steagl at people.it
Sites: http://www.40annibuttati.it (personal blog)
       http://www.wordpress-it.it (WordPress Italia)


More information about the wp-polyglots mailing list