Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Advice on adding multi language support

    Hi Guys,

    someone has asked me if i can convert a site i did into a multi language one, well a few other languages lol, i never did the site with that in mind so ill need to re-do a fair bit i reckon.

    i'm wondering what you guys would suggest would be a way to go about it.

    thanks for any input guys

    Graham

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Depends on how big the site is, and how you want to be able to edit the phrases. You could store the language phrases in a file or database, and reference them in the script. If you aren't going to be changing them often or if the site isn't very big it's probably best to use a file to store them.
    PHP Code:
    // lang.en.php
    $lang = array();
    $lang['register'] = 'Register';
    //etc 

  • #3
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Hi Mate,

    PHP Code:
    $lang = array();
    $lang['register'] = 'Register'

    its not a very big site to be honest so that looks good, how would i make the switch between languages? plus for the other words would i:

    PHP Code:
    $lang = array();
    $lang['register'] = 'Register';
    $lang['login'] = 'Login'
    etc

    thanks mate

    Graham

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    You would make individual files for each language. lang.en.php, lang.es.php, etc. When people select a language you set it in a cookie or session and decide which file to use from that. Yes, that's how you add the other words.


  •  

    Posting Permissions

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