SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Texas
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Internationalization / localization of my website to Spanish

    I want to convert my site to spanish but don't know where to start. Does anyone have any ideas of how I would convert my site to spanish.

    Thanks
    Ark

  2. #2
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sure there are several ways of doing this. Personally, I use a file where I put all the english and spanish content, which will be displayed depending on the language request.

    For instance...

    PHP Code:
    $lang = (isset($_GET['lang'])) ? $_GET['lang'] : $_POST['lang'];
    switch (
    $lang) {
        case 
    'en':
        case 
    'sp':
            break;
        default:
            
    $lang 'en';
            break;
    }

    if (
    $lang == 'en') {

         
    $title 'Title of my website';

    } else {

         
    $title 'Titulo de mi pagina web';

    I include this file on every page and use the variables where needed.

    Then I use mod_rewrite for the urls...

    Code:
    RewriteRule ^home/$ index.php?lang=en [L]
    RewriteRule ^indice/$ index.php?lang=sp [L]
    Now if someone goes to http://www.mysite.com/home/, he/she will get the content in english and http://www.mysite.com/indice/ will be in spanish.
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  3. #3
    SitePoint Addict pentium10's Avatar
    Join Date
    Apr 2004
    Location
    Transilvania
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    put a link at this url.


    translate.google.com/translate?hl=es&ie=UTF-8&oe=UTF-8&langpair=en|es&u=HERECOMESTHEFULLLURLLIKEhttp://www.mysite.com?action=something&prev=/language_tools

    http://translate.google.com/translat...language_tools
    Rype :: book, do, charge, collect,
    track time, track expenses and invoice easily on the go.
    Available on Mac, Win, iPhone, WinMobile.
    http://www.rypenow.com

  4. #4
    does not play well with others frezno's Avatar
    Join Date
    Jan 2003
    Location
    Munich, Germany
    Posts
    1,391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can do something like this:
    PHP Code:
    //-- Check browser's language setting.
    //-- If it's spanish, include spanish laguage file, if not, include english.
    //-- If we don't get any info from the browser, use english as default language.
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
    {
        if (
    strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'sp'))
        {
            
    $lng 'sp';
            require_once(
    "./lang_sp.php");
        }
        else
        {
            
    $lng 'en';
            require_once(
    "./lang_en.php");
        }
    }
    else
    {
        
    $lng 'en';
        require_once(
    "./lang_en.php");

    We are the Borg. Resistance is futile. Prepare to be assimilated.
    I'm Pentium of Borg.Division is futile.Prepare to be approximated.

  5. #5
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    Germany
    Posts
    550
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pentium10
    If the translation from englisch to spanish is like the one from englisch to german, you better get an attorney, as you'll get plenty of impeachments because of cruelty against the spanish/german language

    These tools might be good for one/two sentences but not for whole sites. I like frezno's idea. You can also search for internationalization or i8ln here on sitepoint/google


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •