[Mapbender-commits] r1656 - trunk/mapbender/resources/db/postgresql

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Aug 10 06:01:38 EDT 2007


Author: astrid_emde
Date: 2007-08-10 06:01:38 -0400 (Fri, 10 Aug 2007)
New Revision: 1656

Modified:
   trunk/mapbender/resources/db/postgresql/pgsql_schema.sql
Log:
database changes for version 2.5 integrated

Modified: trunk/mapbender/resources/db/postgresql/pgsql_schema.sql
===================================================================
--- trunk/mapbender/resources/db/postgresql/pgsql_schema.sql	2007-08-10 09:11:24 UTC (rev 1655)
+++ trunk/mapbender/resources/db/postgresql/pgsql_schema.sql	2007-08-10 10:01:38 UTC (rev 1656)
@@ -24,6 +24,7 @@
     e_pos integer,
     e_public integer,
     e_comment text,
+    e_title character varying(255),    
     e_element character varying(255) DEFAULT ''::character varying NOT NULL,
     e_src character varying(255),
     e_attributes text,
@@ -355,6 +356,20 @@
 );
 
 
+ -- 
+ -- new table translation: new table for translations
+ -- 
+ CREATE TABLE translations
+ (
+  trs_id serial PRIMARY KEY not null,
+  locale varchar(8),
+  msgid varchar(512),
+  msgstr varchar(512)
+ );
+
+ CREATE INDEX msgid_idx ON translations(msgid);
+
+
 --
 -- TOC entry 1262 (class 1259 OID 47913270)
 -- Dependencies: 4
@@ -419,7 +434,8 @@
     f_respos integer,
     f_form_element_html TEXT NULL,
     f_edit int4,
-    f_mandatory int4
+    f_mandatory int4,
+    f_auth_varname character varying(255)
 );
 
 
@@ -1076,3 +1092,31 @@
 
 ALTER TABLE mb_log ADD CONSTRAINT pk_mb_log PRIMARY KEY  (id); 
 
+
+ -- 
+ -- new function gettext for easy translations
+ -- 
+ CREATE OR REPLACE FUNCTION gettext(locale_arg "text", string "text")
+ RETURNS "varchar" AS
+ $BODY$
+ DECLARE
+    msgstr varchar(512);
+    trl RECORD;
+ BEGIN
+    -- RAISE NOTICE '>%<', locale_arg;
+
+    SELECT INTO trl * FROM translations
+    WHERE trim(from locale) = trim(from locale_arg) AND msgid = string;
+    -- we return the original string, if no translation is found.
+    -- this is consistent with gettext's behaviour
+    IF NOT FOUND THEN
+        RETURN string;
+    ELSE
+        RETURN trl.msgstr;
+    END IF; 
+ END;
+ $BODY$
+  LANGUAGE 'plpgsql' VOLATILE;
+
+
+



More information about the Mapbender_commits mailing list