WordPress 2.7 and multi-language support

I started writing this blog in Spanish, around one month ago, and I was thinking somehow that it would be great to write some of the articles in both Spanish and English, so I decided to do my move on this, and add support for multiple languages.

Apart from the multi-language thing, I was also wondering how the new WordPress 2.7 looked, so for 5 more minutes of work I decided to update both WordPress and install the new multi-language plugin.

To my surprise, after trying the latest the WordPress 2.7, I have to say that the UI seems to be rewriten, it has a completely new face, and it just looks great.

To get an idea, just look at the following dashboard view of the new WordPress 2.7:

Dashboard de WordPress 2.7

Dashboard of WordPress 2.7

Looks quite cute, isn’t it? ;)

On the other hand, since I started the blog I was wondering which would be the best language to write. I speak Catalan and Spanish as my native languages, and English as a second language. I’ve decided to use Spanish because I’m much more comfortable at it, but I think english-speaking people also deserve the right to read some of the articles :p

Well, what was I speaking about? Aham, I was going to talk about the best multi-language plugin for wordpress, right?

After looking several plugins on my dev computer (that you can find on the wordpress plugin page), and finding out that some of them are out of date, and others are not working as one might expect, I’ve found ZdMultiLang.

ZdMultiLang is an awesome plugin! It is what I finally installed on codigomanso.com

It just worked out of the box. You could have as many languages as you want, it allows translating all of the posts/pages/tags/categories/… to any of the languages, and it has a very simple user interface.

There is also another good point on this plugin, by default, if you have permalinks enabled, it just work embedding the language code as the first path on the URL:

http://www.codigomanso.com/<language-code>/<permanink>

I think I have nothing more to say, just to show you some screenshots of ZdMultiLang:

Selección de los distintos idiomas

This is for selecting the languages you are going to use on your blog

Opciónes de configuración de ZdMultilang

Configuration options of ZdMultilang plugin

Lista de artículos a traducir

List if all articles to translate them

Trackback URL

, , , ,

65 Comments on "WordPress 2.7 and multi-language support"

  1. Raúl
    22/01/2009 at 9:21 am Permalink

    Hola

    Antes de nada, gracias por el post. Está todo muy bien explicado.

    He instalado el plugin y tengo una duda. No se cómo hacer para que las banderitas salgan en el sidebar en lugar de en cada post o página.

    Por otro lado tengo otro problema que veo que tu también tienes, y es que no se como cambiar los literales del sidebar como: categorías, enlaces y archivo, para que salgan en inglés por ejemplo.

    Un saludo
    Raúl

  2. Pau Sanchez
    22/01/2009 at 11:26 am Permalink

    Hola Raul,
    Para que las banderas salgan en el sidebar, tienes que ir al tema actual que estés usando (por ejemplo: wordpress/wp-content/themes/default) y poner algo en plan:
    <div class="widget">
    <ul class="zd_multilang_list">
    <?= zd_multilang_menu (true); ?>
    </ul>
    </div>

    Si quieres más detalles, te recomiendo que le eches un vistazo al archivo de plugins/zdmultilang/zd_multilang.php y busques las funciones zd_multilang_menu (que es la que yo he usado) y zd_multilang_widget que es la que se supone que deberías usar.

    Sobre los literales del sidebar, hay varias formas. Yo imagino que la más fácil sería instalarse traducciones de wordpress (que usa gettext), y entonces poner __(‘Enlaces’) y luego en las traducciones actualizar ese string. La verdad que no te se contestar muy bien porque tampoco me he puesto.
    En mi caso sale siempre “Categorias” porque está ese string directamente metido en sidebar.

    Igual otra solución más chapucera, pero que no requeriría mucha investigación, seria obtener el idioma actual (mi versión de zdmultilang usa la variable global $CurrentLang, por lo que podrías mirar cual es el idioma actual y en función del mismo poner una cadena u otra. Algo parecido a esto:
    <?php
    global $CurrentLang;
    switch($CurrentLang) {
    case 'es': echo 'Enlaces'; break;
    case 'en':
    default: echo 'Links'; break;
    }
    ?>

    El código de arriba no está testeado ni se si funcionaría o no. Y además tiene el problema que puede ser que cambiando a otra versión del plugin, el idioma actual deje de estar en esa variable y esto no funcione. También puede ser que necesites llamar primero a la rutina de inicialización del plugin.

    A parte de estas, seguro que hay muchas más soluciones. En cualquier caso espero que esas ideas te encaminen, pero la solución final ya tendrás que encontrarla tú ;)

    Un saludo!

  3. Raúl
    23/01/2009 at 5:44 pm Permalink

    Muchas gracias de nuevo Pau

    Mañana me pondré a hacer pruebas y ya te cuento.

    Un saludo

  4. Pau Sanchez
    24/01/2009 at 4:22 am Permalink

    Por cierto que le he preguntado a Anthony Petitbois (el creador del plugin), y básicamente para obtener el idioma actual me ha contestado esto:

    “you can check the global variable $locale which is always accessible and filled with the current language.”

    Vamos, que la variable $locale sería la adecuada.

    Suerte con los cambios.

  5. Raúl
    26/01/2009 at 4:14 am Permalink

    Pau

    Lo de la sidebar ha sido copiar y pegar. Sin problemas. Aunque ahora está desactivado porque sólo hay contenidos en un idioma.

    Por si quieres echar un vistazo: http://www.rallyofspain.com

    Lo de los literales, creo que se me empieza a escapar :-)

    Un saludo

    Raúl

  6. Pau Sanchez
    26/01/2009 at 4:27 am Permalink

    Lo de los literales debería ser algo como sustituir la cadena de “Links” por el siguiente código (en el archivo de sidebars):

    < ?php
    global $locale;
    switch($locale) {
    case 'es': echo 'Enlaces'; break;
    case 'en':
    default: echo 'Links'; break;
    }
    ?>

    No se realmente si en $locale pondrá “es”, “ES” o “es_ES” o similar, pero vamos, en teoria debería funcionar.

    Acabo de echarle un vistazo al link, tiene buena pinta ;)
    Suerte!

  7. aitka
    18/06/2009 at 2:57 am Permalink

    Gracias!!!

    Es genial!, me has salvado la vida

    :D

  8. beatriz
    15/07/2009 at 9:53 am Permalink

    Hola,
    Yo tengo un problemilla con este plugin. Lo he instalado ya en 3 sitios diferentes y ahora en la tercera no me chuta bien. No coje el permalink del idioma. Por ejemplo, si le pongo “en” para el inglés me salta una pagina 404 No encontrado pero si le pongo ?lang=en si funciona.
    Y esto mientras tenga los permalinks seleccionados por defecto, como le ponga los personalizados no chuta nada, pero ni el español.
    No sé a que es debido, puede ser por la version del wordpress? estoy trabajando con la 2.8

    Gracias de antemano

    Bea

  9. Pau Sanchez
    18/07/2009 at 12:08 am Permalink

    Hola Bea,
    No se que puede estar pasando. De todos modos recuerdo que cuando cambié la versión de wordpress a 2.8 tuve que actualizar también el plugin porque me daba problemas, aunque no recuerdo exactamente que problemas me dio.

    ¿Te has actualizado a la última versión del plugin?

    Un saludo!

Hi Stranger, leave a comment:

ALLOWED XHTML TAGS:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Subscribe to Comments