Tag : gengo

From gengo to polylang: updating the theme

So I postponed hacking a mode with multiple languages on the same page and decided to set polylang on my production site (hem) my blog.

But Gengo was using some customized template tags so the theme was adapted to it and this needed to be changed.

With polylang it’s a lot simpler, all navigation is handled by filters, so only thing really custom had to be written:

Basically my hacked version of the_translations had to be ported. And to keep it simple it can even be part of the functions.php file in the theme and use the pll_the_languages function.
I want to display the other language title prefixed by “Language version” written in this language. As the gettext like functions would only return strings in the current language, I hardcoded those strings, but adding them in Polylang admin “strings translation” would have been nice…
So here is the code:

 $translation_title=array(
    'en' => "English version:", 
    'fr' => "Version française : ");
function my_translations() {
    global $post;
    global $translation_title;
    $post_id=$post->ID;
    if ( function_exists('pll_the_languages') ) {
        $translations = pll_the_languages(array('post_id' => $post_id, 'hide_if_no_translation'=>1, 'hide_current'=>1, 'raw'=>1));
        if(!empty($translations)) {
            foreach($translations as $tr) {
                $trid=pll_get_post($post_id, $tr['slug']);
                ?><li lang="<?php echo esc_attr($tr['slug']);?>"><?php echo $translation_title[$tr['slug']]; ?><a hreflang="<?php echo esc_attr($tr['slug']);?>" href="<?php echo esc_url($tr['url']);?>" rel="alternate"><?php echo get_the_title($trid); ?></a></li><?php
            }
        }
    }
}

Instead of porting the old theme, I did build a new one based on WordPress’ Twenty Twelve updated with my previous header and dark color scheme.
I also played with a few css3 features for more neon light effects 🙂

And here it is !

From gengo to polylang: importing data

As you might know, my blog is using gengo to enable translations.

But gengo is an old unmaintained plugin (I’m even running a custom version that I recently needed to fix again) so I’d like to migrate away.

Recently, I studied the available options (thanks to Multilingual WordPress page) and selected Polylang. This one seams to be what Gengo could have been with a rewrite: no extra database tables but using WP3 custom taxonomies. (I can’t find the message but I remember Pixline telling this would be the way to go, so…).

Anyway, I started to test Polylang, what it misses compared to Gengo, is the ability to really mix languages on the same page, so it will need some customizations before replacing Gengo here, but it will come.

It’s only a few days layer that I found the WPML to Polylang plugin.
This basically triggered the development of Gengo to Polylang a plugin to import translations informations from Gengo to Polylang.

It seams to work… I missed the Site Title and Tagline (but they are no longer translated on my blog so I don’t need it 😕 ) and I did take some shortcut for terms (tags & categories) that are the same in both languages.
UPDATE 2014-02-04: I fixed that as it caused the tag archive to contain both english and french posts so… also fixed the Title and Tagline part.

So if you still have a Gengo powered blog and want to migrate, the code could help you, but don’t just run it blindly, make a backup, setup a test instance and be prepared to hack the code ! You have been warned !

New Projects pages and Gengo update.

I’ve been adding pages for my Projects. Previously this kind of data was on Trac, but I’ve never been using it actively. And I’m mostly using git for my new development instead of subversion.

I could have used Trac with git, but for project presentation WordPress pages are good enough.

But I wanted to have comments on some pages, which meant a theme update and another Gengo fix. Also I’ve done a big history rewrite by moving my version of gengo to git. If ever Jamie Talbot is really seriously considering starting development again. Then I hope he can pick some patches from my version 😉

Mises à jour de WordPress et des plugins

À la suite des déboires d’hier, je viens de mettre à jours tous mes plugins.

Le changement des URI par le plugin Gengo, qui ajoutait les code des langues m’embarquait dans une redirection infinie (en ajoutant des fr+en/ à l’URI) j’ai du le désactiver. Mais ce faisant, j’ai cassé les URI existante de vos marque-pages (si vous en aviez) et surtout de Google…
Donc j’ai encore modifié gengo, maintenant les URI qui se terminent par un code de langue sont redirigé vers l’URI sans.
Une lecture récente: Cool URIs don’t change exprime ce besoin de conserver les URI, ici je redirige, c’est mieux que rien et vous évite le 404 😉

J’ai trouvé ce lien sur le Blog de Peter Eisentraut. Je lisait sont article a propos de Remove et Purge. Je fut séduit par l’idée, je l’ai même appliqué quelques jours. Puis j’ai lut les commentaires, j’en reste à la méthode l~c pour crée une vue dans aptitude 😉 . Par le passé, j’utilisais synaptic pour purger les résidus restant…

Mon blog devient bilingue

Grâce au plug-in Gengo mon blog devient bilingue.

Évidement rien n’est jamais simple, Gengo n’est pas encore prêt pour wordpress 2.7 … donc j’ai dû installer la version de développement, reste à voir si ça marche bien !

Ce billet va me permettre de tester 😉

  • Premier problème, les accents… allez je passe tout en UTF-8, ça marche
  • Bon la date, les catégories et tags ne sont pas traduit dans le post, mais ils le sont en marge… étrange, ça reste une affaire à suivre…
  • Toutes les catégories et les tags doivent être traduits, sinon certains endroits ne sont pas remplis 🙁