[Mapbender-commits] r2371 - in branches/2.5: . conf http/classes http/javascripts http/php lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Apr 10 09:54:06 EDT 2008


Author: christoph
Date: 2008-04-10 09:54:06 -0400 (Thu, 10 Apr 2008)
New Revision: 2371

Added:
   branches/2.5/lib/
   branches/2.5/lib/i18n.php
Modified:
   branches/2.5/conf/mapbender.conf-dist
   branches/2.5/http/classes/class_locale.php
   branches/2.5/http/javascripts/mod_switchLocale_noreload.php
   branches/2.5/http/php/mod_digitize_messages.php
   branches/2.5/http/php/mod_wfsSpatialRequest_messages.php
Log:
see http://lists.osgeo.org/pipermail/mapbender_dev/2008-April/001134.html

Modified: branches/2.5/conf/mapbender.conf-dist
===================================================================
--- branches/2.5/conf/mapbender.conf-dist	2008-04-10 12:50:19 UTC (rev 2370)
+++ branches/2.5/conf/mapbender.conf-dist	2008-04-10 13:54:06 UTC (rev 2371)
@@ -139,9 +139,19 @@
 # Mapbender error logging
 # --------------------------------------------
 
-define("LOG_LEVEL", "all"); //"off","error","warning","notice" or "all"
+define("LOG_LEVEL", "error"); //"off","error","warning","notice" or "all"
 define("LOG_JS", "on"); // "on", "alert", "console" or "off"
 
+# --------------------------------------------
+# Internationalization
+# --------------------------------------------
+
+define("USE_I18N", false);  // requires gettext for PHP. 
+							// If "false", LANGUAGE is set to english
+define("LANGUAGE", "en");   // only available if USE_I18N is "true". 
+							// "en", "de", "bg", "gr", "nl", "it", es"
+require_once(dirname(__FILE__) . "/../lib/i18n.php");
+
 ###HACK for GLOBALS
 $DBSERVER=DBSERVER;
   $DB=DB;

