1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Best way to store keys for multilingual sites

Discussion in 'PHP' started by pierrehs, Feb 8, 2011.

  1. #1
    Hello,
    I'll start a multilingual site and so I wonder what is the most efficient way, the quickest and easiest way for translators to translate the site.

    Many CMS use tables array (but I think it's a heavy can?)
    Others, such as Wordpress and Drupal use I think GetText
    Joomla uses files .ini (maybe the files .ini are the tables could fast PHP?)
    or file. xml and still in a database (which I think is the heaviest)
    Have you any advice in choosing?
    and what do you use?

    Regards,
    Peter
     
    pierrehs, Feb 8, 2011 IP
  2. clonepal

    clonepal Active Member

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #2
    Include text values into arrays in seperate files.(PHP)

    -Alex
     
    clonepal, Feb 8, 2011 IP
  3. pierrehs

    pierrehs Greenhorn

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    Thank you for your reply but I still await further advice
     
    pierrehs, Feb 9, 2011 IP
  4. W3Theory

    W3Theory Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Use this method, make a function that selects a file, for example "Spanish.php" if the language chosen is Spanish and in Spanish.php Have for example....$LANG['SiteTitle'] = "Spanish title here";

    Then, everytime you echo out text, use the function you made.

    E.g

    echo Translate($Var);
     
    W3Theory, Feb 9, 2011 IP
  5. pierrehs

    pierrehs Greenhorn

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    Hello,
    Thank you for your explanations
    I do not use function but I create a small script for this


    <?php
    $lang = (isset($_REQUEST['lang'])) &&  file_exists('/var/www/lang/'.$_REQUEST['lang'].'.php') ? include '/var/www/lang/'.$_REQUEST['lang'].'.php' : include '/var/www/lang/en.php';
    
    PHP:

    Otherwise the link to create an array
    maybe a class like with constant this is

    <?php
    class lang {
    const __KEY_LANG = 'My Language Key';
    const __KEY_LANG2 = 'My Language Key 2';
    }
    PHP:
     
    pierrehs, Feb 9, 2011 IP