[wp-polyglots] gettext default theme

Morgan Doocy morgan at doocy.net
Mon Feb 28 02:00:26 GMT 2005


On Feb 26, 2005, at 1:11 AM, Ryan Boren wrote:
> This is the first draft.  There are still some several things that need
> to be done.

I've committed a second draft, which should be relatively complete. 
Read on for more info on the changes.

> Messages that contain multiple format specifiers need to number those
> specifiers.  For example, the following:
>
> You are currently browsing the <a href="%s">%s</a> weblog archives for 
> %
> s.
>
> Must be changed to:
>
> You are currently browsing the <a href="%1$s">%2$s</a> weblog archives
> for %3$s.

Done. I also made all messages which only used one %s use %1$s as well, 
so users don't have to learn two formats.

> Also, some message constructions need to be changed.
>
> From:
>
> <?php _e('Posted in'); echo ' '; the_category(', ') ?>
>
> To:
>
> <?php _e('Posted in %s'); get_the_category_list(', ') ?>

Done, although it's more like:

<?php printf(__('Posted in %s'), get_the_category_list(', ') ?>

I also made 'Name' & 'Name (required)', etc. (on comments.php) localize 
separately, rather than just conditionally adding the '(required)' bit, 
since some languages may require more of a sentence restructure rather 
than just tacking on a modifier.

> Morgan, Nikolay, feel free to hack on the theme.

Additionally, I've done the following:
- Changed all 'echo sprintf()'s to just 'printf' for readability.
- __()'ized all PHP date() formats in calls to the_time(), 
get_the_time(), comment_date() and comment_time(), and added default 
formats where they were not specified, so that date & time formats can 
be gettexted. For example, the default post date format on the archive 
pages is 'l, F jS, Y', which becomes 'Sunday, February 27th, 2005' in 
English. However, the Danish translation, for example, would want to 
change this to 'l, j. F Y', which becomes 'søndag, 27. februar 2005'. 
Chinese and Japanese can even use something like 'Y年n月j日', which then 
becomes '2005年2月27日'.
- Tabified accidental indentation spaces wherever I found them, and 
prettified some of the nesting here and there. (If code is poetry, I'm 
e.e. cummings. ;-) )
- Removed Heilemann's commented-out "Time Since" code, since the plugin 
isn't localized.
- Changed all double-quoted messages to single-quoted, making them in 
line with the style guidelines, since no variable interpolation should 
ever be done in them. Also eliminates the potentially confusing 
backslashing of HTML attributes, and helps us remember to use curly 
quotes and apostrophes.

I did some basic testing and squashed a few obvious bugs, but we'll 
need to be more thorough. Anyone want to put it through its paces on a 
really complicated blog? (Note that you'll need the latest SVN of 
WordPress; it won't work with the last nightly that was produced on the 
21st.)

Morgan


More information about the wp-polyglots mailing list