title: My multilingual website with only basic php (without zend_translate, gettext, etc...) will I have problems in the future?
body: <p>I tried <code>gettext</code>, but my free hosting doesn't allow it. I thought about <code>Zend_translate</code>, but I didn't want to use elements from frameworks since my page is mostly static.</p>
  
  <p>So, I ended up with this tutorial:</p>
  
  <p><a href="http://www.bitrepository.com/php-how-to-add-multi-language-support-to-a-website.html" rel="nofollow noreferrer">http://www.bitrepository.com/php-how-to-add-multi-language-support-to-a-website.html</a></p>
  
  <p>Where the author only use basic php (not sure), and it seems to work, but I'm not quite sure if it a good (or common) practice or if it can cause me problems in the future (adding and deleting bunch of code).</p>
  
  <p>Here it is:</p>
  
  <p><strong>common.php</strong>:</p>
  
  <pre><code>&lt;?php
  session_start();
  header('Cache-control: private'); // IE 6 FIX
  
  if(isSet($_GET['lang']))
  {
  $lang = $_GET['lang'];
  
  // register the session and set the cookie
  $_SESSION['lang'] = $lang;
  
  setcookie("lang", $lang, time() + (3600 * 24 * 30));
  }
  else if(isSet($_SESSION['lang']))
  {
  $lang = $_SESSION['lang'];
  }
  else if(isSet($_COOKIE['lang']))
  {
  $lang = $_COOKIE['lang'];
  }
  else
  {
  $lang = 'en';
  }
  
  switch ($lang) {
    case 'en':
    $lang_file = 'lang.en.php';
    break;
  
    case 'de':
    $lang_file = 'lang.es.php';
    break;
  
    default:
    $lang_file = 'lang.en.php';
  
  }
  
  include_once 'languages/'.$lang_file;
  ?&gt;
  </code></pre>
  
  <p><strong>languages/lang.en.php:</strong></p>
  
  <pre><code>&lt;?php
  /* 
  -----------------
  Language: English
  -----------------
  */
  
  define('GREETING, Hello World');
  ?&gt;
  </code></pre>
  
  <p><strong>languages/lang.es.php:</strong></p>
  
  <pre><code>&lt;?php
  /* 
  -----------------
  Language: Espanol
  -----------------
  */
  
  define('GREETING, Hola Mundo');
  ?&gt;
  </code></pre>
  
  <p><strong>index.php:</strong></p>
  
  <pre><code>include_once 'common.php';
  &lt;p&gt;&lt;?php echo LANG_TEST; ?&gt;&lt;/p&gt;
  </code></pre>
  
  <p>So, if I want to change it to Spanish I just add: <code>?lang=es</code> in the <code>URL</code> (after <code>index.php</code>)</p>