Read/contemplate add_dutch_UI_translation.patch first.
Note that this diff is against SVN.


Applying a decent set_error_handler makes this a setup to do
		try{
			try{
				include_once (sprintf("lang/%s.php", $_SESSION['profile']['language']));
			}
			catch(){
				/* translation apparently does not exist
				   load default (english) language pack */
			}
		}
		catch(){
			/* complete failure */
		}
If that translation exists, load it. Otherwise load default.

No more hardcoding, just drop a file in the appropriate place and (re)build the translation lists.
Uh, and update the new and improved "questiontype_v2" table of course.
(We should add a commented INSERT statement at the top of the language files)


Index: CATS/functions/translation.php
===================================================================
--- CATS/functions/translation.php	(revision 1641)
+++ CATS/functions/translation.php	(working copy)
@@ -2,12 +2,32 @@
 
  function getlang(){
 
-  if(isset($_SESSION['profile']['language']) && $_SESSION['profile']['language']=='DE'){
-   include_once ("lang/german.php");      
+/* could be made even cleaner by proper use of set_error_handler & errorexception
+   http://nl3.php.net/manual/en/class.errorexception.php#errorexception.examples */
+  try{
+    function loadlangfile($s){
+      if(file_exists($s)){
+        include_once ($s);
+      }
+      else{
+        throw new Exception("can't load file");
+      }	 
+    }
+    try{
+      switch($_SESSION['profile']['language']){
+        case "DE" :  loadlangfile ("lang/german.php"); break;
+        case "NL" :  loadlangfile ("lang/dutch.php"); break;
+        default :  throw new Exception("no translation available?"); break; 
+      }
+    }
+    catch(Exception $e){
+    	/* log error somehow? */
+      loadlangfile("lang/english.php");
+    }	 
+  }
+  catch(Exception $e){
+    die("can\'t load ANY language file");
   }
-  else{
-   include_once ("lang/english.php");  
-  }
  
  }
  
Index: CATS/index.php.template
===================================================================
--- CATS/index.php.template	(revision 1641)
+++ CATS/index.php.template	(working copy)
@@ -56,10 +56,16 @@
 ?><div id="language">
  <form action="index.php" method="post">
   <div>
-  <select size="1" class="dropdown_language" name="language">
+  <select size="1" class="dropdown_language" name="language">
    <option value="none">choose language</option>
-   <option value="DE">DE</option>
-   <option value="EN">EN</option>
+   <optgroup label="Default">
+	   <option value="EN">EN</option>
+   </optgroup>
+   <optgroup label="Other languages">
+<?php
+	include_once("lang/langpacks.php");
+?>
+   </optgroup>
   </select><input name="submit" class="language_Button" type="submit" value="change" />
   </div>
  </form><?php
Index: CATS/lang/langpacks.php
===================================================================
--- CATS/lang/langpacks.php	(revision 0)
+++ CATS/lang/langpacks.php	(revision 0)
@@ -0,0 +1,2 @@
+     <option value="DE">DE</option>
+     <option value="NL">NL</option>
