WordPress.org

Support

Support » Plugins and Hacks » redirect using HTTP_ACCEPT_LANGUAGE

redirect using HTTP_ACCEPT_LANGUAGE

  • I’m trying to read / set http_accept_language to:
    1) give users text in their browser default language;
    2) give them the option of changing to another language.
    My code works fine:
    http://oreneta.com/kalebeul/test.php
    but dies once it goes into a WordPress template (same code/text near bottom right-hand column):
    http://oreneta.com/kalebeul/2006/10/13/2000-catalan-insults/
    Here’s my code:
    <?php
    $day=(date('d'));
    $month=(date('m'));
    if ($userlang=="")
    {
    $userlang=$_SERVER['HTTP_ACCEPT_LANGUAGE'];
    $userlang=substr($userlang,0,2);
    }
    if ($userlang=="es")
    {
    include("http://oreneta.com/libro_verde_bcn/es/$month/$day/");
    echo "(<small><a href="?userlang=en">Traducción</a>)</small>";
    }
    else
    {
    include("http://oreneta.com/libro_verde_bcn/en/$month/$day/");
    echo "(<small><a href="?userlang=es">Original</a>)</small>";
    }
    ?>

    Any ideas? I thought at first it was a register globals thing, but not sure now.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘redirect using HTTP_ACCEPT_LANGUAGE’ is closed to new replies.
Skip to toolbar