Previous and Next posts:
Saturday, February 17th, 2007

Word is: multi-language.

Or better, “bilingual”. In my case, I basically had the need to write articles in two languages (italian and english). During my first search I read about plugins that support multiple language in a single post with features to switch them client-side. This is not exactly what I was looking for: different entries in different language but one related to the other as one the translation of the other. The language switch should be “global”: browsing the blog in english the user have to see only english posts; each entry should expose a link to its translation -if any- in the other language, otherwise show a “No translation” label.

All this, and even more of course, is made possible applying the “Gengo” worpress plugin.
Well, actually Gengo -as is- did’t fulfill all my requirements so I had to apply a lot of code modification to make it work as I needed.

First of all, Gengo expect to receive the current language as a parameter in the query-string (e.g. ?language=en) which, once activated the URL rewrite wordpress option (as I did), will show in the URL as a “/en/” appended in any context, for instance a full URL could be:
host/wordpress/2007/02/17/post-title/en/
This solution, to me and others -as I could read in theis forums- looks quite ugly.
Since outside the section where Wordpress is installed (/pages here in this site) the whole site language setting is determined by a subdomain (3rd level), it.heracleums.org for italian version and no subdomain (heracleums.org) for english one, I wanted Gengo to determine the current language the same way. This is the first relevant modification I had to apply.

The other aspect to be aware of using Gengo is that even its latest version does not currently support WP 2.1! Anyway, as far as I can see, this is actually creating problems when setting translation relations in the WP Write/Manage post page but fortunately you can make this association in the plugin’s “translations” page.

A related problem happens trying to get the single entry translations -the language switch- in the theme: it doesn’t work saying “No translations” even if all is properly set. The workaround requires constant mySQL queries: this led me quickly to consider using a cache management plugin (discussed later).

All the rest is working unexpectedly good, just to tell about another nice multilingual feature: the Categories, a common object through the different languages, have each their translation.

The rest of my work is all about the custom Theme development which have to show the same look of the whole site, current language awareness for various labels and captions -usually written in english directly in the HTML code of the theme-, pure CSS styling and various issues.



13 Responses to “Multi-Language Blog”

  1. Sudoku Says:

    if you are into Sudoku you shall check out Kakuro which is a new puzzle game that’s getting popular lately :-)

  2. Katja Says:

    I have a similar situation with a multilingual website - the site language setting is determined by a subdomain outside of Wordpress. Unfortunately, I’m rather new to using Wordpress and I would greatly appreciate if you could share the Gengo hack :).

  3. Heracleum Says:

    Hi Katja,
    I see this domain-determined language thing is getting quite popular.
    Unfortunately in WP and Gengo the thing is not easy, I hacked gengo but the login cookies of WP are by exact domain (not *.site.org), if I login in it.heracleums.org and switch gengo language I find myself not logged in in the english version. So take also this into account.

    First of all, I think you should tell your website or whatever, so I can contact you when I find a way to share the hacked gengo for language domains. Of course I did some lazy modifications that -as they are now- can work only on my site :P but they can be generalized.

  4. Katja Says:

    Hi :)

    The site is currently http://www.go-zveza.com, but it is under some renovation, and it only uses wordpress for the news section (so logging in or out is not really a problem) - there’s a lot of other active content that i’m not sure about how to integrate into it.

    One idea I had was to hack the permalink functions wordpress uses to extend them over the whole site, or something like that, but I’d really have to look through the code to see if that’s possible.

    Thanks for the help :)

  5. Heracleum Says:

    Hi Katja,
    i see your site renovation is not currently showing a domain-determined language, i see a fixed http://www. instead of en. or .sl, i even can’t see any kind of URL rewriting active, showing the language parameter in the querystring…
    –short pause–
    Oh my, what th.. aww. I had a quick jump on jamietalbot.com (both homepage and forums) who is the creator of Gengo.. but(!) the site is completely down crack/hacked, apparently blank pages but full of cloaked spam links… I just wanted to ask him about a domain-language aware version.

  6. Katja Says:

    Hi,

    yes, a domain-determined language is what i had planned for the next version (I’m not really sure how to do it with gengo short of a hack). As it is, another acceptable solution would also be to append the language code just after the domain instead of at the end (as gengo does).

    I could send you the url of the test version, but I’d rather not post it here (and I didn’t find an email to send it to :) ).

  7. Heracleum Says:

    Ah yes, no contact section yet :)
    The address is simple, write to the “admin” user of this site ;) (spam of course will not reach this address if i go on sharing it like this eheh)

    In a few words:
    1) do you think it will use the “same method” as this (my) site does?
    2) does you language subdomain (let’s say “sl.sitename.net) will be used also in different “levels” before other 3rd level subdomain? for instance, do you have subdomains for other purposes (non language), let’s say forum.sitename.net?
    2a) if you do, do you want the language domain to keep a fixed 3rd level domain (forum.sl.sitename.net, not recommended :D but i see a few sites doing it…) or more easily it will stay always as last level (and leftmost) domain like sl.forum.sitename.net

  8. Katja Says:

    I sent an email, hopefully to the right address :D

  9. sohbet Says:

    Theme site lince looks nice.

  10. Au Pair Says:

    very nice web site. My English is not so good, so I do not understandt it well, but it seems very good. Thanks

  11. deneme Says:

    CMS so far and it is easy to maintain and plus the community is truly great z sex porno

  12. web tasarım Says:

    Multi-Language Blog - Heracleum Pages güzel bir yazı özenle yazılmış thank you.

  13. to domain name Says:

    hi guys…

    hi guysI would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well and i have start my own blog now, , thanks for your effort…

Leave a reply

Allowed XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

It sounds like SK2 has recently been updated on this blog. But not fully configured. You MUST visit Spam Karma's admin page at least once before letting it filter your comments (chaos may ensue otherwise).