[wp-polyglots] Localizing a theme

Txopi txopi at sindominio.net
Fri Jun 24 16:52:17 GMT 2005


Hi all:

First of all I'm going to introduce myself. I am from the Basque Country,
and I helped to translate Wordpress 1.5 to euskara. Right now, we are
creating a little local comunity around wordpress in this direction:
http://www.librezale.org/wordpress-eu/

For this weblog I have loaded and updated translation MO file and changed
the default theme by one called Almost Spring. This theme (like many other
I suppose) uses some strings that aren't translated in the translation
file supplied by wordpress, so I wonder witch is the best way to translate
this strings.

It's clear that I can overwrite the theme templates and translate the
strings directly, but as they are writed using the function __(), using
gettext and po/mo files seems better. I have found this mailing list and
this post into the archives (it is the answer of Firas to Stefanos
question):

http://comox.textdrive.com/pipermail/wp-polyglots/2005-May/000592.html

I have done the same. As you can see in our website the string "Read the
rest of this entry" isn't translated. The template of the theme contains
exactly this:

<?php the_content(__('<p>Read the rest of this entry &raquo;</p>')); ?>

So I have put a file called eu.mo in the same directory as the theme. This
mo file has been generated from a po file witch contents this:

msgid "<p>Read the rest of this entry &raquo;</p>"
msgstr "<p>Bidalketa osoa irakurri &raquo;</p>"

It doesn't work so as Fira explained in that mail I have added this line
to the index.php file of the theme where the string I want to translate is
used:

<?php load_theme_textdomain(); ?>

It returns to me and error in the wp-i10n.php file where that function is
defined, because as you can see, it needs a parameter with something
called domain:

function load_theme_textdomain($domain) {
	$locale = get_locale();

	$mofile = get_template_directory() . "/$locale.mo";
	load_textdomain($domain, $mofile);
}

So I have done some chances calling the function with parameters like '',
'default', 0, '0', null, $domain, $uri['host'], ... but nothing works. I
think wordpress doesn't load the mo file :(

Can someone explain me how to localize a theme?
If this is the way, can someone help me with any tip or advice that let me
continue searching?

Thanks a lot for your time,

Txopi.




More information about the wp-polyglots mailing list