multilanguage site - plz i need your help

Discussion in 'PHP' started by paris171, May 13, 2008.

  1. #1
    i have a website and what i'd like to do is add the option to choose the language that the text is shown..

    i think that there is supposed to be a variable which will take a number indicating the chosen language.. eg 0:english, 1:spanish

    then using php the text is taken from a database or another sort of file and shown at my webpage..


    thats how i have think of it.. please tell me if i what i've written is possible and if there's any better way to do it.. also tell me if i need cookies for keeping the code of the desired language or if there's any other way..

    any help given would be very appreciated :)

    ps. i have basic knowledge of web programming, php n mysql.. i just need a little push to the right direction :)
     
    paris171, May 13, 2008 IP
  2. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yeah it's possible. It would be better to have different folders (en/; es/; de/) that contain copies of the site created for that language.
     
    Altari, May 13, 2008 IP
  3. paris171

    paris171 Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i know that theres this solution too but i don't prefer it..

    if i want to change something on the template for example i would have to change it for each language i have!! thats not good at all..

    so can anyone help with how i get started with this??

    thanks in advance
     
    paris171, May 13, 2008 IP
  4. WhaLberg

    WhaLberg Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, if you are an advanced PHP developer then I advice you on using the system like vBulletin does.

    • Create a language table with languageid, title and your needed fields.
    • Create a phrase table with phraseid, phrasename, translation, languageid and your needed fields.
    • Make users select a language and select a default one for the entire site.
    • When your site loads, get all the phrases of the language.

    If you are not an advanced PHP developer, then including lang/file.php is better and easier for you.
     
    WhaLberg, May 14, 2008 IP
  5. paris171

    paris171 Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    no i am not an advanced php developer.. i know the basics and i mostly copy-paste-modify..

    can u give some general guidelines on how i get started??

    my site is written in html and it's not tha big.. there 6-7 texts with about 100 words each which will be updated rarelly..
     
    paris171, May 15, 2008 IP
  6. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    cornetofreak, May 15, 2008 IP
  7. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Google always gives a bad translation, especially with grammar.
     
    NatalicWolf, May 15, 2008 IP
  8. paris171

    paris171 Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    i do not want to use google for this.. the transilation is not that good and the other hand my site is pretty small with only a few texts which will be updated rarelly so i would like to do the transilation myself.

    but i need a little help with the php code.. and another question.. the texts should be saved in a mysql database or another type of file should be more appropriate??
     
    paris171, May 20, 2008 IP
  9. vrsho

    vrsho Member

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #9
    Man, why not use apache rewrite? U can rewrite your directory /en/ /de/ /es/ to /index.php?language=en, etc... And u don't need to copy and create thy folders. U only have one root folder. Look on my site: http://www.MjuzikTube.com
    I also added ip to language detection, so that user is redirected to his preferred language on first visit.
    If u have any question just ask. ;)
     
    vrsho, Dec 21, 2010 IP