I have a script which is in English, but i need this script to show both English and German.

the English language already has a language file ( english.php ), so i am going to translate all the English wording to German ( german.php )

so my question is how can i select the language file,
i am going to let the user select the language via a flag image

so when the user clicks on there country flag it will change the site to the requested language etc etc

i want to use separate language files

but how ?

Thanks MrK

    The simplest thing is probably to use a GET-variable:

    www.something.com/page.php?lang=en

    And then in the script you just check that variable and use the correct language:

    if ($_POST['lang'] == "ge") {
    $languagefile = german.php;
    } else {
    $languagefile = english.php;
    }
    

    When using more languages it is better to use an associative array, but for only 2 languages I would use a if-statement.

      Thanks, Just out of interest can you please explain the more than 2 languages way.

      as i do plan on using more than 2 at a later date

      thanks again

      mrk

        Unfortunatley I can't do it at the moment, don't remember it without looking it up and don't have a project where I can easily find it. But search this board for associative array and you will probably find how to handle it.

          Write a Reply...