Index: src/webservice/htdocs/inc/DatabaseHandler.php
===================================================================
--- src/webservice/htdocs/inc/DatabaseHandler.php	(revision 92c9c7cf0efa1759b51ecb3e58d804f77ebdcbf0)
+++ 	(revision )
@@ -1,109 +1,0 @@
-<?php
-/*
-    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301  USA.
-*/
-
-require_once("config/config.php");
-
-/**
-	* @brief Manages the database connection for SiWeather webservice
-	* @note This class needs to load the SpatialLite SQLite extension.
-	*       Therefore the sqlite3.extension_dir in php.ini must be set
-  *       to a path, where this extension could be found!
-	*/
-class DatabaseHandler {
-	private $_database;
-	private $_databaseFile;
-	private $_lastErrorMessage;
-
-	function __construct()
-	{
-		$this->_lastErrorMessage = "";
-		$this->_database = null;
-		if(!getConfig("dataDirectory")){
-			$this->_lastErrorMessage = "No data directory set!";
-			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
-			$this->databaseFile = null;
-		}
-		else{
-			$this->_databaseFile = getConfig("dataDirectory") ."/siweather.sqlite";
-		}
-	}
-
-	function __destruct()
-	{
-		if(!is_null($this->_database)){
-			$this->close();
-		}
-	}
-
-	public function databaseFile()
-	{
-		return $this->_databaseFile;
-	}
-
-	public function lastErrorMessage()
-	{
-		return $this->_lastErrorMessage;
-	}
-
-	public function connect()
-	{
-		if(!is_null($this->_database)){
-			echo "database is not null";
-			return true;
-		}
-		if(is_null($this->_databaseFile)){
-			$this->_lastErrorMessage = "No database file given";
-			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
-			return false;
-		}
-		try {
-			$db = new SQLite3($this->_databaseFile);
-		}
-		catch(PDOException $exception){
-			$this->_lastErrorMessage = $exception->getMessage();
-			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
-			return false;
-		}
-		# loading SpatiaLite as an extension
-		if(!$db->loadExtension("libspatialite.so.7")){
-			$this->_lastErrorMessage = "Could not load SpatialLite extension: ". $db->lastErrorMsg();
-			error_log($this->lastErrorMessage());
-			return false;
-		}
-		$this->_database = $db;
-		return true;
-	}
-
-	public function close()
-	{
-		if(is_null($this->_database)){
-			return true;
-		}
-		if($this->_database->close()){
-			$this->_database = null;
-			return true;
-		}
-		$this->_lastErrorMessage = $this->_database->lastErrorMsg();
-		error_log("Failed to close the database: "+ $this->lastErrorMessage());
-		return false;
-	}
-}
-
-?>
Index: src/webservice/htdocs/inc/envsetup.php
===================================================================
--- src/webservice/htdocs/inc/envsetup.php	(revision 851179ec808ab3b445c3f5707e15a26c0d28693b)
+++ src/webservice/htdocs/inc/envsetup.php	(revision 851179ec808ab3b445c3f5707e15a26c0d28693b)
@@ -0,0 +1,30 @@
+<?php
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+// set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ ."/../../vendor/");
+$composerAutoloader = require(__DIR__ ."/../../vendor/autoload.php");
+if(is_object($composerAutoloader)){
+	$composerAutoloader->add("SiWeather\\Webservice\\", __DIR__ ."/../");
+	$composerAutoloader->register();
+}
+
+require_once(__DIR__ ."/translate.php");
+
+?>
Index: src/webservice/htdocs/inc/translate.php
===================================================================
--- src/webservice/htdocs/inc/translate.php	(revision 851179ec808ab3b445c3f5707e15a26c0d28693b)
+++ src/webservice/htdocs/inc/translate.php	(revision 851179ec808ab3b445c3f5707e15a26c0d28693b)
@@ -0,0 +1,89 @@
+<?php
+######################
+#
+#    Copyright (C) 2015 EngSaS - Engineering Soluations and Services Langenbach. All rights reserved.
+#
+#    This library is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser General Public
+#    License as published by the Free Software Foundation; either
+#    version 2.1 of the License, or (at your option) any later version.
+#
+#    This library is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    Lesser General Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser General Public
+#    License along with this library; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+#    MA 02110-1301  USA.
+#
+######################
+
+define("LOCALE_SESSION_KEY", "gyl_locale");
+define("LOCALE_DEFAULT", "en_US");
+define("LOCALE_REQUEST_PARAN", "lang");
+define("LOCALE_DOMAIN", "messages"); // Must be the same name, as the po and mo files and the directory they are in
+
+require_once("HTTP2.php");
+
+$config = new SiWeather\Webservice\WebserviceConfig();
+
+$numberDelimiterDecimal = array();
+$numberDelimiterDecimal["en_US"] = ".";
+$numberDelimiterDecimal["de_DE"] = ",";
+
+$_localeCurrent = LOCALE_DEFAULT;
+if(isset($_SESSION)){
+	if(array_key_exists(LOCALE_REQUEST_PARAN, $_REQUEST)){
+		$_localeCurrent = $_REQUEST[LOCALE_REQUEST_PARAN];
+		$_SESSION[LOCALE_SESSION_KEY] = $_localeCurrent;
+	}
+	elseif(array_key_exists(LOCALE_SESSION_KEY, $_SESSION)){
+		$_localeCurrent = $_SESSION[LOCALE_SESSION_KEY];
+	}
+	else{
+		$supportedLanguages = Array(LOCALE_DEFAULT);
+		$transDirHandle = opendir($config->getConfig("translationdirectory"));
+		if($transDirHandle){
+			while(false !== ($entry = readdir($transDirHandle))){
+				if($entry != "." && $entry != ".."){
+					$supportedLanguages[str_replace("_", "-", $entry)] = true;
+				}
+			}
+			
+			closedir($transDirHandle);
+		}
+		$http = new HTTP2();
+		$_localeCurrent = str_replace("-", "_", $http->negotiateLanguage($supportedLanguages, LOCALE_DEFAULT));
+		$_SESSION[LOCALE_SESSION_KEY] = $_localeCurrent;
+	}
+}
+
+$results = putenv("LC_ALL0=". $_localeCurrent);
+if(!$results){
+	error_log("putenv failed (". $result .")");
+}
+$result = setlocale(LC_ALL, $_localeCurrent);
+if(!$results){
+	error_log("setlocale failed (". $result .")");
+}
+$results = bindtextdomain(LOCALE_DOMAIN, $config->getConfig("translationdirectory"));
+if(!$results){
+	error_log("bindtextdomain failed (". $result .")");
+}
+$results = bind_textdomain_codeset(LOCALE_DOMAIN, "UTF-8");
+if(!$results){
+	error_log("bind_textdomain_codeset failed (". $result .")");
+}
+$results = textdomain(LOCALE_DOMAIN);
+if(!$results){
+	error_log("textdomain failed (". $result .")");
+}
+
+class Translator {
+	public static function swGettext($id)
+	{
+		return vsprintf(gettext($id), array_slice(func_get_args(), 1));
+	}
+}
