Skip to content

Recentste berichten

  • After 13 and a bit it’s time for 13!
  • Na 13 en een beetje, komt 13?
  • Dining-out!
  • Lekker eten
  • Special night

Most Used Categories

  • Algemeen (190)
  • Algemeen @en (106)
  • Werk (83)
  • Lekker (eten en drinken) (55)
    • Recepten (8)
  • Motor (36)
  • Trouwen (27)
  • Fiets (25)
Skip to content

tom.scholten.nu

Tom's personal log

Subscribe
  • About me
  • Archief
    • CMS Framework
    • Postfix LDAP Howto
      • Postfix LDAP Howto
      • Postfix LDAP Howto v2.0 part two
    • Scroller.txt
  • Archive
  • aXBo – Testing
  • Cookie Policy
  • iPad
  • iPad
  • iPhone
    • iPhone (1.0)
      • Modem/proxy usage
    • iPhone (2.0)
  • iPhone
  • LoBySS
  • LoBySS
  • Music
  • Muziek
    • Never ending story (Limahl)
    • SnoWMusic
    • The Load out / Stay (just a little bit longer)
  • OSX Tools and Stuff
  • OSX Tools and Stuff
  • Over mij
  • Postfix LDAP Howto v2.1
  • Postfix LDAP Howto v2.1
  • Postfix MySQL howto v1.0
  • Recipes
  • Speedtouch SIP spoof (716)
  • WPG2
  • Wiki
  • Home
  • 2010
  • juni
  • 12
  • Multilanguage blogging, differently

Multilanguage blogging, differently

Tom12 juni 2010

3110Since last week I’ve changed something to the site, but not very visible 🙂 I transferred my multilingual blogs from Polyglot to WPML. Some indicate it to be a possible disadvantage as every language gets its own posts, but this is more of a convenience, every time you don’t translate something you won’t bother someone with it. How’s that? Well if I were to post something on my Dutch blog but don’t translate you wouldn’t see it (as most likely you wouldn’t read it anyway). In addition you can see for yourself if something exists in your language, it’s clearly visible on the dashboard!.

If you also want to try it out, be sure to check WPML compatibility. Coming from Polyglot myself I’ve written a very Q&D convertor which only creates output for a SQL loadfile, as always, use at your own risk.

PHP code for polyglot_convert.php

    $database="yourdb";
    $dbuser="youruser";
    $dbpassword="yourpw";
    # We need 2 functions from WordPress' wp-includes/formatting
    include("../wordpress/wp-includes/formatting.php");

    mysql_connect("localhost",$dbuser,$dbpassword); $query='select * from wp_posts where (post_title like "%lang_nl%" OR post_content like "%lang_nl%") AND post_status="publish" AND post_type="post" ';
    $result=mysql_query($query);
    $i=0;
    while ($i < mysql_numrows($result)) {
    $title_nl=addslashes(preg_replace("/\[.?lang_nl\]/","",preg_replace("/\[lang_en\].*\[\/lang_en\]/","",mysql_result($result,$i,'post_title'))));
    $title_en=addslashes(preg_replace("/\[.?lang_en\]/","",preg_replace("/\[lang_nl\].*\[\/lang_nl\]/","",mysql_result($result,$i,'post_title')))); $title_en_short=$title_en;
    if ($title_nl == $title_en ) { $title_en_short=$title_en_short."2"; }

    $content_nl=mysql_result($result,$i,'post_content');
    $content_nl=preg_replace("/\[.?lang_nl\]/","",$content_nl);
    $content_nl=preg_replace("/\[lang_en\].*?\[\/lang_en\]/sU","",$content_nl);
    $content_nl=addslashes($content_nl);

    $content_en=mysql_result($result,$i,'post_content');
    $content_en=preg_replace("/\[.?lang_en\]/","",$content_en);
    $content_en=preg_replace("/\[lang_nl\].*?\[\/lang_nl\]/sU","",$content_en);
    $content_en=addslashes($content_en);

    echo "UPDATE wp_posts SET post_title = '".$title_nl."', post_content = '".$content_nl."' WHERE ID=".mysql_result($result,$i,'ID')."; ","\n";
    echo "INSERT INTO wp_posts SET post_title = '".$title_en."', post_content = '".$content_en."', post_date = '".mysql_result($result,$i,'post_date')."', post_date_gmt = '".mysql_result($result,$i,'post_date_gmt')."', post_author = ''.mysql_result($result,$i,'po
    st_author')."', post_category = '".mysql_result($result,$i,'post_category')."', post_name = '".sanitize_title_with_dashes($title_en_short)."'; ","\n";

    echo "insert into wp_icl_translations set element_type='post_post', element_id=LAST_INSERT_ID(), trid=".mysql_result($result,$i,'ID').", language_code='en', source_language_code='nl';","\n";

    $i++;

    }

Post navigation

Previous: Meertalig bloggen, maar dan anders
Next: 1-2-3

Related Posts

After 13 and a bit it’s time for 13!

31 december 201231 december 2012 Tom

Dining-out!

21 december 201231 december 2012 Tom

Special night

20 december 201231 december 2012 Tom
Copyright All Rights Reserved | Theme: BlockWP by Candid Themes.

Warning: Undefined array key "ltasurl" in /var/www/html/weblog/wp-content/plugins/flash-video-player/flash-video-player.php on line 96

Warning: Trying to access array offset on null in /var/www/html/weblog/wp-content/plugins/flash-video-player/flash-video-player.php on line 96