Modified: branches/2.5/http/classes/class_locale.php
===================================================================
--- branches/2.5/http/classes/class_locale.php	2008-04-10 12:50:19 UTC (rev 2370)
+++ branches/2.5/http/classes/class_locale.php	2008-04-10 13:54:06 UTC (rev 2371)
@@ -37,10 +37,18 @@
 	var $status = "No locale set.";
 	
 	function Mb_locale($languageId) {
+		if (!$languageId) {
+			$languageId = LANGUAGE;
+		}
   		$e = new Mb_notice("class_locale: setting locale to " . $languageId);
-		if (!$this->setCurrentLocale($languageId)) {
-			$e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
+		if (USE_I18N) {
+			if (!$this->setCurrentLocale($languageId)) {
+				$e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
+			}
 		}
+		else {
+			$this->setCurrentLocale($this->defaultLanguage);
+		}
 	}
 
 	/**
@@ -85,7 +93,7 @@
 			$this->os = $this->guessHostOS();
 		}
 		
-		if ($this->os != null && isset($languageId)) {
+		if (!USE_I18N || ($this->os != null && isset($languageId))) {
 			if ($this->isKnownLanguage($languageId)) {
 				
 				if ($this->systemLocales == null) {

Modified: branches/2.5/http/javascripts/mod_switchLocale_noreload.php
===================================================================
--- branches/2.5/http/javascripts/mod_switchLocale_noreload.php	2008-04-10 12:50:19 UTC (rev 2370)
+++ branches/2.5/http/javascripts/mod_switchLocale_noreload.php	2008-04-10 13:54:06 UTC (rev 2371)
@@ -18,8 +18,13 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_locale.php");
 
 include(dirname(__FILE__) . "/../include/dyn_js.php");
+
+if (!USE_I18N) {
+	echo "var languages = '" . $_SESSION["mb_lang"] . "';";
+}
 ?>
 
 function validate_locale(){

Modified: branches/2.5/http/php/mod_digitize_messages.php
===================================================================
--- branches/2.5/http/php/mod_digitize_messages.php	2008-04-10 12:50:19 UTC (rev 2370)
+++ branches/2.5/http/php/mod_digitize_messages.php	2008-04-10 13:54:06 UTC (rev 2371)
@@ -27,45 +27,45 @@
 // Messages
 //
 $msg_obj = array();
-$msg_obj["messageDescriptionPolygon"] = _("polygon");
-$msg_obj["messageDescriptionLine"] = _("line");
-$msg_obj["messageDescriptionPoint"] = _("point");
-$msg_obj["messageErrorNotAnInteger"] = _("Not an integer value.");
-$msg_obj["messageErrorNotAFloat"] = _("Not a double value.");
-$msg_obj["messageErrorFieldIsEmpty"] = _("This field may not be empty.");
-$msg_obj["messageErrorFormEvaluation"] = _("Failure during form evaluation.");
-$msg_obj["messageErrorWfsWrite"] = _("An error occured.");
-$msg_obj["messageSuccessWfsWrite"] = _("Success.");
-$msg_obj["messageConfirmDeleteGeomFromDb"] = _("Delete geometry from database?");
-$msg_obj["messageConfirmDeleteAllGeomFromList"] = _("Clear list of geometries?");
-$msg_obj["messageSelectAnOption"] = _("Please select an entry.");
-$msg_obj["buttonLabelSaveGeometry"] = _("Save");
-$msg_obj["buttonLabelUpdateGeometry"] = _("Update");
-$msg_obj["buttonLabelDeleteGeometry"] = _("Delete");
-$msg_obj["buttonLabelAbort"] = _("Abort");
-$msg_obj["errorMessageEpsgMismatch"] = _("Fatal error: EPSG mismatch. ");
-$msg_obj["errorMessageNoGeometrySelected"] = _("No geometry selected!");
-$msg_obj["buttonLabelPointOff"] = _("add point");
-$msg_obj["buttonLabelPointOn"] = _("cancel editing");
-$msg_obj["buttonLabelLineOff"] = _("add line");
-$msg_obj["buttonLabelLineOn"] = _("finish line");
-$msg_obj["buttonLabelPolygonOff"] = _("add polygon");
-$msg_obj["buttonLabelPolygonOn"] = _("close polygon");
-$msg_obj["buttonLabelMoveBasepointOff"] = _("move basepoint");
-$msg_obj["buttonLabelMoveBasepointOn"] = _("move basepoint");
-$msg_obj["buttonLabelInsertBasepointOff"] = _("Insert basepoint");
-$msg_obj["buttonLabelInsertBasepointOn"] = _("Insert basepoint");
-$msg_obj["buttonLabelDeleteBasepointOff"] = _("Delete basepoint");
-$msg_obj["buttonLabelDeleteBasepointOn"] = _("Delete basepoint");
-$msg_obj["buttonLabelClearListOff"] = _("clear list of geometries");
-$msg_obj["buttonLabelClearListOn"] = _("clear list of geometries");
-$msg_obj["buttonDig_wfs_title"] = _("save / update / delete");
-$msg_obj["buttonDig_remove_title"] = _("remove from workspace");
-$msg_obj["buttonDig_removeDb_title"] = _("remove from database");
-$msg_obj["closePolygon_title"] = _("click the first basepoint to close the polygon");
-$msg_obj["measureTagLabelCurrent"] = _("Current: ");
-$msg_obj["measureTagLabelTotal"] = _("Total: ");
-$msg_obj["digitizeDefaultGeometryName"] = _("new");
+$msg_obj["messageDescriptionPolygon"] = _mb("polygon");
+$msg_obj["messageDescriptionLine"] = _mb("line");
+$msg_obj["messageDescriptionPoint"] = _mb("point");
+$msg_obj["messageErrorNotAnInteger"] = _mb("Not an integer value.");
+$msg_obj["messageErrorNotAFloat"] = _mb("Not a double value.");
+$msg_obj["messageErrorFieldIsEmpty"] = _mb("This field may not be empty.");
+$msg_obj["messageErrorFormEvaluation"] = _mb("Failure during form evaluation.");
+$msg_obj["messageErrorWfsWrite"] = _mb("An error occured.");
+$msg_obj["messageSuccessWfsWrite"] = _mb("Success.");
+$msg_obj["messageConfirmDeleteGeomFromDb"] = _mb("Delete geometry from database?");
+$msg_obj["messageConfirmDeleteAllGeomFromList"] = _mb("Clear list of geometries?");
+$msg_obj["messageSelectAnOption"] = _mb("Please select an entry.");
+$msg_obj["buttonLabelSaveGeometry"] = _mb("Save");
+$msg_obj["buttonLabelUpdateGeometry"] = _mb("Update");
+$msg_obj["buttonLabelDeleteGeometry"] = _mb("Delete");
+$msg_obj["buttonLabelAbort"] = _mb("Abort");
+$msg_obj["errorMessageEpsgMismatch"] = _mb("Fatal error: EPSG mismatch. ");
+$msg_obj["errorMessageNoGeometrySelected"] = _mb("No geometry selected!");
+$msg_obj["buttonLabelPointOff"] = _mb("add point");
+$msg_obj["buttonLabelPointOn"] = _mb("cancel editing");
+$msg_obj["buttonLabelLineOff"] = _mb("add line");
+$msg_obj["buttonLabelLineOn"] = _mb("finish line");
+$msg_obj["buttonLabelPolygonOff"] = _mb("add polygon");
+$msg_obj["buttonLabelPolygonOn"] = _mb("close polygon");
+$msg_obj["buttonLabelMoveBasepointOff"] = _mb("move basepoint");
+$msg_obj["buttonLabelMoveBasepointOn"] = _mb("move basepoint");
+$msg_obj["buttonLabelInsertBasepointOff"] = _mb("Insert basepoint");
+$msg_obj["buttonLabelInsertBasepointOn"] = _mb("Insert basepoint");
+$msg_obj["buttonLabelDeleteBasepointOff"] = _mb("Delete basepoint");
+$msg_obj["buttonLabelDeleteBasepointOn"] = _mb("Delete basepoint");
+$msg_obj["buttonLabelClearListOff"] = _mb("clear list of geometries");
+$msg_obj["buttonLabelClearListOn"] = _mb("clear list of geometries");
+$msg_obj["buttonDig_wfs_title"] = _mb("save / update / delete");
+$msg_obj["buttonDig_remove_title"] = _mb("remove from workspace");
+$msg_obj["buttonDig_removeDb_title"] = _mb("remove from database");
+$msg_obj["closePolygon_title"] = _mb("click the first basepoint to close the polygon");
+$msg_obj["measureTagLabelCurrent"] = _mb("Current: ");
+$msg_obj["measureTagLabelTotal"] = _mb("Total: ");
+$msg_obj["digitizeDefaultGeometryName"] = _mb("new");
 
 $json = new Services_JSON();
 $output = $json->encode($msg_obj);

Modified: branches/2.5/http/php/mod_wfsSpatialRequest_messages.php
===================================================================
--- branches/2.5/http/php/mod_wfsSpatialRequest_messages.php	2008-04-10 12:50:19 UTC (rev 2370)
+++ branches/2.5/http/php/mod_wfsSpatialRequest_messages.php	2008-04-10 13:54:06 UTC (rev 2371)
@@ -27,12 +27,12 @@
 // Messages
 //
 $msg_obj = array();
-$msg_obj["buttonLabelRectangle"] = _("select by rectangle");
-$msg_obj["buttonLabelPolygon"] = _("select by polygon");
-$msg_obj["buttonLabelPoint"] = _("select by point");
-$msg_obj["buttonLabelExtent"] = _("select by extent");
-$msg_obj["buttonLabelDialogue"] = _("open dialogue form");
-$msg_obj["errorMessageInvalidExtent"] = _("Invalid box!");
+$msg_obj["buttonLabelRectangle"] = _mb("select by rectangle");
+$msg_obj["buttonLabelPolygon"] = _mb("select by polygon");
+$msg_obj["buttonLabelPoint"] = _mb("select by point");
+$msg_obj["buttonLabelExtent"] = _mb("select by extent");
+$msg_obj["buttonLabelDialogue"] = _mb("open dialogue form");
+$msg_obj["errorMessageInvalidExtent"] = _mb("Invalid box!");
 
 $json = new Services_JSON();
 $output = $json->encode($msg_obj);

Added: branches/2.5/lib/i18n.php
===================================================================
--- branches/2.5/lib/i18n.php	                        (rev 0)
+++ branches/2.5/lib/i18n.php	2008-04-10 13:54:06 UTC (rev 2371)
@@ -0,0 +1,8 @@
+<?php
+	function _mb ($someString) {
+		if (USE_I18N) {
+			return _($someString);
+		}
+		return $someString;
+	}
+?>
\ No newline at end of file



More information about the Mapbender_commits mailing list